Omnimaga
Calculator Community => TI Calculators => Axe => Topic started 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?
-
For routines, you have Get() and Send(), as for techniques, what do you mean?
-
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:
-
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.
-
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.
-
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)
-
Unless you use a deterministic RNG and seed it at the start :D
-
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
-
Thats for sure O.O Axiom Time! :P
-
ok, thanks guys.
-
or just send the random number after it's generated.
-
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
-
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:
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.