Game Development: How do you make a story game?
I made already a few simple games: enter a level, get up to the end, continue to the next level.
But I'm still wondering how "real" game developers create games with a story.Here are a few things what a story game has (and where I'm wondering about how they make it) :
- A sequence of places the player have to visit and do there that, that and that.
- The first time you see a guy, he says just hello. After a few hours game progress, he gives you a hint to go to a specific place.
- The first time you walk over a bridge nothing happens, a second time: the bridge falls and you will enter a new location under the bridge.
- The first time you enter a new location, you will get a lot of information from e.g. villagers, etc. Next time nothing happen开发者_如何学编程s
The last points are a bit three times the same.
But, I don't think they have a save-file with a lot of booleans and integers for holding things like:- Player did the first time ....
- Player enters the tenth time that location
- Player talked for the ###th time to that person
- etc
When I talk about story games, I'm thinking to:
- The Legend of Zelda (all games of the serie)
- Okami
And this are a few examples of level-in-level-out games:
- Mario
- Braid
- Crayon Physics
Thanks
Normally these games use a collection of flags to govern behaviour of particular characters and set pieces. This works out to be very similar (often directly equivalent) to a finite state machine, which is a slightly more general and powerful approach to the problem.
- A FSM tracks the "progress" of a particular quest - what switches are thrown, what conversations are held, etc
- Each NPC has a FSM to track the "information state of that NPC - each state correlates to a particular phase within the NPC's arc in the game, usually ending in a random-quote state.
- A saved game could, as one example, track the state of every object in the game universe.
The important part is to design not only the states but also the transitions so that they are as easy to hook up as possible.
I think you'll find it varies from genre to genre but while playing it's probably just held in a data structure in memory and when saved it's persisted into the save file (just look at the size of some save files for various games, I've seen multi MB save files).
I've never worked on anything like that, but I would assume that the the general approach is to load / save / query a "GameState" structure which holds all the necessary info for the game to perform the appropriate actions.
e.g.
if(GameState.Player.Karma < 0 && GameState.NPCs.BillyTheInnocentLamb.KilledByPlayer)
{
GameState.NPCs.FredTheShephard.HatesPlayer == true;
}
Now do it a million times and you've got yourself an RPG.
If you can manage to have a look at Oblivion (fantastic game!) you can try and use their Construction Set that allows you to completely personalise the game by building additional maps quests etc.
By using it you will see that the mechanism is essentially what the others have said: for instance you have several sentences a NPC can say, and it will say one or the other depending on certain conditions. For instance whether you're good or evil, how good you are at convincing him of something or how good you are at bribing him, particular items that you have/have not, but even things like the time of the day!
As you can see any of these thing can be easily expressed with a value (e.g. good/bad can be a value between 0 and 100, same for your bribing skill etc) and then it's just a matter of having lots of ifs :)
"But, I don't think they have a save-file with a lot of booleans and integers for holding things"
I think they do. :)
Sometimes there might be a formal structure to it: for example, it may be a list of named counters and flags that can be queried from the game's scripting language and which might correspond directly to entries in the design document. The game can increment the counters and flip the flags in response to in-game events and query those flags and counters when deciding which actions to perform, and the whole lot can be easily saved out in a compact format.
精彩评论