How to Record a Demo

Posted By: Shinobi

How to Record a Demo - 03/21/06 21:35

Hi guys , time to help the Community again .

I wrote a script that shows how you can record and playback a Demo of your Game , this means you record your movements to a Demofile and your able to playback this file. It can be used for your Games to maybe show how to beat a Boss or to show some later Levels .

start the level and run it , use these Keys.

F1 -- Record a Demo
F2 -- Stops Recording or Playing a Demo
F3 -- Playback a Demo

I only store the Pan and the Position of the Player in the File , of Course you can add more if needed , maybe some enemy Positions or Which Level is playing something else. But Notice the File will grow if you add more Numbers to the File.
I got only a 179 kb Demo File in 1 Minute Recording time.

Here is the LINK to the script with a Test Level.

Have fun and let me know if you have questions or Problems with the script.
Posted By: AndrewSwallow

Re: How to Record a Demo - 03/21/06 21:42

Sound interesting, im just to test the test level now

Andrew

edit: yes seems useful, i may use this in the future
Posted By: Matt_Coles

Re: How to Record a Demo - 03/21/06 21:48

This is excellent. Just what I've been looking for.

Thanks,

Matt Coles
Posted By: Lion_Ts

Re: How to Record a Demo - 03/21/06 22:35

Thank you, Shinobi!
Helpfull thing.
Posted By: Damocles

Re: How to Record a Demo - 03/21/06 22:44

nice idea to record a game
Posted By: Matt_Coles

Re: How to Record a Demo - 03/21/06 22:44

Tested the level and it is excellent. I wonder if I could change the script slightly to tape the camera instead of the player

Thanks Again,

Matt Coles
Posted By: Shinobi

Re: How to Record a Demo - 03/21/06 22:53

Thx all , i am glad you like it

Quote:

Tested the level and it is excellent. I wonder if I could change the script slightly to tape the camera instead of the player

Thanks Again,

Matt Coles




Just replace the Player positions with the Camera Positions in the demo_record Function . But it would not work in my example script , because the camera position will be set on players Position.
Posted By: Matt_Coles

Re: How to Record a Demo - 03/22/06 04:13

Thanks for the reply, it's good to hear I can adapt it easily. Thanks Again,

Matt Coles
Posted By: Anonymous

Re: How to Record a Demo - 03/22/06 16:10

Definately sounds interesting... I always wanted to some Tribes-style demos in my game!
Posted By: frazzle

Re: How to Record a Demo - 03/22/06 19:54

Nice recoring device Shinobi
It's very usefull and friendly to use

Nice one
Posted By: ROMAC

Re: How to Record a Demo - 03/22/06 21:11

I've made something like this using a .dll for Action Bird - great to see something not using a dll, but rather simple c-script, this is extremely helpful!
Posted By: GhostwriterDoF

Re: How to Record a Demo - 03/23/06 02:16

This is great! danke Shinobi, lots of other posts asking for something like
this. Mine included
Posted By: Shinobi

Re: How to Record a Demo - 03/23/06 08:56

Quote:

This is great! danke Shinobi, lots of other posts asking for something like
this. Mine included




This is the reason why i made this
Posted By: GhostwriterDoF

Re: How to Record a Demo - 03/24/06 09:53

"This is the reason why i made this "


I guess wishes do come true
Posted By: Shinobi

Re: How to Record a Demo - 03/30/06 08:44

Another thing i forgot to Point out is , you dont have to use while(1);
in your recording and playing functions loop , you dont have to save every tick .
Better for the performance would be 3 or more . Best for me and my slowly Computer is for example wait(3);

function demo_record()

{
if(demo_mode!=0){return;} // if we already recording or playing , end here
demo_mode=1;
counter=0;
start_timer();
filehandle=file_open_write("demo.DEM");
str_cpy(show_info.string,"Recording Demo !!");
while(demo_mode==1)
{
file_var_write(filehandle,player.pan);
file_asc_write(filehandle,13);
file_var_write(filehandle,player.x);
file_asc_write(filehandle,13);
file_var_write(filehandle,player.y);
file_asc_write(filehandle,13);
file_var_write(filehandle,player.z);
file_asc_write(filehandle,13);
file_var_write(filehandle,speed.x);
file_asc_write(filehandle,13);
file_var_write(filehandle,speed.y);
file_asc_write(filehandle,13);
file_var_write(filehandle,speed.z);
file_asc_write(filehandle,13);
counter+=1;
wait(1); // wait(3); for slower Computer play with 3
}
file_close(filehandle);
str_cpy(show_info.string,"Stoped Recording !!");
}




Dont forget to change Both functions , recording and for Playing

if you want the demo to play Faster as recorded so let it (1) in play function and maybe (2) or (3) while recording .

if you want the demo to play in slow motion so let i (3) in play function and maybe (1) or (2) while recording.
Posted By: HPW

Re: How to Record a Demo - 03/30/06 18:32

It's better to use waitt(1) instead of wait(1) to solve speed problems, isn't it?
Posted By: Shinobi

Re: How to Record a Demo - 03/30/06 19:43

Giebt es waitt überhaubt ? habe es nie benutzt und mal hier und da gehört , aber dachte eigendlich es ist noch aus der alten syntex .

Was genau ist denn der Unterschied zwischen den beiden ?

arebeitet waitt mit time zusammen ?
Posted By: Excessus

Re: How to Record a Demo - 03/30/06 20:13

waitt is indeed old syntax. You should use wait(-x) to wait x seconds.

I guess conitec got inspired by your code.. sys_record.
Posted By: Shinobi

Re: How to Record a Demo - 03/30/06 20:20

Nice to see , of course we the Community should show Conitec some ideas and incitations too , to help them to give us a better Engine and script.
So iam happy if i could help a bit in that direction.
Posted By: HPW

Re: How to Record a Demo - 03/30/06 22:52

Sorry, I don't know this is old syntax. I still have A5 not A6, but waitt(1) or <?>wait(-1)<?> working with time instead of frames.

With the functions from conitec we can only record the user inputs, this means we can as example only record the player actions but what's with the npc actions?
Posted By: Shinobi

Re: How to Record a Demo - 03/30/06 23:44

Quote:


With the functions from conitec we can only record the user inputs, this means we can as example only record the player actions but what's with the npc actions?




with my function you can add as many as possible , but remember if more is added more the file will grows up and also the Framerate , so you have to be tricky. A simple example in my script , instead of save the Player position AND the Camera position to the file , i only save the player Position becouse the Camera position is already set on players position. Another example is my little Fun Game "Run or Die" , the player change his speed , pan , roll , tilt , x , y , z , c_trace and more . But i only need to save pan , x , y and z , the rest do the players Action. That way you have more room to add for example NPC´s actions
Posted By: Neonotso

Re: How to Record a Demo - 04/04/06 22:49

Cool program!! I'd think this should most certainly help with the game I'm going to try to make. In my last game (2D), I made it really hard and it was like no one could beat it, but, even though I'll probably try not to make this new game as hard, it would be helpful to have these demo video clip things.
Posted By: Shinobi

Re: How to Record a Demo - 04/05/06 15:00

Feel free to ask if you have any Problems to use this script in your Game , if i can help i´ll do .
Posted By: Realspawn

Re: How to Record a Demo - 09/07/07 15:05

thx for this great contribution i remember 2 years back i asked around for this code and no one gave a clear answer
now some one did

i also took the liberty of uploading it to my wdl library.

Realspawn
Posted By: Shinobi

Re: How to Record a Demo - 09/07/07 15:16

Hi , i contributed this a while back , Conitec took this idea in their newer updates , with sys_record (if i remember right) your able to record a demo.

Your welcome Realspawn and you did a lot for the Community aswell .
Posted By: mpdeveloper_B

Re: How to Record a Demo - 09/07/07 15:32

this code is simple yet effective, i was thinking of writing something like this if i was making a racing game, thanks man, you saved me time
Posted By: Shinobi

Re: How to Record a Demo - 09/07/07 16:13

your welcome
Posted By: Blink

Re: How to Record a Demo - 09/07/07 21:32

i am having a problem getting to your site, the link is down.
Posted By: Shinobi

Re: How to Record a Demo - 09/07/07 21:49

Try again later , server is down because of so many ppl downloading at the same time . BTW in one week i have a new Webhoster hope its better then .
© 2024 lite-C Forums