WARNING: Backwards compatibility on the file format is currently not guaranteed. This will change once the repository is tagged at v1.0.0 and I complete my game. The reason for this is because I want to ensure it has key functionality I require before calling it stable at v1.0.0.
Basic input recording system that writes what keys are held down per frame to a stream of bytes. Each key that can be held down takes up 1-bit of space per frame. This stream of bytes can used to play a users gameplay back for purposes such as integration testing, replays and more.
go get github.com/silbinarywolf/swir
- I recommend you download the following repo that has an example. The reason for putting the example in this seperate repository was to ensure that this package has minimal dependendencies.
go get github.com/silbinarywolf/swir-examples
- Run the tests and observe the game playing itself
go test ./...
- Dive into the code here and see how this package can be tied into an Ebiten game.
- Golang 1.12+
I have ideas and features that I'd like to look into adding in the future, however, for now this package achieves the bare-minimum of what I need. Do not wait for me to implement these if you want or need them!
- Recording Random Number Seeds
- Not sure if this needs its own built-in API or if this is something a user should handle themselves. The Retro City Rampage talk on automated testing mentions that to keep tests working over time, you will want to decouple random seeds for gameplay and visual effects that don't actually affect gameplay.
- Expose API to allow a user to write into the stream with custom events or behaviour (ie. level changed, log characters X/Y, etc)
- ie.
WriteEvent(event EventID, data []byte)
, whereEventID
is a constant between 1-127. (127-255 is reserved for internal events like keypresses)
- ie.
- Recording Mouse Movement / Click
- Ideally this would use deltas between frames to try and keep the recording file as small as possible
- Ability to stream recording information out to file system
- This would allow long-running game sessions to not consume too much memory. The benefit of this too is that you could potentially record a players game session and be able to playback exactly what they did to reproduce bugs.
- Brian Provinciano for inspiration from their GDC Talk, "Automated Testing and Instant Replays in Retro City Rampage"