Game Demo
Blitz3D Forums/Blitz3D Programming/Game Demo
| ||
I indent to use FRAPS in the following way: I will capture videos of my game and play them later when the game runs in main menu loop. In order to see if I can do this I downloaded the demo version but the produced video (an .avi file] it was not so good for my purposes. The problem focused on the frame rate and not on the quality. I noticed that the demo version supports only 30 fps. All I need to know if someone of you has the registered version of FRAPS and if the videos in higher fps's are good enough for what I want to achieve Thanks |
| ||
25, 30, 50 and 60 fps are predefined in the full version. You can also set any fps value (default is 29.97) but you'll need some serious computing power to record at anything higher than 30 fps. Also don't forget that you will have to do some more work with the recorded data. Most likely you'll have to recode them with XdiV or similar codec to make them smaller and more manageable. Original FRAPS codec is designed for fast work but not for small sized files. Expect the recordings to be huge, easily going into hundreds of megabytes in length. Barney |
| ||
Just a thought for your demo - possibly a better option (depending on whether it suits your game) may be to replay keypresses to create your main menu demo. Set up a key (joystick/whatever) logger that each game loop records your input and write that to a file. In your main menu routine, run the actual game in the background (rather than a video of it) but each game loop feed it the next input from your previously recorded log. Assuming you completely reset your game before the menu and before starting the game itself, you will have an infinately repeatable "demo", and the storage space required is only what key(s) were pressed per frame. |
| ||
Thanks guys. hockings: I wanted to avoid your solution to save time, but I think that I don't have other option... |
| ||
Sorry to hijack this thread, but how would you do it Hockings way? I don't understand that suggestion. |
| ||
Ked To do this properly, your game needs three modes 1) Let the player play the game 2) Record what the player does (this should be part of your game's debug mode) 3) Replay what the player did Here's our basic pseudocode that I'm going to use as examples - modify to suit your program. It is not necessarily the best or neatest way, but it will work Subroutine Main loop() process_input # this processes the user keypresses draw_screen # draws the level / player / enemies etc flip End subroutine Subroutine Process_input() if player hits right playerx = playerx + 1 endif if player hits left playerx = playerx - 1 endif … [code for other inputs up/down/fire] … End subroutine ------------------------------------------------------------ Mode 1) How you get into this mode : This is the default mode. Initialisation : set all your variables etc up to the defaults (level=1, lives=3 etc). Code : Each time the main game loop runs it processes player/enemy input as normal and does stuff. The game will do this mode by default. ------------------------------------------------------------ Mode 2) Lets assume your game has 5 player inputs, up,down,left,right,fire. We need a notation system for these, we'll assign the first letter for each input to make life easy - "u","d","l","r" & "f". We'll also assign a sixth input "nothing" ("n") How you get into this mode : put "DEBUG=1" at the top of your code, run game with a debug command line option, or whatever method suits you. In your code : Initialisation : As per mode 1, but also create a file to record your inputs into Code : Main loop : Where you process the player's input, we need to record the input. We also need to put the code that controls what happens when a player presses a key into a subroutine. eg. change if player hits right playerx = playerx + 1 endif modify this to put the "pressed right" code in a subroutine, record the notation chosen earlier for pressing the particular input into the file, and also catch "no input pressed" situation your code should now look like :- Process_input() if player hits right run pressed_right subroutine endif if player hits left run pressed_left subroutine endif […] if mode=2 then if has_hit_key=0 then write "n" to file endif endif End subroutine Subroutine pressed_right() playerx = playerx + 1 if mode=2 then has_hit_key=1 write "r" to file endif End subroutine Subroutine pressed_left() playerx = playerx - 1 if mode=2 then has_hit_key=1 write "l" to file endif End subroutine [… subroutines for up/down/fire …] If you didn't add the "if has_hit_key=0" section to Process_input, we wouldn't know about all the game frames where the player isn't doing anything and your playback will end up broken. Now run your game in mode 2 and play until you die / have played long enough for your demo. You will now find your file will contain something like "udnnnunnnnfnnnfnnnunnnrdnnnnfnr" ------------------------------------------------------------ Mode 3) How you get into this mode : Runs as your main menu Initialisation : as per mode 1. Main loop : At the start of your game loop, read the next character from the file into a variable (eg. action) Where you process your player inputs change the code to be able to handle reading the input from the file instead of (for example) the keyboard. Code : In Process_Input() change if player hits right run pressed_right subroutine endif To if (mode=1 or mode=2) and (player hits right) run pressed_right subroutine else if (mode=3) and action="r" then run pressed_right subroutine endif endif Change your main loop to Subroutine Main loop() if mode=3 then read next character from file process_input # this processes the user keypresses draw_screen if mode=3 then DoMenuFunctions flip End subroutine With this, you'll now end up that the game will play in the background, running from the inputs recorded in the file, and because we "DoMenuFunctions" (ie. Display the menu, check for the user moving between and selecting menu items etc) after we draw the screen, the menu will end up on top of the playing game. So there you have it, your game will now support a demo mode. You'll need to make your initialization routine and the file format for recording the demo a bit more complicated if you want the demo to start from somewhere other than the start of the first level, but that should get you started. Final code ---------------- Subroutine Main loop() if mode=3 then read next character from file process_input # this processes the user keypresses draw_screen if mode=3 then DoMenuFunctions flip End subroutine Process_input() if player hits right if (mode=1 or mode=2) and (player hits right) run pressed_right subroutine else if (mode=3) and action="r" then run pressed_right subroutine endif endif endif if player hits left if (mode=1 or mode=2) and (player hits left) run pressed_left subroutine else if (mode=3) and action="l" then run pressed_left subroutine endif endif endif […] if mode=2 then if has_hit_key=0 then write "n" to file endif endif End subroutine Hope that helps! |
| ||
That does help. Thanks for your time. |