Madguy's Forum Posts

  • I was curious about this as well. There was a post awhile back that indicated the issue was being dealt with in some way.

    Ashley is this something that's still in the works?

  • I like Music For Programming a lot.

    "A series of mixes intended for listening while programming to aid concentration and increase productivity"

  • [quote:26g0wbd7]As far as I can see from the ghostshooter example the lag compensation works for instant hit bullets/lasers - but does this work for bullets which fly a while before hitting anything? I dont know if it works or how to set it up. :/

    Here's a simple way to do it: If a bullet is on the screen, do a collision check between the bullet and the lag-compensated version of the object on every tick. Alternatively, you could perform the check only if the bullet is already within a certain distance of the object.

    As for why certain objects aren't appearing, it's hard for me to say at the moment-- I haven't been attempting to sync objects that are quick to appear and disappear (lasers, explosions, bullets, etc.). Did you set up an "On Created" event for them? Seems like you might be able to fix the issue with some actions in an event like that, or at least print out some text to ensure that the object is actually getting created in the first place.

  • Bl4ckSh33p I'm also using non-hitscan bullets, but I've not fully decided how I want it to work yet. I'm considering having them be completely separate, non-synced entities on each player's screen, and only dealing with collisions on the host's screen (so that there's no delay when the player hits the Fire button, I think that would kind of suck). I think in both my case and the case that you described, having lag compensation would be ideal, since there will always be a delay getting the information to the host after the peer presses the Fire button.

    There are probably some halfway-decent workarounds. Maybe if each moving object pushed their current position into an array every tick, and then we used a peer's latency (PeerLatency expression) to determine how far back in the array we should look to find where the collision check should occur. I haven't tried that and it might work really crappy, just throwing it out there.

  • Oh fantastic! I was not aware that this plugin existed-- that's exactly what I was looking for! Thanks so much!

  • As of right now, I haven't found a workaround for this particular issue. It's pretty annoying. You've basically got two options here to produce this sort of minimap-- place a bunch of tiny sprites on the screen, or use a tilemap. And both methods are memory hogs. I'm currently using a Metroid-style minimap, which is a lot more efficient, but also lacks the level of detail I was hoping to have.

    It would be great if Construct 2 had some sort of way to just draw pixels to the screen, or create a custom sprite on the fly, or make modifications to an existing sprite.

  • Seconding this. Watching high-speed bullets fly through walls on older systems is something I wish could be avoided :p

  • Indeed I have-- I'm actually about 1.5 weeks into grafting multiplayer into my game <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> Lag compensation is covered here:

    https://www.scirra.com/tutorials/915/mu ... ame/page-7

    Unfortunately I think I've hit a snag. To the best of my understanding, LagCompensate is only able to deal with objects associated with peers. Which is fine if you're doing a game where the player characters are the only moving objects with collision detection, but not so great if you want to have, for example, fast-moving AI-controlled enemies.

  • Ashley Regarding the previous bug I posted (https://www.scirra.com/forum/associate-object-with-peer-does-not-work-with-families_t111829)-- Apologies, I may have written the .capx incorrectly. However, the bug still stands when it's written differently.

    Problem Description

    The 'Associate Object with Peer' action only works with individual objects, and not with instances of a Family.

    Attach a Capx

    https://www.scirra.com/forum/download/file.php?mode=view&id=4445

    Description of Capx

    The CAPX is exactly the same as the Multiplayer Real-Time Game tutorial, with a few modifications in Game Events. I've removed all of the "Associate Object with Peer" statements, and created a function that does the following (search for the comment "MODIFICATION":

    Every 5 Seconds

    For Each PeerFamily

    Peer - Pick instance with UID PeerFamily.UID

    -> Associate PeerFamily with Peer.peerid

    This will cause the bug to occur. However, the bug does NOT occur if I swap out the Action for the following:

    -> Associate Peer with Peer.peerid

    Using this method works completely fine. All I'm doing differently is Associating the Peer instead of PeerFamily.

    Steps to Reproduce Bug

    • Step 1 - Run the game from the Login screen as you would normally to create a Host.
    • Step 2 - Open a second game window to create a Peer.
    • Step 3 - Wait for the logs to appear in both windows "Associated <Peer.uid> with ...".
    • Step 4 - Close the Peer window.

    Observed Result

    In the Host window, the Peer object is not destroyed, indicating that the association did not take place.

    Expected Result

    Object associated with Peer should be destroyed.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES) Operating System and Service Pack ____ Windows 8 64-Bit ____ Construct 2 Version ID r176
  • Problem Description

    The 'Associate Object with Peer' action only works with individual objects, and not with instances of a Family.

    Attach a Capx

    https://www.scirra.com/forum/download/file.php?id=4413

    Description of Capx

    The CAPX is exactly the same as the Multiplayer Real-Time Game tutorial, with a few modifications in Game Events (do a search for "MODIFICATION" to see them all). 'Associate Object with Peer' now associates with an instance of 'PeerFamily' instead of 'Peer'. 'PeerFamily' is a simple family that I created that has only one object: 'Peer'.

    Steps to Reproduce Bug

    • Step 1 - Run the game from the Login screen as you would normally to create a Host.
    • Step 2 - Open a second game window to create a Peer.
    • Step 3 - Close the Peer window.

    Observed Result

    In the Host window, the Peer object is not destroyed, indicating that the association did not take place.

    Expected Result

    Object associated with Peer should be destroyed.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES) Operating System and Service Pack ____ Windows 8 64-Bit ____ Construct 2 Version ID r175
  • I’m currently attempting to add multiplayer to my game, which has a lot of NPC bots/AI agents/whatever you want to call them. The agents use the same object type as the players-- anything a player can do, an AI Agent can do, which includes moving in all directions.

    From what I can gather, LagCompensateX and Y return the position coordinates for objects that were used in the “Associate object with peer” command. Does this mean that lag compensation would not be possible with non-player objects such as my AI Agents? Is there something I’m missing here? (I'm still fairly new to using the multiplayer plugin)

  • Nope, just once. Having the whole 160x160 tilemap appearing in my GUI layer is enough to cause the performance issue.

  • I'm currently attempting to create a minimap that looks something like the one pictured here:

    http://wip.warpdoor.com/content/images/ ... n_shop.png

    I'd like it to be a 1:1 representation of all of the tiles on my randomly generated map, with each tile taking up a single pixel, which would make it around 160x160 pixels. To accomplish this, I'm using a tilemap where the tiles have a height and width of 1.

    The problem: This seems to cause a performance issue. Under the Profiler, I can see that having this minimap on the screen causes my Engine usage and Draw Calls to double or triple, which in turn makes the overall CPU usage much higher-- enough to potentially cause frame rate issues.

    If there is some alternative solution to creating this sort of minimap, I'd love to hear it. Considering the minimap is static for the duration of the level, it seems like there must be a more efficient way to accomplish this within Construct 2 than displaying an entire tilemap on the screen.

  • Sure, here you go:

    https://www.dropbox.com/s/beczig6sgpctmb2/FunctionTest.capx

    This capx includes the two versions of the code. The second version is commented out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm guessing this is a known issue, but I haven't been able to find anything about it on the forum history. It looks to me like simply calling a function is using a larger amount of CPU power than I would have expected.

    As an experiment today, I wrote a very simple condition that looks like this:

    Test Group

    For Each PlayfieldObject

    If Variable1 = 1

    -> Set Variable 2 = 1

    There are about 40 instances of the sprite PlayfieldObject. Looking at the profiler, Test Group is using a very small amount of CPU memory, like <1%. Not bad considering this is running every tick.

    Then, I rewrote the code to incorporate a function:

    Test Group

    For Each PlayfieldObject

    If Function.Call("testFunction) = 1

    -> Set Variable 2 = 1

    On function "testFunction"

    If Variable1 = 1

    -> Set return value to 1

    To my surprise, this caused the CPU usage for the group to spike past 20%! Same basic functionality, the only difference being that in the second version of my code, I've used a function as one of my conditions. (and just to note, placing the function as an Action causes the same CPU spike).

    The game I'm working on has a lot of stuff going on at once (lots of AI characters, pathfinding, etc.), and while I'm attempting to be as efficient as possible, this concerns me, as I have a lot of functions being called on a regular basis-- not necessarily every tick, but I have some pretty extensive AI code that runs 5 to 10 times per second for each nearby character, and utilizes a lot of functions.

    Ashley is this something you were aware of? If this isn't something that can be solved, it seems like this might be worth a mention in the Performance Tips article?