DemoRec: input recording and playback
I wish to show you a new Game Maker extension I made to record the gameplay. The extension can record mouse and keyboard input and reproduce them accurately during playback.
This extension is very useful to me: because I’m changing many times the graphic assets of my games, I have to make the screenshots again. Instead of recording the gameplay again, I’m able to use the previously recorded gameplays with the new graphics. It’s a way to decouple the graphics from the gameplay. With appropriate modifications, this extension could be used in different ways.
In order to simulate mouse down and mouse up, I created a simple DLL “RecHelper.dll”, which is included in the gmez.
How to use it
- Import all the content in your game.
- Place the persistent object sub_record in the first room of your game.
- To activate the object at runtime, you need to enter a secret keyword (the default is “phoborec”).
- A messagebox says that the object has been activated.
- Press F11 to start / stop recording, F12 to start / stop playback.
- A recording file “sub_record.txt” is saved in the %localappdata%\<Game Name> folder.
Mouse lock
DemoRec can also manage the mouse lock, used for example in FPS games.
The extension includes the object sub_mouselock. Place it in the first room of your game if you want to use it. Use the User Defined 0 event to activate it, User Defined 1 to disable it.
When the object is active, it continuously centers the mouse and computes the delta. This one is stored in the two variables dx and dy, which can be used for example to rotate the view.
In order to tell sub_record that there is a sub_mouselock object, you need to assign the id of the lock object to the variable sub_record.mlock_obj.