Jump to content
Eternal Lands Official Forums
Entropy

Special effects

Recommended Posts

I want to make the server send some extra information when a magic spell is cast, or in some other circumstances.

The idea is for people to implement those things on the client, and add some eye candy.

How you implement them is at your latitude, however:

1. I don't want extra dependencies.

2. Document the code.

3. Test it, and make it reliable (ie. no client crashing)

4. If you want to use advanced stuff such as shaders, then also provide a low tech version for people with cards that do not support that.

 

Here is how it will work:

The protocol is (to the client): #define SEND_SPECIAL_EFFECT 79

After the protocol and length, we will be sending an octet which is the TYPE of the effect. They are enumerated below.

Depending on the effect, the data that follows it will be different.

So far we have the following kinds of data:

Player to Player (16 bit id, 16 bit id)

Player (16 bit id)

Location (16 bit x, 16 bit y)

 

And here are the effects:

//special effects
//when one player uses the poison spell on another one. Player to Player
#define SPECIAL_EFFECT_POISON 0

//when one player heals another. Player to Player
#define SPECIAL_EFFECT_REMOTE_HEAL 1

//when one player harms another. Player to Player
#define SPECIAL_EFFECT_HARM 2

//when one player casts shield on himself. Player
#define SPECIAL_EFFECT_SHIELD 3

//when one player casts restoration. Player
#define SPECIAL_EFFECT_RESTORATION 4

//when one player casts a smite summonings. Player
#define SPECIAL_EFFECT_SMITE_SUMMONINGS 5

//when a player goes invisible. Player
#define SPECIAL_EFFECT_CLOAK 6

//when a player becomes visible. Player
#define SPECIAL_EFFECT_DECLOAK 7

//when an invasion starts. Location
#define SPECIAL_EFFECT_INVASION_BEAMING 8

//when a player casts heal summoned. Player
#define SPECIAL_EFFECT_HEAL_SUMMONED 9

//When a player casts mana drain. Player to Player.
#define SPECIAL_EFFECT_MANA_DRAIN 10

//when a player teleports to range. Player, Location
#define SPECIAL_EFFECT_TELEPORT_TO_RANGE 11

 

Sometimes, when two actors are required, and one is not in the client's range, just ignore the whole thing.

 

If you have questions, please ask. I am currently looking for some implementation samples, so once you have something working, please submit a screenshot, or, if possible, a video.

Share this post


Link to post
Share on other sites

You mean they're implemented server side and ready for client side implementations, right?

 

I might have time to knock one off over Christmas, but probably not before then.

Yes, the server is already sending them.

Share this post


Link to post
Share on other sites

I would like to test the restoration spell effect ;) I have time but if you can give me a link or speacil file to place into my el folder, I would happily test it :ph34r:

Share this post


Link to post
Share on other sites

ELVARG they are NOT visible in the client yet! Please stop posting stuff like that here as it just gets the thread spammy, this is just for programmers. When something is ready to be tested by the public then we let everyone know.

Share this post


Link to post
Share on other sites

I will be testing the SPECIAL_EFFECT_SHIELD (and probably other "self" spells later).

 

[edit]

Although, why does extra data need to be transfered? Whether or not a spell was successful is already known. We could just tag the SFX to the success.

 

[edit2]

Then again, the spells code is a bit hard to decypher.... Maybe I will use Ent's protocol. ;)

Edited by 0ctane

Share this post


Link to post
Share on other sites

Okay, I have done some very basic stuff like adding in the defines from Ent's first post. I was testing the receipt of server signals (multiplayer.c), although I cannot test for all due to my low magic level. For heal and shield both by myself and others, I get information from the server. =) However, remote heal and tele to range report nothing (by self and others). Are these implemented serverside (as in, are they sending SEND_SPECIAL_EFFECT back)?

Share this post


Link to post
Share on other sites

Quick update. I have been able to probe a number of the spells. Here is the status on what I can see:

0 = poison

1 = remote heal (only when I healed someone who was hurt)

2 = harm

3 = shield

4 = restoration (server message only received if injured)

5 = smite_summon

6 = invis

? = decloak (no message from server)

? = invasion beam (need to see a beam to verify)

9 = heal_summon

10 = mana drain

? = tele to range (no message from server)

12 = heal

 

So, some progress.

Share this post


Link to post
Share on other sites

Okay. I have created a routine called parse_special_effect which, as its name implies, splits the server data for player, player:player, and location special effects. The new functions are being built into a file called special_effects.c. Should I instead put the code into an existing file? I still have some debugging code in place that will print messages to the console, which has been useful for seeing when and what spell is cast. If there are no objections, I will commit this to CVS with a #ifdef SFX so that it does not effect others. Then, the fancy effects can be worked on by multiple people. Right now I just have it do a green highlight under actors.

Share this post


Link to post
Share on other sites

I have a question. For the tele-to-range spell, how much data are you sending from the server? I would think you would want the player id (16bit) plus x and y position of either where they are going to or where they came from. This will depend on part as to what gets sent from the server first: the teleport spell success (in which case you need to know previous position) or the special effects (in which case you need to know where they are going). I am assuming you want some sort of disappear-reappear effect which requires both positions.

 

Along with this first commit will be modifications to highlight.c/h. I am hijacking highlight.c/h code right now for temporary special effects.

 

[edit] Okay, I have committed the new stuff. You will need to add the file special_effects.c to your Makefiles and use a -DSFX. Only three effects are currently active...smite_summoned (red effect), invasion beam (regular green highlight effect) and everything else (blue effect).

Edited by 0ctane

Share this post


Link to post
Share on other sites

Sorry folks. While the code currently works (on my Mac at least), I have discovered a problem. As it stands, there is no way to distinguish between caster and target, so I am rewriting the code. On the plus side, I am pulling my temporary code out of highlight.c, so everything should be contained in special_effects.c and be cleaner.

 

I currently have a plan for the summon effects and regeneration. I hope others are thinking about possible effects for the other spells. Also, I think it would be cool to add sound effects to these actions, but I would like to get the graphics done first.

 

[edit] Okay, committed changes. Right now, the special effects are "tile based". For instance, if you are walking and cast a spell, it sorta gets dropped behind as opposed to following with you. This is fine for smite/heal summoned since they are radial spells, but not the best for other types. Anyhow, take a look at the current examples. -DSFX

Edited by 0ctane

Share this post


Link to post
Share on other sites

Hi. Could someone please add the declaration of

float get_tile_display_height(short x, short y);

to highlight.h? Without it, very bad things start to happen (Windows/MSVC2005). Function get_tile_display_height returns different values for the same parameters if it's beeing invoked from display_highlight_marker;highlight.c (correct values) or display_special_effect;special_effects.c (wrong values) resulting in effect not beeing visible. Also for human character I had to remove the -11 factor to see the effect.

 

Kindar Naar

 

PS. The effects are great :wub: Keep up the good work :P

Share this post


Link to post
Share on other sites
Hi. Could someone please add the declaration of...

Yeah, I also need to make a special_effects.h as a "good" programming practice.

Also for human character I had to remove the -11 factor to see the effect.

Hmmm.... This is a bit strange then. When I cast remote heal on humans, the effect was fine. As I commented in the code, the "-11" was entirely a fudge factor. I noticed that the z value was always 11 units too large for me, although I have no idea why this would be so. Maybe this has something to do with declaring functions in the header files. Yes! Good call Kindar Naar. :D I will commit this change.

 

For now, I need to make more MatEs and MagEs, otherwise I will not be able to test these effects. :D While I am somewhat happy with my heal, remote heal, and smite/heal summoned, I do not like my shield effect (since it really was just a temporary proof-of-concept anyhow). I have a much better idea in progress. I am also thinking about adding a spiralling effect to the summon spells to make them a bit more interesting. But, please, if someone wants to work on an effect, do so!

Share this post


Link to post
Share on other sites

For now, I need to make more MatEs and MagEs, otherwise I will not be able to test these effects.

 

Hehe, same here :D I used all by SRs/EMPs to debug this at the test server and my 'rich' character seems to have been deleted :D

 

I got the new build and shield/heal works. (nice heal effect, maybe make it spin around the player and hover over the head for a few seconds?). I cast remote heal (on non harmed unit) and didn't see anything....

 

[EDIT] Remote heal efect is sent only for harmed units. My mistake.

 

Kindar Naar

Edited by Kindar Naar

Share this post


Link to post
Share on other sites

Well, for some reason I cannot capture the effect on my Mac when doing a screenshot. Maybe this is because I am using the Mac's screenshot program as my client does not have its own screenshot->png functionality. Maybe Kindar will have some luck.

Share this post


Link to post
Share on other sites

Ok, I've made some screenshots from spell I can cast:

 

Heal:

elscreen001.jpg

 

Shield:

elscreen003-1.jpg

 

Remote heal:

elscreen004.jpg

 

And currenlty I'm playing with heal effect to make it spin & hover :P

 

Kindar

 

PS. It's hard to put a dynamic effect into one screen shot B)

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

×