• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
raptor70

Replay System

10 posts in this topic

Hi all, Does someone know a good article or website about ReplaySystem ? I found one on Gamasutra but are there other ? For me, a replay system must be able to register a game part and replay it... Thanks in advance Regards
0

Share this post


Link to post
Share on other sites
There are two sorts of replay systems That I know of.

1) If you have a deterministic game, all you need to store and replay are inputs (user inputs, frame timesteps, random number seeds, ...).

2) Serialisation / Deserialisation of the game state. Have your objects record and replay their states. In fact, you don;t record the states, but the state changes (many objects won't change).

#1 Is very lightweight, IF IT WORKS! The trick is to have a fully deterministic game, and that in itself can be a problem. Second, if there is a discrepancy, it is very hard to track down what made the game and it's recorded part deviate. And once they deviate by the slightest bit, that's it, game over. Anything as trivial as doing one collision check out of order is enough to send the replay sideways. Detecting deviation for debugging requires you to build hash values of object states (whatever that is, like a ray-traces, messages, ...)

Also, you cannot rewind, step into the game, without having to rollback the simulation to the very start, and replay up to the point of interest. Also, you need to decouple the update, and the rendering, if you do not have a fixed frame timestep, and you want stuff like slow motion.

#2 Requires more code. You need to implement serialisation methods to your objects. Then being able to record changes in game states (if you want to have a small replay buffer). It's not dissimilar in many respects to the Quake3 Networking Model. Instead of sending the game state to a client, you just write it to a buffer, and for replaying, grab the game states from the buffer, do interpolation, effects...
0

Share this post


Link to post
Share on other sites
I have implemented the replay system that oliii described in 1.
Once you have a deterministic game then it's simply a matter of logging the user's inputs and replaying them back during the correct game update. It was surprisingly easy to implement but as was mentioned, the hard part is in making sure that your game is completely deterministic.

I decided to make mine deterministic because it's easier to debug and you don't have any crazy thing that can rarely happen for no reason at all.
0

Share this post


Link to post
Share on other sites
'1' is also a little fragile - if you make a recording with v1.0 of your game then the odds are it won't playback the same under v1.1 of your game. Now if you're just using it for an attract screen then you can rerecord without much hassle, but if your players are expecting to keep their replays between versions then it's probably not the best approach.

It is very, very light on memory though - typically you only have to record a handful of inputs every frame, so you can have quite long recordings without taking up much memory at all.
0

Share this post


Link to post
Share on other sites
Thanks all...

The objective of this system is to test, all the night, the game during development and verify that there are not difference between the versions...
Does your purpose system adapt ?

0

Share this post


Link to post
Share on other sites
Depends on what you need to reproduce, but 1) will replay 'exactly' as you recorded, or either it will bomb straight away. The second is more like an approximation of what's going on, and the A.I. and other components are disable (it's a 'pure client', like when you replay a Quake3 demo or observe a Guild Wars battle). If that's all you need, and you already have serialisation (load / save), then it's worth considering.

As said, 1) is very fragile. When your game code changes (anything from A.I., to collision, tiny optimisations even), the inputs will most likely no longer be valid. This is not quite so true for 2), although a change in the data format will invalidate the replay as well.

Both require a lot of work tbh. 1) is to make sure it's 100% deterministic, write debug tools to check on that (record/test hash values made of game data) and everytime you tweak the code, you have to keep it mind if the determinism will stick, 2) is writing all the serialisation and delta-compression methods, which is no small task.

Lots of things can get in the way of determinism, especially if you have a multithreaded system, then I'd be very careful. Obviously the threads will have to be sequenced properly, and that may or may not be part of your engine.

If you are pretty confident that your game can be fully deterministic, 1) is definitely the easiest. It's painstaking work (debugging notably), but it's still way more lightweight than 2) which will be a monster.
0

Share this post


Link to post
Share on other sites
BTW, if replays are not 100% required and part of the deliverables, then gladly walk away. They are a pain, trust me on that (I've worked on / with a few).
0

Share this post


Link to post
Share on other sites
I made a real simple system (it was for a 2D Mobile game) which worked extremely well and only took me a few hours to integrate. This was for a sports game, so for each player on the field they needed an X, Z animation and direction they are facing (among other things, but these were the core stats the needed to be replayed). The player class was already set up like this, so there was no refactoring needed or any headaches when implementing this system.

I had an array (note the int is actually Fixed point) in the Player class,
int m_iReplayPos[NumberOfFrames][2]; where NumberOfFrames = the number of frames to save, and pos0 = X, and pos1 = Z;

In addition, I stored their animation data like this
byte m_ReplayAnims[NumberOfFrames][2]; where NumberOfFrames = the number of frames to save, and pos0 = Direction they're facing (North, south, etc), and pos1 = their animation.

For each frame that was rendered (remember this is a cell phone game so fps = 10->15) i stored the position of each player and their animation + direction (I had a function that when it rendered them, used the animation and direction to display the correct frame).

I did the same thing for the ball and camera, and just iterate through this array when replaying, disabling ALL AI and anything else that would divert from this set course. As i said, it had to be simple for a cell phone game, (which was already pretty simple), but it integrated nicely into our game. In about 2 hours, I had the replay working no problems using about 10k for 15 seconds or so of replay.

Hope this helps!
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0