Now, I won't know if it will work because I have never done it before. I need a way to create and manage cutscenes for my game. All cutscene data will be saved in a file and will be loaded when needed. The file is just a small script which can control everything from creation of an object to moving the camera. It's a very simple thing but very hard to implement.
I don't want to hard-code it into the game because it's very hard. If I were to hard-code it, every cutscene will have a long list of codes, increasing the size of the game. So, I thought, why not I just make 1 simple system, which reads a file with the cutscene data and run it? Then I could just write codes which controls the objects and things like that, but the cutscene file will define where to place objects and where they'll move and things like that. That way, the cutscenes are fully customizable.
I don't really guarantee it would work, but I'll just try.
===========
EDIT: To my surprise, the cutscene system worked on my first try!! It rarely happens to me. Most of the time, stuff that I programed must undergo tonnes of testing before it can work, but this time, something that's very new to me, worked without any hassle!
Here's how it's going to work.
There's an object called the Cutscene Manager. You'll give it the path to the MCS (Mr Ball Cutscene) file. It'll then load it. It's a very basic little script file, with very simple syntax.
<Command>,<Parameter1>,<Parameter2>,...;
It starts with a command name. It's not case sensitive. Then followed by its parameters. The whole thing is ended by a semi-colon (a must). The command and parameters are all separated by comma.
No 2 commands are allowed on the same line. When you start a line with the # symbol, it just makes it a comment, which won't be parsed by the Cutscene Manager. Currently, I have just defined 15 commands, which is actually enough for a very simple cutscene, without dialog, that is.
Yeah, so, the Cutscene Manager parses the little script and just run the cutscene.
A lot of the commands involve objects. When the object is created with the "crObject" command, you must assign it a unique ID. This id will be used in many other object commands. You can only create objects that are defined in the Cutscene Objects List. Anyway, here's the list of commands I created so far.
crObject -> Creates an object and places it in the Cutscene
moveObject -> Moves the object to the specified destination
stopMoveObject -> Stops the previous command
wait -> Wait for the given amount of time before preforming the next command
rotateObject -> Rotates an object
setAngleObject -> Sets the object's orientation along the x,y, or z axis (without the animation like in rotateObject)
setPosObject -> Sets the object's position (without the animation like in moveObject)
setSpeedObject -> Sets the object's speed
setGravity -> Defines gravity for the specified object
setCamPos -> Sets the camera position
setCamTarg -> Sets the camera target
setCamSpeed -> Sets the camera speed
moveCam -> Move the camera
trackObject -> Tracks the specified object
stopTrack -> Stop tracking the object
There will be a lot more coming up, adding more power to the MCS script, like playing MP3, fade in and fade out animations, and more.
Sunday, 14 December 2008
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment