RainbowLoki's Forum Posts

  • 12 posts
  • Hello fellow Constructers.

    So, here's the thing.

    I'm not an expert with Construct 2's multiplayer engine, but as far as I understand, it seems to be designed to sync each connected player with a particular instance of a given object - the same for everyone else.

    Perhaps that is not very clear. Let's say that, in Construct 2's multiplayer shooter demo, everyone virtually plays "as" the same object - in the project, the same object is used for every player to control, only a different instance each.

    But here's the thing ; I'd like to make a game where I need only two players, but they play two very different roles - preferrably, different objects, too.

    I know I could still make it work with the same object by differenciating animations and events regarding the 'peer' or 'host' nature of the player this instance is synced too, but that would be an hassle. Is there not a quicker, more convenient way of doing this ?

    Thank you for your time. You're the best.

  • Welp, is this a help forum or... ? I'm starting to think it was useless to wait.

  • Please, can anyone help ?

  • Greetings.

    First off, I do know there is a tutorial on the subject, but it seems a little too much complicated for me. I haven't made much with Construct 2 for now, so I am a beginner and I have trouble messing around with the multiplayer object and especially with the sync action.

    I understood how the action was meant to work. The host's version of the position of an object must be the original one, meaning the host must send the position of their game to all other peers. I also understood that peers were meant to send their inputs to the host so the host could make in their game what actions the peer intented to do - move, attack, etc. But there is the thing - I just don't get it how this is meant to work. Even after looking at the example project again and again and trying to figure out how it works. My aim is the following :

    • In the game I created, there is a title screen which only goes to the actual layout if both the host and the unique peer (it is meant to have only two players for now) have checked a... check box indeed. For this part, it works. Basically, the way it works is that when the peer checks their check box, it sends a message with a specific tag to the host (the value is unused). If they uncheck it it sends another message, which when it will be received by the host will change back the value of a global variable to 0 (it changes to 1 when receiving the message that is evidence the peer checked their "Ready" check box).
    • If the host has their check box checked while the global variable which indicates if the peer has their check box checked or unchecked is equal to 1, both of them go to the layout. I made it simply : Host sends a message which, upon receiving, will cause the peer to go themselves to the layout, while the host will go to the layout directly after sending to the peer their message. Basically, they get on the layout at nearly the same time.

    For now this method works, at least for two players. Now we are about to reach the part that annoys me. Let me explain what this is meant to do, and what this actually does.

    • When the peer starts the layout, they will send the host a message containing their peer ID. Once receiving the message, the host will create an instance of the object I named "Peer", which is basically a character. The host will then store the ID of the peer in a proper instance variable on the character, using the value of the last message that was sent to the host - which normally, contains the ID of the peer that sent it.
    • It then associates the "Peer" object that was created with the ID that was contained in the message, using the same method again to pick the value. The object "Peer" should now be properly linked to its actual player and has their ID stored in an instance variable.
    • It then changes the instance variable "color" to 1. This does not matter here. It is just made so the "Peer" object has a different color than the host's. Here I haven't made one yet for the host but it doesn't matter for now because I already met problems...
    • And then it finally syncs the "Peer" linked with the player over the network. So this is what I'd like to see :
    • The "Peer" object being visible on both the host's and peer's games.

    What I actually get to see :

    • The "Peer" object is indeed created on the host game, but I have no clue if it is indeed linked to its peer. Furthermore it does not appear to exist at all on the peer's game, even though I synced it over the network ! Why ?

    So this is the problem I encounter. I will leave the .capx in case anyone would be kind enough to help me understand what's wrong.

    Thanks a lot.

    Hoping for an answer.

    dropbox.com/s/wxty6lf02n6b4y4/Multiplayer_Test.capx

  • Or I just maybe got another idea. Maybe I can spawn an invisible decoy with the platform behaviour that the player will automatically get on top of every tick or soever, allowing the object to fake genuine gravity. Once the player loses the frozen status, the decoy would be destroyed.

    Oh, by the way... There is just another thing that I would need to be helped on. Y'see, I have a container that contains two objects : A tiled background that looks like a thin wooden log, and a sprite that is a spiky "head" of the log. I would like the tiled background part to automatically extend and lower size to fit perfectly with the head, that will move. Does anyone have an idea how to make this simple ? Imagine a Sine behaviour for the head, that would go up and down, but do not recommend me to use Sine size for the tiled background because it's here just an example.

  • This indeed is a platformer. I haven't tried this solution yet, but I will try as soon as I'll need a frozen status. Great thanks. The only thing that's too bad is that the timed events won't get back where they were stopped when the group will recover activity, but that doesn't really matter, does it ? For now, I don't really need it, and anyway I don't think there's a real way to do it.

  • Okay, thank you, then it would work for a Time Stopper, but do you know if I can stop all events and timers currently in use like I can with Time Scale but still let the object be affected by gravity ? I think there is a way. You know what I want to do : A freeze effect, that would stop all events of the player currently triggered but do not prevent them from falling. Is it possible ?

  • Howdy. I appreciate your reply, but sadly, this won't help me.

    It if was that simple, I would probably have not asked about this. I indeed thought off of this solution, but as I told earlier, given how events work, it wouldn't work.

    Say, imagine it as a Time Stop rather than an ice attack. I would need the player to completely stop from moving, stop their animation, and lose any control above their character. It is easy to disable controls, however the problem I have is that I need the event to totally stop.

    Your solution would work if the event haven't been triggered yet, but imagine a timed event. For example, something like that :

    When F is pressed

    [X] Triggered is set

    • > Set Triggered to true

    Wait 0.5 second

    Spawn "PlayerBullet" from Player

    Set Triggered to false

    Just forget what this event does, that's not the matter. The thing is that, as you can see, I have triggered the "Triggered" boolean as soon as the event started, in order for the event not to trigger itself multiple times. This is kind of hard to explain if you do not understand how events work.

    To make it simple, events are triggered multiples times in a second (every tick, I suppose) as long as the conditions are met. If the conditions are no longer met, for this example if the player gets frozen before the bullet was released, the event will still continue itself until its end. What I am looking for is how to stop an already triggered event. In other words, how to make an event that, during execution, will instantly stop if one of the conditions are no longer met, or if another variable changes or whatever, you got what I mean. And I don't know how to do this.

    To get back to my example, if I followed your idea, the bullet would've been released even if the player was frozen between keyboard input and actual release of the bullet.

  • Hello there.

    In order to make ice-based or time-based enemies that freeze the player when they get hit, I would like to completely freeze not the whole game but ONLY a specific object, here the player.

    The issue is that once the conditions for a event are met and the event triggered, the event cannot stop and restart where it was left if a condition is no longer true. Otherwise said, I would like all actions of a specific object to completely stop and then, when ice gets off, get back right where the events were left. And I really have no idea how to do this. I've been thinking at loops but it doesn't seem to be what I'm looking for. I even doubt this is possible. I've been searching a bit but no one has asked this before, so I'm doing it myself : How could I stop a single object and not the entire layout ?

  • Again, thank you, but - hey I'm sorry for this - I'm still in trouble... simply because, I don't actually really get how For each works.

    Actually...

    The thing I'm wondering the most about is that my two other enemies, the Jumper and the Toothmate (great names uh ? ), do not got me with such a problem. To get their behaviour fast, once Jumper has been discovered on screen it simply jumps on regular times, and the Toothmate simply walks left then after a short amount of time walks right and repeats the process.

    When I say I didn't have such trouble, I mean by that that, as it should be the case for the Crasher, the enemy that's getting me crazy, each instance of 'em acts individually. For example, the Jumper. It also uses Instance Variables that are mostly made to make the waiting time between its jumps regular. And that works ! They do not all jump strictly at the same time, because this actually depends on the time they first appeared on-screen (they do not move until they're seen by the player).

    However, the Crasher gets me into trouble. What I would like to happen :

    • The actions that are triggered by the player being closed to a crasher should ONLY be triggered on the Crasher the player's close to. Furthermore, it should act separately from the others - which isn't the case, strangely.

    What happens :

    • Only the instance that I put first in the layout, i.e Crasher #0 in Debug Mode, works well. The others seem to be nothing but kind of decoys. They do not move, except that they jump at the same time at the working one and sometimes also shoot (this is not random, but it seems they shoot only one Crash Bomb before completely stopping). They do harm me with contact damage as the working one, and their Health Instance Variable do lower when I attack them, indeed destroying them when their health reaches 0, but they do not shoot, only does the #0. If you can explain me more precisely how I should use "For Each", I would be SO thankful of you.

    By the way, I am really sorry that I get in trouble that much...

  • Thanks a lot, seems to work well ! But I actually have another problem... when I put two instances of this enemy in the same room, only one of them works, even if I used only instance variables. I don't understand !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello there, fellow makers !

    I am currently working on an enemy whose actions would be something like these :

    • By default, stays on the ground without doing anything. "Platform" behaviour, though it isn't controlled by the player (I disabled "default controls").
    • If the enemy is currently on-screen and that the player gets close enough (which I don't know how to do), the enemy jumps then, right before it falls down, shoots a bullet-like projectile, not directly towards the player because it is not a boss, but on a 135 ° or 270 ° degrees angle depending on if the player is higher or lower than the enemy. It's on purpose that this method is quite unprecise, because it must stay an easy enemy. But that's not all. I would also like the enemy to mirror itself and all its actions (which I know how to do) whenever it detects the player gets at its right (for example, if the player attempts to skip the enemy), so it continues to try to bother the player instead of just shooting on the side the player already left.

    So here it is. There are three things I don't know how to do. First, detect when the player is close enough from the enemy. I kinda remember an action that would work for this purpose, but I'm not sure. Let's say when the player is closer than 250 pixels or something like that (my enemy sprite is 32x32 sized). The things that's important with that is that you must NOT imagine a circle of detection around the enemy, but rather a rectangle, that would cover the whole vertical stage but not horizontal. Otherwise said, I want the enemy to attempt to shoot whether the player is high or low (even if I need to detect this as well), because if it kind of a circle of detection around the enemy, it won't detect the player they are too high (which is bothering me 'cause the character is able to make Super-Jumps that start with 1000 pixels jump strenght instead of 650). And finally, I would like to detect if the player is on the right or on the left of the enemy. I may have an idea for this, like test if the player's X (if that indeed is the horizontal order) is greater or lesser than the enemy's, alongside with Y for up or down.

    To make this short :

    • I would like the enemy to detect if the player is close enough before attacking
    • I would like the enemy to mirror its actions if the player gets on its right
    • And I'd also like the enemy to shoot up if the player is higher than it and down if the player is lower.

    Hope someone nice will be able to give me an answer, I'm kinda stuck with this !

    Thank you all. You rock

  • 12 posts