Robsta's Recent Forum Activity

  • So I've noticed some peculiar behavior in regards to networking the same objects across multiple layers. Right now I'm specifically looking at 2 "player" sprites, which I use in all the layouts of the game I'm currently developing. What appears to be happening is that when a player is "created" in a new layout due to being synchronized from the host, it's initial position is set to the last position it was at in the previous layout. This only happens on the client side and corrects itself after a short time of the player jumping all over the layout to figure out where it should be (half a second maybe?), but it's long enough to mess up events depending on it's location as soon as it's created, as demonstrated below. For obvious reasons this only occurs in the 2nd and later layouts during operation, it doesn't occur in the first layout.

    Here are the significant events (I'm using r177):

    In the client group I call these

    [attachment=2:2xbwj4vu][/attachment:2xbwj4vu]

    The "On setup layout" is only called on the second and later layouts, as the function that calls it is called on start of layout, and is only run if a multiplayer connection has already been established. For the first layout I call

    [attachment=1:2xbwj4vu][/attachment:2xbwj4vu]

    in the networking group (for the client only), which essentially does the exact same thing.

    To transition between the layouts I use

    [attachment=0:2xbwj4vu][/attachment:2xbwj4vu]

    The call for the Synaptop function (Synaptop.. Display: Player.ResetX etc...) is purely a debugging message I added to help isolate the problem.

    When I run the project and transition into the 2nd or later layout, the "->player on created:" function gets called 2ce per player. The first time it calls the functions with the correct locations, the second time it calls it with the location it was at in the previous layout. The question is where exactly is the problem, and how to solve it?

    I am assuming that the first time it called it for the characters already on the layout that got destroyed with the player->destroy function on the start of the layout,

  • Ah, event groups. That'll do it thanks.

  • Just a quick question. What is the difference between restart layout and go to layout (LayoutName)

    I know there is a difference, since I was using Restart Layout and I got multiple problems with behaviors acting funny, then I switched to Go to Layout and the problems were fixed. Is it something like if the on start of layout functions are called?

  • Problem Description

    Multiplayer is acting strange in version r176

    Attach a Capx

    [attachment=0:7zevmz9c]Multiplayer game example.capx[/attachment:7zevmz9c]

    Description of Capx

    Unmodified Multiplayer example

    Steps to Reproduce Bug

    • Step 1 Start Construct, Open the 3rd multiplayer example (real time game).
    • Step 2 Press the Run Layout Button (for me default is Firefox)
    • Step 3 Type "Foo" into the text box and start the server
    • Step 4 Run the layout in a new tab in Firefox by typing in the URL "LocalHost:5000"
    • Step 5 Type "Fred" into the text box and connect to the server

    Observed Result

    The game proceeds to the 2nd layout, and the user is presented with a pop up box that informs them that: [quote:7zevmz9c]Javascript error!

    Error: RTCPeerConnection constructor passed invalid RTCConfiguration - missing url

    http://localhost:50000/c2mp-peer.js, line 127 (col 35)

    This is likely a bug in Construct 2 or a third party plugin or behavior - please report it to the developer. Subsequent errors will be logged to the console

    In the background you can see that the networking text box says:

    Connected Logging in...

    Logged in with alias: Fred (AEEP)

    Joining Room...

    Kicked (either could not connect to host or host quit)

    The host's game does not appear to change in any way, they can still move and shoot and there are no new messages or peers.

    Expected Result

    Before updating, I would have a networked game.

    Affected Browsers

    • Chrome: Cannot connect to Firefox or visa versa, but can connect to a Chrome host.
    • FireFox: YES
    • Internet Explorer: Does not support multiplayer

    Operating System and Service Pack

    Windows 7 ultimate

    Construct 2 Version ID

    Construct 2 r176 (64 bit) beta

  • There are plenty of ways to change this:

    If you want one big background (stretched) then you open an image editor such as paint.net and stretch the image and save it manually. Alternately find a background with a higher resolution.

    If you want a background that you can adjust the resolution of and have it stretch whenever, you have to use a sprite (or other similar plugin, such as a 9 patch). However note that this is less computationally efficient, and drawing to the screen is what takes up the most processor time.

    If you want a background that fills the screen and never moves, then set the background's parallax to 0 and make sure the source image and tiled background object are both the same resolution as the screen.

  • bump

  • So another multiplayer question. This is mostly for debugging purposes, is it possible to see a list or iterate through a list of all the objects currently being synced with the multiplayer addon?

  • alextro oh cool. I wasn't able to view your .capx because you're using the beta version (I'm using latest stable version), so I had to guess what you did there.

  • It sounds to me like you want the sprite to face one direction with is angle variable, which is independent of the direction that it is moving. You can do this, it depends on how you're moving the sprite.

    For example, if you're using the 8 direction behavior, one of the properties is "set angle" This has the options to set the angle of the sprite to the angle it is moving, to round the angle off to the nearest 90 or 45 degrees, or to not set the angle of the sprite depending on which direction it is moving. So what you would want is "Set angle: No"

  • caiorosisca, yes this should work as what you are doing is essentially adding another UID to the object. It's not necessary because the object already has a UID, but I have been known to do this (and other similar things) in the past because it seems simpler. (It's not all that much simpler in fact, I just like using my own code).

    Ramones Suggestion is what I would suggest (preferably the pick by Boolean, as it accounts for selecting multiple objects at once and doesn't have a global variable associated with it.)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well if you have instanced dungeons, you could probably write it so that you don't need a server for each of them, just make it so that if any player leaves (especially the host, or just only the host), then all players are booted (and returned to the main server). Alternatively it wouldn't be hard to make single-player instanced dungeons without a need for a server at all.

    But as I said, unless you can find someone with more experience with the multiplayer plugin and/or instancing with it, the best way to learn these things is to try them out yourself. You can simulate multiple players by using different tabs, even while you debug. (you can also do it with different browsers)

  • Well, I can't say that I've tried this, but construct does support joining and leaving rooms (while still being connected to the signalling server) And also supports disconnecting and reconnecting to the signalling server. Perhaps you can play around with disconnecting from one room and connecting to a different room in the same game. However be aware that the Construct's multiplayer object automatically makes the first user in each room the "host", and if the host disconnects, all other players in the room are booted.

    And if you play around with it, come back and tell me if it works, so I can know how to do it later.

Robsta's avatar

Robsta

Member since 17 Jan, 2014

None one is following Robsta yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies