Everade's Forum Posts

  • 99Instances2Go

    Yea i guess i understood how seeds work (at least the basics)

    But let's say Peer has some short connection issues while shooting, or simply something went wrong while sending the player input data to the Host.

    Now the Peer will display 10 shots.

    But the Host only triggered / recieved / noticed 9 shots.

    This means that the entire seed sequence will be off by 1 for the Peer for the rest of the game.

    Which means all the following shots will be displayed wrong.

    I think the chances that this happens is pretty big, considering a fast-paced shooter with multiple players shooting with "realistic" automatic weapons and whatnot. (thousands and thousands of projectiles)

    And this is all running through a Peer to Peer connection with normal PCs and normal Internet connections. (not a perfect world)

    That's why i'm saying:

    To prevent that, maybe it could be possible to re-sync the current state of the seed every 30 seconds~2 minutes or something like that.

    (If that's possible, since i've never worked with it?!)

    newt

    Collisions will be handled host-side only.

    Displaying projectiles can be just aesthetics, but i want them to be as accurate as possible.

    Why? Because as a player i want to see when i hit something.

    Anything else is garbage.

    As i've said before, it does not have to be 100% accurate, so it's fine when there are some discrepancies.

    But missing and still killing, or hitting and never killing is bullshit if it happens a lot.

    And i want some visual feedback with the projectile flash-line.

    I do not plan to only have a muzzle flash and then wait until the server responses if i've hit something or not.

    And i do not plan to only have a muzzle flash and then show absolutely wrong information just for the sake of being responsive.

    Random number being percent to hit?! I don't get what you mean.

    OddConfection

    Never done that, i will take a look at it if i can find something.

    Including player position as well would require for some host-side position checks, which i guess could get pretty complicated to achieve.

    Thanks again guys!

  • oosyrag

    1. I'm fine with it if it's an illusion. But it shouldn't bee too far off.

    Since my game isn't going to be competitive (player vs players) it's not so important to be 100% accurate.

    But i still want to have some proper visual feedback so in case of weapons which have a really bad accuracy don't shoot into the complete opposite direction, showing a hit but they actualy did not.

    Especially if there are smaller fast moving enemies and you try to hit them.

    I personally think (as a player) if that happens too much, they blame it on *bad hitbox detection* or network issues or whatever.

    The more accurate it is and the more responsive it feels the better for the game and the joy for the players.

    And i also don't want to play a game where my visual feedback is always way off.

    2. Yea really sounds like a nightmare xD

    I'm not sure if this is the best approach. And to prevent too much issues i can imagine that i'm almost forced to send 1 seed per peer, because if they are all shared the possibility that the sequence gets mixed up (delay of shot being triggered due latency)

    So that means 1 seed per peer, and to prevent missmatches over a longer time-frame i guess i would have to re-sync the seeds every 30 seconds ~ 2 minutes.

    Maybe that way it works out, i will for sure take a closer look at this.

    3. I'm actually using realistic real world projectile speeds ~400m/s which is around 266px per tick if running on 60fps with my setting.

    Which means that's absolutely impossible for my case

    Another reason why the official bullet behaviour would never work for me.

    Visualy the players will only see a flash-line similiar to the one showed in the picture i've posted.

    OddConfection

    I see 1 big problem with that.

    Let's say the Peer shoots, and sends the angle to the Host.

    The host recieves the angle but assumes that the player was standing at a different position (due movement of the player while shooting)

    I don't know if that's going to be accurate enough or if that's going to mean that the shots could be registered at entirely wrong positions.

    From host to peer there's the prediction stuff and all that, but what happens if i send this data the other way around?

    Is there a way to *sync* the angle together with the actual mouse click sync so the host recieves both data at the same time?

    Does anyone have experience with this?

    And to your question:

    The host is a player.

    And i know what that means.

    But Construct isn't really made for anything else... is it?

  • OddConfection

    Calculating such important things on the host is pretty much the basics about online games.

    You don't want the peer (player) to tell the host how he shoots.

    If you do that, you can easily cheat by let's say triggering 10k bullets in 1 second into any direction and the host will be like *ok let me kill everyone*

    That's not how you want to build any multiplayer game unless you don't care about cheating.

    All the peer does is sending key strokes, and that's it, anything else is being handled by the host.

    So if you press the "shoot" trigger 10k times in 1 second, the host will still only trigger 1 shot if handled properly.

    In this particular case i could maybe let the peer handle at least the angle, although i guess that could be abused as well but it wouldn't be too bad.

    But handling the distance for instance as well would mean that players can get full control about how far their flamethrower reaches and so on.

    99Instances2Go

    First time hearing about this.

    So that means it's calculated randomly using the fix seed values and i shall sync the seed values between the peers?

    Sounds like in the end i would still have to sync all data so it wouldn't be responsive unless i use the idea mentioned by blackhornet

    blackhornet

    Very interesting idea, i may give it a try.

    Although i guess it could get a little bit complicated since i will have to sync data to each single player objects on his own.

    That means there will be a lot of data which needs to be synced.

    I may take a closer look at this.

    Thanks everyone for your first feedback!

  • If you read the entire topic then you would notice that i have a similiar system already.

    My projectile system is entirely custom and generates a line which stretches over time for proper collision detection with fast-speed projectiles.

    The projectiles are already generated entirely random, however only on the host part.

    The question is now how to handle it within an ONLINE multiplayer environment, to get the same results on HOST and PEER without syncing the data from the HOST to the PEERS since syncing the projectile data would mean that it won't feel responsive for the PEER.

    If i sync the data, that means that you will send your shooting input to the server, the server calculates the projectiles and then sends the information back to the PEERS.

    This takes quite a while especially with higher latency and means that once a PEER (player) presses the shoot button, it will take some time to actually display the shot. To prevent that my goal is to directly display the shot (only display, not doing anything further since the host will detect actual hits later on), but it shall display the actual correct angle and distance the same as the host will calculate it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey there

    I'm looking for a way (basically an algorithm) which is 100% predictable, yet shall free as random as possible.

    Unless you guys have a better way to achieve what i'm looking forward to:

    It's an

    online multiplayer environment.

    Which means it's important that the HOST handles the actual calculation of where and what the players are shooting.

    This means that hit detection all happens on the host side.

    I don't want to sync every single shot with the player, because the delay is way too big, which means it won't feel responsive for the players when shooting. (the other bad part about this is that i have to sync a lot more data)

    I have already a system which sets a specific accuracy depending on your current wielded weapon.

    And as of now, this system works pretty good for a non-online environment by randomly changing the accuracy.

    But what the players are getting displayed is not what's actually happening, so while they might think they've hit an enemy, they might have missed it.

    Here an example with a shotgun with a lot of random projectiles

    (This is a custom projectile system i've created on my own since the bullet behaviour doesn't work for realistic-fast projectiles and fail on the collision part)

    What the Player sees:

    What the Host calculates:

    I want to keep this accuracy system, or at least something similiar. Otherwise it's not going to be fun if every shot hits the exact spot you're aiming for. But i also want to display the bullet direction accordingly to what's actually happening on the host.

    The system calculates random directions and random distance for each projectile.

    My idea now is to have a specific algorithm which will always get the same results, on host and clients without the need to sync the actual bullets all the time. (Basically predictable "randomness")

    Which then runs on each players system and the host. The one on the players side of course will only display the projectiles while the host does the actual hit detection. But the idea is that both, the host and all peers run the same algorithm so they show the same projectile directions while still varying with each shot.

    This might not be 100% reliable since some bits may get lost on the host side (not triggering a shot), so maybe i could sync the current algorithm state every ~30 seconds for each player to correct that.

    How would you handle this? Maybe an entirely different approach?

    And if you think the idea might be somewhat solid, are there any specific algorithms i could use?

    Thanks for reading

  • SnipG

    No that doesn't work within an ONLINE multiplayer environment

    It's actually impossible* using the official solid behaviour.

    *only with ugly workarounds which cause unpredictable/bad bugs

    I will have to use the custom "solid/collision" system from R0J0hound <---- awesome guy

    One of the issues being that if you keep moving against a solid object with Player1 and then Player2 moves through him (below or above)

    It actually affects Player 1 by either pushing him along the line or pushing him entirely through the object because the engine is telling the object to be solid and non-solid at the same time.

    There are also other issues we were fighting with for a very long time.

    But thanks a lot for your input, i appreciate it.

    lennaert

    Take a look at my latest upload, i actually got it to work using the custom solid system by R0J0hound!

    It gives you full freedom to prevent collision with specific objects under certain conditions.

    But the collisions are extremly bumpy sometimes.

    Just one post above yours he answered with another example which i'm willing to test within the next few days.

    I hope that one gets the job done with smooth collisions. The example looks slick.

    Yet this means that i will have to get a custom pathfinding system as well since the solid behaviour is an absolute goner now *Yea suck it SOLID*

    Feels like a revolt since Scirra never implemented it and we still have to wait for the new C3 engine after the release of C3. xD

    oosyrag

    Thanks yet again for the pathfinding example.

    But i have no plans on using tilemaps, i want the players and AI to be able to move with absolute freedom.

    It might take some time but i hope i can get this managed to create a snappy/intelligent enemy AI with smooth movements.

    Thanks everyone for the help!

    You guys are amazing

  • Oh boy, i'm anything else than an expert ^^

    For now i'm just happy that this actualy works.

    But i need to get this polished, since it seems that it's only properly working for circle objects.

    I will have to take a closer look at the link you've given me.

  • oosyrag

    I've just done some first tests using this custom collision system.

    During my tests i kept bugging through the wall, so it does not really seem to be reliable in that particular case.

    I'm also bouncing back and forth a lot.

    And the player sprite also seems to move a little bit further than the actual coliding "Peer" if you keep moving towards an object "without bouncing back"

    On the other hand i doubt that this custom solids is going to work with the pathfinder behaviour either.

    Which means this would lead to an even much more complicated approach since i will have to code my own pathfinding system as well.

    But thank you so much! It works already within a multiplayer environment using multiple floors!

    I hope there are ways to further improve this custom solid system since the collision detection is not really as smooth as in the example.

    Maybe because that one was made for circles ?

    I'm not sure if this code is able to support all different kinds of shapes.

    Here's the latest example capx:

    (link removed)

  • Thank you very much for the detailed analysis of my issue.

    I took a closer look at the example given by R0J0hound

    It looks much simpler than i thought.

    This basically means that i would have to create this system for each of my players, enemies and anything else that can move and collide.

  • Those are just details i'm currently not bothering about.

    The problem is collisions within an online multiplayer environment when using multiple floors.

    <-------------

    PlayerA on floor 1 should not collide with objects from floor 0.

    PlayerB on floor 0 should not collide with objects from floor 1.

    ------------->

  • I've created an example capx for those who're interested into taking a closer look at it.

    It uses the following plugins:

    rex_zSorter

    rex_layer

    In this particular case the enable and disable solid is even entirely broken and i can not explain why.

    I worked on older Construct 2 versions from what i can remember.

    Replacing the "Set solid Enabled / Disabled" (inside the Common Mechanics/ Solid Picking part) works just fine.

    So i was able to simply move the objects instead for example.

    Maybe it's just a smaller mistake i've created while testing all the time.

    By walking over the red box you are being considered to be standing on floor 0 (ground)

    By walking over the green box you are being considered to be standing on floor 1

  • SnipG

    Thanks for the tip, i've watched the video but i've no idea how that's supposed to help me.

    I'm not a coder, that's why i'm here using Construct. ^^

    So i won't be able to code my own push out behaviour.

    The only thing i'm aware of is Rex's PushOut behaviour but that one relies on the official solid behaviour as well, which is the main issue here.

    As long as solids are being globally handled i'm kinda lost.

    If i would be able to code i would have created my own custom solid behaviour a long time ago (or something similiar).

    lennaert

    Were you ever able to get this to work?

    From what i can remember your last version of the tank game used push out as soon as you've overlapped a non-solid object while at the same time activating the solid to prevent the player to walk through.

    As long as the player was constantly touching the solid, other players were also coliding.

    Somehow you got a workaround for that but there was a bug that as soon as the 2 players touched each other, the player who's supposed to be pushed back fell through.

    Nethertheless there were always some kind of bugs which you also weren't able to fix.

    Or were you actually able to get it to work in the end?

  • >

    > (...)

    > Please finally consider the fact that multiplayer is a must have for every game creator.

    > (...)

    >

    No

    With "creator" i mean game creating software such as construct and not a dev.

    So yes it is.

    There are people who want to create more than just iphone single-player games using construct 2/3.

    And even those can become much more enjoyable by adding an online multiplayer layer on top.

  • Yea you can not avoid that.

    It's impossible to avoid that, that's why it's important to implement the time-rewind system.

    Here's a rought explanation of the issue you're experiencing:

    https://youtu.be/xyCQtUFOJmA?t=210

    There's also a video where the actual developers from infinity award talk about lag compensation and how they "fixed" it to feel snappy.

    It's pretty interesting because they had an issue exactly connected to what oosyrag said:

    Minute 13 he's talking about the time-rewind

    http://www.gdcvault.com/play/1023220/Fi ... on-Call-of

    It's your ultimate goal that the HOST, calculates at which exact spot the KILLER and the KILLED were standing at the time of the shot happening.

    So the host should basically calculate the positions back in time, trying to re-create the positions to check if the shot actualy hit something.

    And to make the game feel fluent for the players, you create the movement prediction.

    So the player actually moves visualy before he's actualy really moving (on the host).

    Same goes for shooting and so on.

    Ashley

    Although i have to admit that the official multiplayer plugin from scirra comes with precision issues when it comes to movement.

    Of course, it has to do some corrections in case your position is not in sync.

    But it happens all the time!

    So you're always being moved a little back and forth as a client, because it's always resyncing your actual position with the one given from the host (talking about 8-way direction movement here).

    Basically it's a very annoying micro-rubber banding.

    And this already happens while testing locally (host and client on the same machine)!

  • True, sorry — I only meant Towerfall as an example of a 2D game possible in Construct, and then multiplayer added to that.

    I've just not found any examples of the multiplayer, platform, and bullet behaviour working together properly, and have had no luck (despite my efforts) creating one.

    If it's possible, I'd love to see an example. In fact, I wonder if Scirra-grade examples of the many uses of multiplayer would spur interest in the plugin again (a multiplayer R-Type; a multiplayer Mario; a board game; a chat app; etc).

    (EDIT: or if it's not possible, I think it'd be a good idea to put that in the manual, to prevent others from the same fate)

    I think Construct 3 fixed the precision issue already (I'm not 100% sure)

    https://www.scirra.com/blog/203/some-bo ... onstruct-3

    Read the Enhanced acceleration precision part

    And which issue exactly are you talking about ?

    Do you mean that bullets fly through players and did not hit them?

    Construct 3 also enhanced the bullet behaviour to fix exactly that.

    I personally created my own bullet system which works very well within multiplayer environments.

    Instead of moving a small particle, i'm shooting a line which stretches over time.

    My goal was to create realistic bullet speeds, so the lines stretch extremly fast!

    I've even extended the system with penetration, depending on the bullet type being fired.

    So you can easily adjust it for each bullet that it penetrates multiple enemies before it gets destroyed.

    But i guess this should now be possible with Construct 3 new bullet behaviour which according to the blog does not fly through objects anymore because it moved faster than the frames have been updated.

    Please note that you will require lag compensation (rewinding time) if you try to create a real-time shooter or something similiar.

    https://www.scirra.com/tutorials/892/mu ... pts/page-8

    Ashley covered that already in his tutorial.

    And there's a pretty good real-time multiplayer template in the store:

    https://www.scirra.com/store/royalty-fr ... plate-2846

    It's not perfect and some things are a little bit complicated.

    It also has some precision issues when jumping. Which should be fixed in Construct 3 (read above)

    But it's great if you really want to get into it.

    But you can achieve exactly that by reading through ashley's multiplayer tutorials.