Jump to content
Eternal Lands Official Forums
Sign in to follow this  
Entropy

Implementing animations, rotations and movements

Recommended Posts

Here is the design document with the explanations and everything.

Note that I won't commit anything until after this update:

Another note: this is only the C side of the problem, the Small code and implementation will be in another design document. If you have suggestions, please post them here.

 

------------------------------------

Small integration design document - Animations

 

I will take care of everything here, so do not attempt to implement anything unles specifically asked. However, I could use suggestions and stuff.

 

New structures and lists:

 

 

file: small_animations.c/h

#define MAX_ROTMOVS 1000
#define MAX_FRAMES 100
#define MAX_3D_ANIMATION_TYPES 200
#define MAX_3D_ANIMATIONS 1000

/*
Purpose: Having map objects rotate on one or more axis, such as windmills, parabolic reflectors, debries in the water, and so on.
The rotation speed can be positive or negative, and it will be updated every 36 MS or so (whatever the timer is).
Once the object reaches the _rot_stop value, it will stop and callback the small script.
Same for the move speed.
*/

//small callback values
#define X_ROT_STOP 0
#define Y_ROT_STOP 1
#define Z_ROT_STOP 2
#define X_MOV_STOP 3
#define Y_MOVE_STOP 4
#define Z_MOVE_STOP 5

typedef struct
{
int object_id;
float x_rot_speed;
float y_rot_speed;
float z_rot_speed;

float x_rot_stop;
float y_rot_stop;
float z_rot_stop;

float x_move_speed;
float y_move_speed;
float z_move_speed;

float x_move_stop;
float y_move_stop;
float z_move_stop;	

}rotmove_3do;

rotmove_3do rotating_moving_objects[MAX_ROTMOVS];



typedef struct
{
int delay;//delay is decremented every call (whenever it is called by the timer). When 0, move to the next frame
char file_name[128];

}animation_type_3do_frame;


typedef struct
{
int frames_no;
animation_type_3do_frame frames[MAX_FRAMES]

}animation_type_3do;

animation_type_3do animation_3d_types[MAX_3D_ANIMATION_TYPES];

typedef struct
{
int animation_id;//index in animation_3d_types
int object_id;//index in objects_list[]
int current_frame;
int current_dealay_left;

}animation_3do;


animation_3do animations_3d[MAX_3D_ANIMATIONS];



//funtion prototypes (not all the functions)

//load the animation defs, will be placed in the init part of the game
void load_animation_defs();

//clear the rotating_moving_objects (might do some other stuff as well). Will be called when a new map is loaded
void clear_rotations_and_moves();

//clears all the animations, will be called when a new map is loaded
void clear_animations();

/*
update the rotations and movements, call the Small callback functiosn if a rotation/movement stopped.
If multiple rotations/movements stopped, call the Small callback as many times as necesary (with the appropriate parameters, of course)
*/
void process_rotating_moving_objects();

/*
Move the animated objects to the next frame (if current_dealay_left is 0), decrement current_dealay_left otherwise.
When the current_frame reached the last frame, call the appropriate Small callback function.
*/
void animate_the_objects();

------------------------------------

Share this post


Link to post
Share on other sites

Problems we've discussed:

 

Small is not installed on that many development machines

Especially Gentoo Linux came in mind, since we are in their package manager. We would have to distribute the Small source with the client source in order to get it supported properly.

It's based on the zlib license: http://www.opensource.org/licenses/zlib-license.php

 

Small 32- and 64-bit binaries are incompatible.

We can distribute 2 binaries - 32-bit and 64-bit. An alternative would be to do the compilation on the client - this would also allow users to improve their scripts without having that much programming knowledge.

 

Rotations can be done in C as well.

It's not being implemented for the sake of rotations alone. There are many other uses for a scripting language.

 

Small is a compiled scripting language

A compiled scripting language has the disadvantage that the scripts have to be compile before they can be used. A workaround would be to include the Small compiler into the client and compile all small scripts on startup (if their mtimes differ). Then we would both have the speed of a compiled language and the flexibility of a non-compiled.

 

Costum scripts could contain malicious code

If we make the compilations done inside the client, the scripts will have to be distributed with source, hence the user would at least have a chance of evaluating what is going on.

 

Positive sideeffects:

You have a good deal of control with small

Scripts will call C wrappers that we predefine. It will only be a very limited # of functions, so it will not be able to call something that is potentially harmful.

 

It would make it easier to add new effects to the client

We'll get more interesting maps if the client could add effects such as doors opening, chairs flowing through the air in a haunted house, the floor appearing to move etc.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×