Online Multiplayer (for real!)

Discussion in 'General Discussion' started by thestig_46, Feb 5, 2019.

  1. RobertGracie

    RobertGracie
    Expand Collapse

    Joined:
    Oct 15, 2013
    Messages:
    3,619
    Just had to shorten your post down a little but yeah 100% accurate, its the entire physics engine that is the major problem here its the refresh frequency it runs at, I was once told at 60fps in the time of 1 frame which is something like 0.0167 seconds to complete the game has already done like 30 physics calculations already thats just how fast it refreshes
     
  2. _dutatt

    _dutatt
    Expand Collapse

    Joined:
    Mar 12, 2016
    Messages:
    25
    Would it be possible to stream only the model and deformed data through a server to multiple hosts? The hosts have only their own J-beam and model to worry about, the data of their own jbeam and model is sent to a server, where the jbeam and model data is put together between multiple hosts into one game. The model that shows the deformation could be sent back from the server to each host. I don't have a lot of knowledge of this game or servers in general but isn't this how most game servers are run?
     
  3. atv_123

    atv_123
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,260
    While written down that idea might sound good, in practice, it would be much easier to send the entire JBeam back and forth as that would require much less data then sending the entire model.

    Most games just send a couple coordinates and then let the computer on the other end figure out the rest. Both computers (should) have all the necessary content to display all the proper models, sounds, and effects of a second vehicle... the only thing they need is to know where exactly that model should be displayed. So once the coordinates are sent through the network from one computer to the other, they are then placed in their proper spots by each of the computers.

    BeamNG Multiplayer would work in a similar manner, except you would be transmitting the positions of nodes rather than the positions of a single entire vehicle.
     
    • Informative Informative x 1
  4. _dutatt

    _dutatt
    Expand Collapse

    Joined:
    Mar 12, 2016
    Messages:
    25
    Hm I see, i think I can kinda understand now why it would such would be unrealistic with current day common PC specs and video gaming standards
     
  5. RobertGracie

    RobertGracie
    Expand Collapse

    Joined:
    Oct 15, 2013
    Messages:
    3,619
    Online Multiplayer isnt something I see happening anytime soon its just not possible think of a truck thats gotta be about 8000 nodes you have to transmit every second or so and you would need a high speed connection and many other things to make it even possible across a network

    off topic sorry!

    The one thing I have learned over the years on this forum is trust what Nadeox1, atv_123, sixsixsevenseven and a few other members say, they are usually correct!
     
  6. atv_123

    atv_123
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,260
    Yeah... soon probably not... granted this game has been in development for about 8 years now, so perhaps in a few more years, the standard internet speeds might be up to snuff to let something like this happen.

    While one vehicle isn't 8000 nodes, it doesn't take too many to get there... and with how many bits of data that would need to be transferred for it to properly work... its very easy to see just how much data we are talking about here.

    The best way would be to use the current data stream compression that the replay system uses... they seem to think they can compress it even further than they have it now... granted I have no idea how small it already is.

    That being said though... with current technology I can't see it working properly unless there is some sort of interpolation algorithm in place... and a damn good one at that.

    If you have ever been playing a game like Forza and seen a vehicle with a bad connection, you will probably be familiar with seeing a car float off into the sky or do all sorts of weird things that you KNOW its not doing on the other end.

    (go to 8:10 to see something similar)


    Essentially what is going on there is the vehicle in question is receiving minimal amounts of data from the other computer... so the game is just guessing where the vehicle is heading next based only on the last data that it received so that the game can continue to run at full speed (his car included) despite the fact that you are receiving nowhere near enough data to actually know where that car is all the time.

    To fill in the gaps, the game incorporates an interpolation algorithm that basically will try and predict the next most likely direction the vehicle will be moving in until the game finally gets an update on where that vehicle really is. In older games, they weren't capable of storing as much previous location data, which meant that the vehicles could end up getting way out of location if the last movement might have been slightly upwards just because of a little bump in the road. The computer reads the last two locations it knows, creates a vector, and then just sends the vehicle on its merry way until it gets an update... was that direction correct? Probably not... so is the vehicle in the correct position? Again, probably not.

    This method only really brakes down on VERY bad connections where the update rate may only be once every half second, or worse... but given how many times we have all seen silly glitches like this in games... you come to realize just how finicky internet connections are.

    Anyways... my point is that games that are transmitting very little data still have that much trouble running and still need hefty interpolation algorithms to give a halfway realistic experience....

    Now imagine doing this in Beam... where each vehicle needs roughly the same data transferred as roughly 100 cars in a normal game... Things start to get rough. I can only imagine that there would be enough bandwidth (on most connections) to update a vehicle about once every quarter second, and sure enough, check out how choppy the gameplay is from the multiplayer mod...



    Here there is no interpolation algorithms at play, there is nothing but raw data making the other vehicle move. This is the current speed that we have for updates... granted the devs could do this probably about 10 times better with the replay data stream, but again... that's an update every 0.02 seconds (roughly speaking) while the game itself gets updated every 0.0005 seconds... so a LOT happens in between each update of the multiplayer car... that is the struggle...

    For Beam to really work properly, 1 of two things needs to happen (or both... probably both)

    1. Bandwidth needs to improve by a factor of about 10 for everyone on the planet (or the devs need to find an even better compression algorithm of about 10 for the current data stream... unlikely, but then again... they have been known to work some serious magic)

    2. A monster of a predictive algorithm needs to be developed... and I mean a MONSTER of one. It needs to not only be able to predict where each of the 3 reference nodes are traveling and understand that their distance's should stay relatively locked to one another, but then it also has to predict the rough positions of EVERY node in the vehicle off of those 3 reference nodes. If the vehicle were to come in contact with something, it would have to predict the relative movements of all those nodes roughly or else collisions would just be all sorts of wrong or you would have vehicles just driving through walls.

    Honestly... in my opinion... the best way I can see getting multiplayer to work at this very moment... and just hear me out here.... is to improve, and then use the AI.

    Lets face it.... it's gonna be a rough go of it to actually get the entire JBeam transmitted in real time... THEN on top of that actually get that to play with the physics engine at 2000FPS. However... if we just transmitted the other players actual position (like... where the location of the center reference node is on the vehicle they are using) and then used the AI to attempt to do its darndest to get the vehicle in that position come hell or high water we end up solving a lot of things. Data transmission is no longer an issue as we are just transmitting basically an X, Y, and Z coordinate... perhaps not even that Z coordinate as just where the vehicle is should solve that. Those coordinates are used to create a path for the vehicle to follow, and then the AI just does its best to recreate that path to the best of its abilities as fast as it can.

    Now this is by far... not perfect... obviously...

    BUT... with how many of us are starting to reach into the multivehicle computational territory, this actually starts to become a viable option.

    There are some issues, what if the vehicle start to get too far apart? well... you could connect the player position and the reference node with a tugging beam of sorts to basically "nudge" the vehicle back into position... What if it gets even further off than that? Read the other players vehicle rotation and current velocity vector, and reset their vehicle with that new rotation and velocity.... Then the AI can try again.

    I am just kinda spitballing here... but honestly... this might be something worth while trying especially as seeing since a Modder has gotten litteral multiplayer to work... something like this should actually be relatively simple in retrospect... and honestly, even with its flaws... its still better than nothing...

    Boy did I get a bit carried away there....
     
    #66 atv_123, Mar 9, 2020
    Last edited: Mar 9, 2020
    • Like Like x 2
    • Informative Informative x 1
  7. MetalMilitia623

    MetalMilitia623
    Expand Collapse

    Joined:
    Jun 28, 2014
    Messages:
    232


    As it turns out online is actually modded in. Looks janky as heck but it's there.
     
  8. HIderi

    HIderi
    Expand Collapse

    Joined:
    Feb 11, 2018
    Messages:
    149
    still even if the ping is bad its definitely not perfect
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice