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.

How would I go about creating NPC Events/Scenes? For example, any RPG will have a ton of different in-game cut scenes where you can express a story line.

What I have thought of so far is having different triggers and a number indicating the state of the story the player is at. When the player hits one of these triggers I will check the state and progress from there. Am I sort of on the right page?

After that how do I animate the scenes? Do I just hard code them into the game? I was thinking this is where a scripting language might be handy? I'm not really sure

I realize this is probably a large question, but if someone could point in the right direction that would be great.

I'm using c# and XNA if that matters at all.

share|improve this question
add comment

4 Answers

You've got the right idea of setting triggers in your game and game maps to fire off events (note, I don't necessarily mean the events in the C# language). Scripts are optional, but they can be a more flexible way to add these triggers to your game, and re-load new ones if a change in the storyline requests it.

Whether you'd be using scripts or not, generally, it would be good to have some "event loader" that can pass a new group of events or triggers to the game maps whenever it needs it. With scripts, it will be considered a script loader and that will be responsible for populating the game world with new events at specific locations, including events that can load another script.

For example, at the start of the game the first script (or event loader object) will be called automaticaly, and fill the game with event triggers. One of those events may be triggered after beating the first boss, and this event in turn will load another script that replaces some or all of the event triggers in the game. Now you have a new set of interactions or objectives you can explore. This adds a layer of flexibility for branching paths in quests and story, but with this also remember to plan out the branching paths of your storyline well, so you know all your events make sense within the story.

share|improve this answer
add comment

Not sure if you wanted more of a code sample than theory but have a look at this question

share|improve this answer
add comment

C#/XNA doesn't matter too much. I assume you want to build a (2D?) RPG, with events, and a map/event editor.

If that's the case, you need to create an event API, and tools to create/consume it.

For example, you will probably create a "show message" method (takes a string to display when you talk to someone); your map editor will allow you to place this event somewhere, specifying the text; and the game engine shows it when you step on that location.

Scripting languages are good (you might be making your own mini-language), but anyway, that won't prevent you from having to write your own "event API."

This is how I do it, and this is also what RPG Maker XP does.

share|improve this answer
    
+1 for an excellent answer, though I'm curious about how you determined that Sean is using a map editor that allows events to be placed somewhere. Is there a standard for map editors? –  Randolf Richardson Nov 3 '11 at 1:00
    
Alright, I was defintley thinking along those lines. Glad to see I'm going in the right direction. Thanks :) –  Milkboat Nov 3 '11 at 1:01
    
Oh, sorry. I missed the previous reply. I have made a map editor, so it shouldn't be to hard to add in that functionality –  Milkboat Nov 3 '11 at 1:02
    
@RandolfRichardson I didn't determine it; I'm telling him to create a map editor (if need be) and use it. There's no standard that I know of. –  ashes999 Nov 3 '11 at 14:12
add comment

The way I currently have my systems set up, events spawned by objects trigger scenes, as you stated you can have player triggers cause scene changes, and you can certainly use a state machine. You can make your own animation scene protocol, so it doesn't have to be hard coded. You also have the option of playing actual movie files if you so desire, but generally they're quite large.

I think you're definitely on the right page, since this is your program- you can go about it any way you desire. Creating functionality for things like this is intriguing and fulfilling.

I've never seen any real documentation on this subject so I'd be interested to see anyone else's take.

share|improve this answer
    
I'm not sure what you mean by animation scene protocol, could you give me an example? –  Milkboat Nov 3 '11 at 0:59
    
+1 for suggesting playing movies (I was going to suggest this, but you beat me to it). –  Randolf Richardson Nov 3 '11 at 1:02
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.