Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: LincolnB on December 01, 2011, 10:26:29 am

Title: Multiplayer Link-Port Gameplay [Question]
Post by: LincolnB on December 01, 2011, 10:26:29 am
An Axe question: For Base 671 (among many other project ideas) I'm really wanting to get into implementing multiplayer support through the link port. What techniques and routines are out there for link-play?
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: Builderboy on December 01, 2011, 07:21:38 pm
For routines, you have Get() and Send(), as for techniques, what do you mean?
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: LincolnB on December 01, 2011, 10:48:00 pm
like, how would I go about implementing a system where you're playing a multiplayer calc game through the link port, and the gameplay is just like a regular platform game like Stick Ninja (meaning, 8*8) or something, but there's two characters, and you see your character, and the guy on the other end sees his?

I haven't really had the chance to experiment with the link port cause I don't have a link chord :P but I'm getting one for christmas, but at this point I'm just wondering what's out there, if there's much at all D:
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: C0deH4cker on December 01, 2011, 11:23:50 pm
Youre gonna have to do it all yourself. One thing you can do is once per frame, synchronize the variables between the calcs.

The first byte sent should be a length of transmission. Then, send the data byte by byte (remember, variables are 2 bytes) until all has been sent and received/parsed, then have the calcs stop sending/listening once the previously set length of bytes have been sent.


Quick example:

24->X
6787->Y
Send(4)
Send({°X})
Send({°X+1})
Send({°Y})
Send({°Y+1})



Thats for the sending (duh). You can implement the other end of it.
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: Builderboy on December 01, 2011, 11:28:31 pm
Another method of doing link play is to only send your own keypresses.  So each calculator will be receiving input both from their own user, and key input from the other user from the linkport.  As long as both games treat the input in exactly the same way, both games will be carried out in the same fashion.
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: calc84maniac on December 02, 2011, 12:20:34 am
Another method of doing link play is to only send your own keypresses.  So each calculator will be receiving input both from their own user, and key input from the other user from the linkport.  As long as both games treat the input in exactly the same way, both games will be carried out in the same fashion.
Yep, you just have to make sure not to use random numbers (at least not in ways that affect the gameplay; it would probably be fine for graphical effects though)
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: Builderboy on December 02, 2011, 12:56:58 am
Unless you use a deterministic RNG and seed it at the start :D
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: calc84maniac on December 02, 2011, 12:59:49 am
Unless you use a deterministic RNG and seed it at the start :D
True. But Axe's built-in RNG definitely isn't deterministic :P
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: Builderboy on December 02, 2011, 01:17:30 am
Thats for sure O.O  Axiom Time! :P
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: LincolnB on December 02, 2011, 05:16:09 pm
ok, thanks guys.
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: C0deH4cker on December 02, 2011, 05:57:33 pm
or just send the random number after it's generated.
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: Happybobjr on December 02, 2011, 07:59:51 pm
make sure if you are only doing keypresses to do things like this in your code.

If getkey(4)
If Send(4,60000)
do blank that is affected by 4
end
end
Title: Re: Multiplayer Link-Port Gameplay [Question]
Post by: Quigibo on December 02, 2011, 11:02:15 pm
I'm going to quote myself from another topic about this recently because I think this is the fastest and easiest technique to create multiplayer games:

Quote from: quigibo
Like I always say, linking is easy, but syncing is hard.  Puyo Puyo runs fast because it only needs to send data when a particular "event" occurs (combos).  Event driven programming style is a little different than what you're used to but basically you put the Get() in your main loop so its always ready to receive an event.  Don't forget, Get() doesn't delay or wait unless the other calc is sending something.

You send data by first sending an enumerated event type (1 bytes) followed by the event data (which may be different length depending on the event).  For instance you might need to send a character's position.  This can be done by sending a "X change" event followed by the x coordinate whenever that coordinate changes and a "Y change" event followed by a y coordinate.  The actual transfer speed is about 500 bytes per second maybe.  If your main loop is running at 30fps and don't mind reducing to 20fps that's about 8 bytes per frame of data you can send which is probably enough for a decent subsets of multiplayer games.