Toribash
Original Post
[WIP/REL] reSpar.lua
reSpar is primarily intended to aid continuity in long multiplayer sparing games. It's two basic functions are:


UPDATE 21/04/14: Added some graphical interfacing for the ease of your eyes in your face. After starting the script, right click the Joint State panel to view the load directory and options. Note: reSpar can now also be used as a slightly clearer replay loader.

After loading the script.




After right clicking the panel (or pressing F1)



The top panel shows your /replay directory. the bottom one displays the content of the highlighted replay file (I'll eventually get round to parsig that in to something more user friendly). Highlighting a different replay file is done by scrolling, arrow keys or '+' and '-'. Press Load Replay to load the file as a regular replay. Replay Moves to run the game one move at a time (holding SHIFT when pressing Replay Moves will swap Uke for Tori and Tori for Uke). Safe Save for constant live game saving. And Unload Script for... well you'll guess.


Older details, but still useful information:



1. More robust game saving

How many times has it happened that you're deep into a great multiplayer sparring game, only to have your partner ping and disconnect from the game? All that time wasted and not even a replay file to show for it... Unless you pressed 'f' and save the game every turn.
reSpar does this automatically. Before you start an important sparring game, use the command

"/safesave [OPTIONS FILENAME]"

This will ensure that every turn the replay will be updated and saved in the replay/ folder. if you don't give a filename the game will be saved as SafeSave.rpl

2. Recreating a saved mp game

Now what if you and you partner wanted pick up that game from where you left off. With:

"/replaymoves [FILENAME]" you can do just that. It will load the moves of the saved game and control your tori for you up until where the game was saved.

Details:

Run the /safesave command before you start the game you want to save. Once started, it will keep going until the current game has ended or a new game has started (in case of sudden disconnect).

Since you cant control your partner, both of you will need reSpar.lua and the to be loaded replay on your respective computers.
For now reSpar doesn't check whether the game whose move your loading has the same settings as game you're loading them into. Make sure they're compatible (and identical if you want continuity).
When ready, start a new game with your partner, both type in "/replaymoves [FILENAME]". On your screen you'll see a bar with a two sets of two sequence of letters, one above the other. Red for the tori position, blue for the uke. These are just joint (and grip) states. If the top and bottom are the same colour then your tori is making the exact same move as it did in the saved game. If you're both ready, press space for the next turn. Keep doing so until you want to pick up control.

Note: the joint state sequence is in a different format than usual.
f,b,h,r are still the same (forward (Mousewheel Up), back (Mousewheel Down), hold, relax) but it's ordered from neck to abs, right arm (right peck to right wrists & grip state ), left arm, right leg (right butt to right ankle), left leg.

Additional uses:
Yes: reSpar can be used as an extended MoveMemory.
Yes: reSpar can be used to help two colluding player rig a (decap) game by doing a "here's one we prepared earlier". God help you though, son, if you think it's a good idea.
Not really: You cannot perfectly recreate single player games in multiplayer or vice versa. Apparently the engine, ever so slightly, handles the two differently.

Let me know what you think.And if you enjoy this script, or any of my previous one, please, feel free to make a small TC donation. Thank You.

respar.lua (11.2 KB, 64 views)
Attached Files
respar.lua (22.9 KB, 1477 views)
Last edited by Daanando; Apr 21, 2014 at 11:15 AM.
Originally Posted by box View Post
It'd be nice to specify a frame number for the recreation to go through.

Excellent idea, excellent implementation.

(Thanks, Box, that's means a lot coming from you (I've read everything you've wrote on lua scripting)

For now, the script is just a bare bones proof of concept (I'm deathly afraid that maybe mp games cant be recreated in a new, but exactly the same, mp server by the moves alone) If the basic principle works, then I look forward to tackling yours and anyone else's .suggestions.
This is absolutely genius.
You have just solved the biggest problem of the current sparring scene.
Truly, truly ground-breaking.

I'll test this as soon as possible and add it to my Legends thread.
Congratulations on this feat, and thank you.
We're still kids in buses longing to be free.
I've been on the devs necks to implement something like this! Amazing that you were able to do it with lua!
Basically opens up lots of possibilities, and makes it easier for casual players to create spars!
Will test it soon.
Your messed up world enthrills me
Initial tests:
bugs:
- if grab is on, it keeps double grabbing after each turn: it's fixed if you have grab off so np
-chat log is affected someway, sometimes i'm sending messages...and they're not getting through.
- sometimes replaymoves isn't loading for one of the players, kinda weird.
notes:
-safesave works smoothly
-safesave even works if you /safesave midway..you get the whole replay..awesome.
-replaymoves works great: toris move exactly the same
-----
Originally Posted by box View Post
It'd be nice to specify a frame number for the recreation to go through.

Excellent idea, excellent implementation.

You can space until the desired frame. Then, unload the script.
Last edited by William; Apr 8, 2014 at 02:58 PM. Reason: <24 hour edit/bump
Your messed up world enthrills me
Originally Posted by SparChar View Post
Daanando, did you just make it so that it saves just like you normally would if you press F midgame? Awesome.

Hey,, nobody said I had to reinvent each individual component of the wheel too. ;)

Btw, William that's probably why the chat is a bit stingy, I tried to stem the tide of "SafeSave.rpl has been saved to tthe /replay/.. folder". To go back to full unadulterated system messages, change this line:

add_hook("console","cleanup", console)

at the bottom of the script to:

--add_hook("console","cleanup", console)

I took a look to fix the double grip stuff, and each seemingly easy fix furthers unravels my script like a cheap sweater. It's doing my head in. I'll get back on it, and the suggestions of other soon.

Also, thanks for the enthusiastic praise, guys. Keeps me fired up.
-----
Originally Posted by SparChar View Post
Daanando, did you just make it so that it saves just like you normally would if you press F midgame? Awesome.

Originally Posted by RoBotN1nja View Post
I found out by trying this with running that it does not work

I feared that was a possibillity. But to make sure: your test was strictly a saved multiplayer game to multiiplayer, right? Toribash calculates things every so slightly differently between single player and multiplayer.
Last edited by Daanando; Apr 9, 2014 at 03:34 AM. Reason: <24 hour edit/bump
Originally Posted by RoBotN1nja View Post
Daanando I mean it wont like work for parkours

And I'm asking if the game of Parkour that you played was amultiplayer that you discontinued and then tried to pick up again, in multiplayer.

Spoiler

Last edited by Daanando; Apr 10, 2014 at 06:13 AM.
Originally Posted by RoBotN1nja View Post
Yea i tried but it would fail with the running aspect like when the start up but will be but then it will fail

I tried recreating a spar, and it worked precisely. The mod was xspar.tbm. So you're probably doing something wrong.
Your messed up world enthrills me
Minor Fixes
Updated reSpar.lua script:

Fixed:

Grips should load correctly now.

Now using the command "/replaymoves [RPL FILE]" in single player, or if you're a room operator, will automatically load the pertinent mod.

Edit: newer version has been updated.
Last edited by Daanando; Apr 21, 2014 at 09:42 AM.