A "kind of" multiplayer game idea.

This forum is currently in read-only mode.
0 favourites
From the Asset Store
The official Scirra Multiplayer Signalling Server for helping peers find and connect to each other
  • This is my first post so here it goes..

    My idea of simple and easy multiplayer game is sharing a file containing player position:

    1�- we share a folder named positions through a lan network or vpn.

    2�- we make 2 similar games, player1 and player2. both have player 1 box and player2 box.

    3�- both games have 2 editboxes, one to write and one read.

    4�- every 1000 milliseconds player1 game writes player1 position to a hashtable using keys posxp1 and posyp1 and then saves a file named p1.lol to a local network address that has been written in the write editbox.

    5�- every 1000 milliseconds player2 game writes player2 position to a hashtable using keys posxp2 and posyp2 and then saves a file named p2.lol to a local network address that has been written in the write editbox.

    6�- every 1000 milliseconds player1 game reads player2 position file p2.lol from the read editbox address to a hashtable using keys posxp2 and posyp2 from the shared folder.

    7�- every 1000 milliseconds player2 game reads player1 position file p1.lol from the read editbox address to a hashtable using keys posxp1 and posyp1 from the shared folder.

    8�- every 1000 milliseconds player 1 game sets player2 position x and y to the values of the hashtable p2.lol

    9�- every 1000 milliseconds player 2 game sets player1 position x and y to the values of the hashtable p1.lol

    10� on the player1 game you only control player1 box.

    11� on the player2 game you only control player2 box.

    p1.lol = (102 bytes)

    p2.lol = (102 bytes)

    here is an example video:

    http://www.youtube.com/watch?v=jkYo5vKsm5U[/code:24gr0vn7]
  • Welcome to the forum!

    Very wild and interesting idea to share files for positions. It isn't really practical (the lag is abysmal, but you could always lower the check time to every game tick) though as you begin to add more and more objects this will become unwieldy quick.

    Still very cool first post. Looking forward to seeing your next demo.

  • Welcome to the forum!

    Very wild and interesting idea to share files for positions. It isn't really practical (the lag is abysmal, but you could always lower the check time to every game tick) though as you begin to add more and more objects this will become unwieldy quick.

    Still very cool first post. Looking forward to seeing your next demo.

    Thanks for the feedback and sorry for not introducing me in some way.

    Yes it has a lot of lag, i think its more suitable for board games like chess or card based games.

    I did this because i wanted to make a game like stranded II but with multiplayer (at least 2 players).

    Checking every tick should be better than 1 sec of interval.

  • scidave youre the man!! look the video. now with every tick instead of 1000 milliseconds. it's instant. but im doing it in the same computer. so it should have some 10 ms of lag between 2 LAN pc's.

    http://www.youtube.com/watch?v=_nCog43WN9A[/code:1wc8ygu8]
  • could this work with files shared over dropbox or box.net?

  • This isn't a good way to design a multiplayer game! You shouldn't use files on disk (you're moving the mechanical drive head when you could be reading directly from memory), and using files or HTTP is the wrong protocol. These systems are designed for one-off transmissions: open connection, transmit data, close connection. You're introducing a huge amount of open-close overhead for every single message. Also, these protocols are designed for file transmission, where latency really isn't a big deal. They are only concerned with eventually getting the data there, rather than working in real-time. There's also no message ordering so you can get your data reordered in transmission and your players start jumping all over the place. The right way really is to open a socket connection and stream data. That solves all these problems, and was designed for such purposes.

  • i understand. i would have only been using it for turn-based stuff, where speed is not important, nothing real-time.

    as for the 'sockets', i'm sure they work great, i just don't know how to use them...lol.

    but from what tom has been illuminating to, this 'could' become part of c2...natively.

    ...so there's that.

  • could this work with files shared over dropbox or box.net?

    maybe, i tried an ftp but it took too long.

  • This isn't a good way to design a multiplayer game! You shouldn't use files on disk (you're moving the mechanical drive head when you could be reading directly from memory), and using files or HTTP is the wrong protocol. These systems are designed for one-off transmissions: open connection, transmit data, close connection. You're introducing a huge amount of open-close overhead for every single message. Also, these protocols are designed for file transmission, where latency really isn't a big deal. They are only concerned with eventually getting the data there, rather than working in real-time. There's also no message ordering so you can get your data reordered in transmission and your players start jumping all over the place. The right way really is to open a socket connection and stream data. That solves all these problems, and was designed for such purposes.

    you're right, but aren't browser games working like that, like writing sql or txt on a server hard drive?

    I'm no coder, i only had vb6 in school and that was 5 years from now. Is there a topic/tutorial showing how to send players position, health, ammo with that socket connection? not that podsix network, just something simpler.

    edit:

    I was thinking, what if we play the game using a ramdisk? no moving parts, pretty fast, no damage to drive. does the write/read trough a network takes a lot of time? I think my ram works at 32 gb per sec and should be fast enough. And my network is 1gigabit lan, so its 100megabytes per second, my example is sending 100bytes every tick, only for player position

    Im working on another example now.

    This is a noob way of making multiplayer until construct comes with a plugin.

  • Sorry, I guess my other post was a bit critical for someone without much coding experience. It's cool that you're thinking through ideas like this, but there are still a few problems:

    • you can't assume all your players have a ramdisk (or SSD) - the reality is most people have traditional hard drives
    • writing files is probably quite slow, again because it's not designed for latency - complex games might take a framerate hit
    • the overhead of writing files is still large, so although your simple case works, you might find you can't add many players or much more data in transmission before it bottlenecks. It's not so much the maximum data rate as the latency that is the problem (i.e. how long it takes the message to arrive, rather than how much data the message holds).

    I think R0J0 did some python tutorials on how to use sockets? You might be able to search the forum for that. Also, you could try reading up on websockets - that's what modern browser games use for multiplayer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:ebbu2cwk]I think R0J0 did some python tutorials on how to use sockets?

    Not me, it was scidave.

    Here's the link:

    http://www.scirra.com/forum/viewtopic.php?f=8&t=6299&hilit=multiplayer+python

  • Oops, sorry, got mixed up

  • Sorry, I guess my other post was a bit critical for someone without much coding experience. It's cool that you're thinking through ideas like this, but there are still a few problems:

    - you can't assume all your players have a ramdisk (or SSD) - the reality is most people have traditional hard drives

    - writing files is probably quite slow, again because it's not designed for latency - complex games might take a framerate hit

    - the overhead of writing files is still large, so although your simple case works, you might find you can't add many players or much more data in transmission before it bottlenecks. It's not so much the maximum data rate as the latency that is the problem (i.e. how long it takes the message to arrive, rather than how much data the message holds).

    I think R0J0 did some python tutorials on how to use sockets? You might be able to search the forum for that. Also, you could try reading up on websockets - that's what modern browser games use for multiplayer.

    No problem Ashley, i was talking of a ram disk working in free software like this one:

    http://www.mydigitallife.info/2007/05/27/free-ramdisk-for-windows-vista-xp-2000-and-2003-server/

    I guess you're right about this and websockets should work best for a start.

    Thanks for the info, i'm going to do some research then.

  • Oops, sorry, got mixed up

  • [quote:zj1s16us]I think R0J0 did some python tutorials on how to use sockets?

    Not me, it was scidave.

    Here's the link:

    http://www.scirra.com/forum/viewtopic.php?f=8&t=6299&hilit=multiplayer+python

    thanks for the link.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)