Robsta's Forum Posts

  • 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.)

  • 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.

  • Just wondering if anyone else had ideas, preferably ones that didn't require a what is effectively a manual rewrite of part of the multiplayer object.

  • Well, as the asteroids example shows, you can do a lot in 100 events if you use them well, but number of events doesn't necessarily mean efficiency.

    I've written quite a few games that use over 100 events, because they're more complicated then asteroids.

  • Functions and arrays is what I use a lot of because I come from a programming background, and I used a ton of functions and arrays in code.

    I would keep ATT and DEF as instance variables since you're likely going to have different ATT/DEF for every player/enemy.

    Having the abilities in an array is better because that way you can give the same ability to multiple people and reference it. (And it packages the ability's variables together quite nicely.)

    I'm glad my post was helpful.

  • Well, construct does allow you to do math in most(all?) variable changes, so how I would do it is:

    Stats associated with each player/enemy (HP, ATT, and DEF)

    Stats associated with each ability (POWER, Anything else needed (maybe cooldown, mana cost, w/e) -> This could be organized in an array.

    Then when you detect the collision, I would probably call a function "Damage Enemy" with the parameters EnemyID, ATT and POWER

    In this function, you pick the correct enemy and run an event such as

    Enemy -> Subtract from instance variable "HP" -> Amount = ATT * POWER / Enemy.DEF

    Then make a sub event checking (if Enemy.HP <= 0)

    Enemy -> Destroy

    You can also add other things into this function such as creating floating text displaying the damage dealt or sound effects for the enemy being hit.

  • For additional precision you could use

    "string" = "0"

    or

    int("string") != 0.

  • In ghost shooter, when a ghost is destroyed, a the monster sprite is removed and a explosion sprite is created where it dies. What you want to do is when the ghost is destroyed, create a textbox where it dies. This is done in event 5 of the tutorial version of ghost shooter. You need to create a textbox and add the fade behavour to it. Then change the event.

    The event currently looks like this:

    Condition:

    Monster -> health <= 0

    Actions:

    Monster -> Destroy

    Monster -> Spawn "explosion" on lair "main" (image point 0)

    Explosion -> Set angle to "random(360)" degrees

    System -> Add "Monster.Movement.Speed" to Score

    You want the event to look more like this:

    Condition:

    Monster -> health <= 0

    Actions:

    Monster -> Destroy

    Monster -> Spawn "Diabetes Text" on lair "main" (image point 0)

    Diabetes Text -> Set text to "Diabetes is a group of diseases in which there are high blood sugar levels."

    System -> Add "Monster.Movement.Speed" to Score

    You may also want to create a dictionary or array of text about diabetes and set the diabetes text to a random message from it

  • troublesum I spent some time over looking over your code, and I see what you're doing. This is a much more hands on approach the the default multiplayer, and it works quite well in the example, but what you appear to be doing is circumventing a some of the functionality of the multiplayer plugin. Here's how:

    You're getting around the problems with desync compensation by just teleporting the object to the location it's supposed to be. While this does fix some of the problems I mentioned above (with the desync compensation leaving the player floating), it however can look jerky at times, especially since it only syncs position when the player stops moving (this includes at the top if they're jump!).

    You fix the problem of the player not seeing the correct events happen by letting the player decide where they are and send it to the host. I like this in that it's the player who needs to see what they're doing, in order to make informed decisions about what to do next. I don't like however, That this means the host doesn't have an accurate representation of where you are, and thus it's just transferring the problem from the player to the host. This might be fine in a cooperative game like I'm hoping to make, but I never would want to do it in a competitive game where this would make it possible to hack.

    It doesn't appear to do too well with lag. Sure no multiplayer options do too well with lag, but without a smooth desync compensation it looks to me to be just a little jerkier then the basic multiplayer plugin's sync option.

    So in conclusion, thank you for the example, I may take some ideas from it and implement it, for example I do like how you force-teleported without desync compensation sometimes, so I might use that. But I don't think I'll do this for everything in the game.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So I've been working on networking a platforming game, and I've seen some unusual behavior, specifically with how the the second player interacts with moving platforms.

    The server is perfect, it always gets everything right.

    On the client side the second player sways back and forth while on a moving platform that goes side to side. In extreme cases this can cause the player to fall off the platform on the client's side, but not on the server side, therefore causing a frantic desync interpolation fix fairly quickly.

    When on a platform that goes up and down it doesn't display jumping correct most of the time, and this can lead to the player jumping onto a platform on the server side, but not on the client side. The client side tries to fix this desync error by moving the player up, while gravity's pulling it down, so when the player's actually on a platform the client sees them self hovering below the platform.

    These problems increase if I "simulate lag" by a fair margin. These problems both sound like the moving platforms are not accounting for lag between the server and client, but as I'm using the platform behaviour, I do not know when to do lag compensation on the platforms to make the client and server sync up nicely.

    Here's a version of my .capx

    [attachment=0:360nubhk][/attachment:360nubhk]

  • Now that's the hard part, collision means the objects are overlapping, meanwhile you could check relative positions, that presumes that you'll never have any tunneling problems. (This will work if your frame rate is high and your player moves slowly). However, another way to check is by checking the player's velocity at the time of the collision.

    You could just try checking Player.Platform.MoveAngle > 180 (This should make it so that you can only break bricks while moving upwards).