Game Animation

Yo,

Me and a friend of mine are working on a RPG for

our CS class. We've made an editor that saves all the

attributes that our characters hold(including a picture

of the character itself). What I'm wanting

to know is the easy, fast way to making our characters

move(i.e. to thrust a sword, cast a speel).







Comments

  • : Yo,

    : Me and a friend of mine are working on a RPG for

    : our CS class. We've made an editor that saves all the

    : attributes that our characters hold(including a picture

    : of the character itself). What I'm wanting

    : to know is the easy, fast way to making our characters

    : move(i.e. to thrust a sword, cast a speel).


    Hi there,


    Do you mean, how do you go about programming animations, or how do you create the artwork for the animation?


    Mark




  • I mean how should I go about making/saving/loading

    the animations. Should I put them in files one for

    each picture of the animation, and then at the

    end of each file have another filename for the

    next frame of the animation.


    Something as to the how-to process.


    Thanks


  • : I mean how should I go about making/saving/loading

    : the animations. Should I put them in files one for

    : each picture of the animation, and then at the

    : end of each file have another filename for the

    : next frame of the animation.


    : Something as to the how-to process.


    : Thanks


    Hi,


    You shouldn't save each animation frame as a separate file. As you can imagine, this will result in a lot of small files. Your file directory will become a great mess and it is also very inefficient use of hard drive storage space. You can put all the frames for a single animation sequence into a file, and create one file for each sequence. You would have to create a file format (if you can't or don't want to use an existing one).

    To do this, you simply think of what information you need to load and play the animation. The number of animation frames, the dimensions and format of the image data, a semi-transparent background color, the playback speed, all those are likely candidates. There could be other information that you want in that file too. Of course, the images themselves should be in there too.

    You have to determine which info is about the entire sequence (such as the number of frames), and which might be different for each frame (maybe frames can be of different sizes, or maybe the background color can differ). You create your animation file header by throwing all the info for the entire sequence together in some order, and add some kind of identification scheme into it so that your loader can see if it is really a valid file. This is most likely a short string of your choice. If you also have info that can be different for each frame, you create a frame header with that info in it, possibly also with some ID in it so that your loader can detect possible errors.

    The animation header should be at the start of the file. You can determine if you want one chunk with all the frame headers together, or if you want each frame header to precede the actual image data. Just think of some way to store it all into the file (and be sure to write it down, and keep the detailed specs fully commented in a text file).

    When all this is done, you could even think of creating a file format that can store all animation sequences into one big file, maybe even other data as well, such as sound effects.

    Writing a loader for it should not be too difficult if the file format is not overly complicated. Be sure to include the error checking in your loader (check ID strings, check value ranges, etc), because they are very helpful in debugging the loader. To test the loader during the first stages of development, use a simple, small animation file of which you are pretty sure it is valid. This way, if your loader reports an error, you know it is more likely to be a bug in the loader.

    I usually create my test files 'by hand' (for instance I hex-edit the headers, save them to files, and then write a small temporary program to paste everything into a single file). Once your loader works 100%, you can write a program that creates the files for you (You can write and use this program before that, but then it can be difficult to track the source of any errors. You might spend hours trying to find the bug in your loader, while the error might actually be a bug in the 'saver').


    Wow, I just read back what I typed here. Long story. Well, I just hope that there is some useful information for you in there. Please don't hesitate to ask additional questions, should you have them.


    Happy programming,

    Mark


  • Thanks, for the help we now have the loader, saver, and animation editor made. We also made it to where you can choose pallets. It looks great, only I don't know how to make use 640x480x256 graphics mode. Which means i can't really shade the items. Is there any easy way to access that graphics mode without much knowledge of pointers and addresses


  • Just to speed things up on the saving/loading end. Is there any way to write/read more than one character from the file at a time? We had to resort to changing all the color values to letters by adding 65 to their ASCII value. But this sux if I want to edit the file by hand. Any Help is always greatful.


  • : Just to speed things up on the saving/loading end. Is there any way to write/read more than one character from the file at a time? We had to resort to changing all the color values to letters by adding 65 to their ASCII value. But this sux if I want to edit the file by hand. Any Help is always greatful.


    You can read entire blocks of data from a file with the fread() function, like this. Here it is:


    fread(void *dest, size_t n, size_t size, FILE *file);


    dest = Buffer to hold the data that is being read.

    n = number of items to read

    size = size of each item

    file = File handle as obtained by the fopen() function.


    So, suppose you have an int array 'Array' of 256 ints, and you have your file handle 'InputFile', to read the entire array with one statement would go like this:

    fread(Array, 256, sizeof(int), InputFile);


    Mark


  • : Thanks, for the help we now have the loader, saver, and animation editor made. We also made it to where you can choose pallets. It looks great, only I don't know how to make use 640x480x256 graphics mode. Which means i can't really shade the items. Is there any easy way to access that graphics mode without much knowledge of pointers and addresses


    To be honest, I don't know much about SVGA programming, but I do know of one screen mode (often called Xtended Mode) that is 640x480x256, with NO bank switching. The problem is that it doesn't work on many video cards. It worked for me when I had my cheap Cirrus Logic, but now I have an expensive Creative Banshee 3Dfx card on which it doesn't work. If you email me, I can send you a tutorial that describes how to use Xtended Mode (you can also try to find it yourselfm it is part of the PCGPE 1). If you write your own graphics routines, you will have to know something about pointers and addresses, but it is really not that hard.


    Mark


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories