When you set a personal best lap time in a console racing game, you have the option to compete against your ghost.
How can this feature be created for a single player casual type game?
When you set a personal best lap time in a console racing game, you have the option to compete against your ghost.
How can this feature be created for a single player casual type game?
Ghosts are typically done by displaying a replay of a previous attempt. This replay is rendered with a non-collidable version of the players car so that you can't affect it. Since racing games often have a replay feature anyway this kind of comes along for free.
Here is a good starting point for building a replay system: http://www.gamasutra.com/view/feature/2029/developing_your_own_replay_system.php
Also there are a number of questions here on that topic:
It depends on the technology you're working with. Hence, we can't really discuss of the best way, since it might change from a technology to another. The the gross idea in my opinion would be the following:
In short, assuming the use of a database, we could have two tables:
Then, you could save the user information along with individual scoreboard which could, if desired, contain date and time registry as to when this score has been achieved.
I hope this helps and that I have correctly understood the question. Otherwise, please tell so that I may edit my answer accordingly.
Its not easy to answer this question without having more information on your game. The answer from wkerslake works as long as the current playthrough with the ghost can not affect the determinism of the recorded ghost data. If the recorded data is a single car time trial in a static environment, you should be alright using that technique.
However in many games with ghost playback, such as Super Meat Boy, the position of the player can change the state of the level and AI. Clearly, you can't have the ghost affecting the world and AI, so it might be better to just record position + animation changes (and anything else visible) every frame for the main player. During playback, just render the ghost at the current location and animation frame without having it be in the world. This allows you to playback a ghost and not have the current player affect it.