Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
2  
+1 Interesting question for one who is just a beginner in game development (me). =) –  Will Marcouiller Mar 8 '11 at 23:58
    
If you would tell us what kind of game it is, we could help you more specifically. –  AttackingHobo Mar 9 '11 at 19:02
    
See also: gamedev.stackexchange.com/questions/6080/… –  Jari Komppa Mar 15 '11 at 7:28
add comment

3 Answers

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:

share|improve this answer
    
+1 Just learned something new with your answer, thanks! =) –  Will Marcouiller Mar 15 '11 at 12:22
add comment

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:

  1. Use an underlying data store to persist your data (XML, Cookies, Database, CSV, other...);
  2. Work your data access to this underlying data store;
  3. You need to keep information data about the best score of a player, so an identifier is required (email, input name, else...);
  4. Associate this best score to the identifier one way or another.

In short, assuming the use of a database, we could have two tables:

  1. Users/players data (identifier, email, etc.);
  2. Best score board information data.

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.

share|improve this answer
3  
I think he is likely looking for a recording/playback mechanism to accomplish this. Deterministic game environment, tracking events that change things (Player input for example) and the like are usually the recommended ways to do this. –  James Mar 9 '11 at 0:47
    
Thanks for your input James! These are stuff which I don't know about, though my answer is also a easily done approach, humbly. However, I'm interested to learn more on the topic. Oh and, +1 for your comment, this teaches me that there are other doable approach. =) Thanks! =) –  Will Marcouiller Mar 9 '11 at 0:56
    
i'm really sorry for this goof-up i'm still learning the basics thanks to both for your info, I can't really reply with proper knowledge because i don't possess any. what i want to accomplish is each time that i try to beat my personal high score that i see on the screen a ghost(replay) of how i played the game when i set my high score –  claude keller Mar 9 '11 at 1:23
    
@Will you are telling him information on what would could be done for a multiplayer setup, once he has actually figure out the answer to his question about a single player game. His question is how to create the ghost in the first place. –  AttackingHobo Mar 9 '11 at 2:44
    
@AttackingHobo: Thanks for telling me. I actually have figured out from James comment about the recording thing, then having read wkerslake's answer, I now better understand what's being asked by the OP. Aside, you're right when saying that my proposed setup is more likely to be used in a multiplayer setup. Hey, I'm still learning here, and thanks for allowing to grow better! Game Development is still a new trick for me though I am an experienced developer. =) Thanks for your comment AttackingHobo! =) –  Will Marcouiller Mar 9 '11 at 14:24
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.