Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
58 stars 47 forks source link

Animations of monsters #885

Closed Prapilk closed 2 months ago

Prapilk commented 2 years ago

The actions of monsters and animals are governed by mobtypes and mobtype flags. I think Sphere is "stuck" on MONSTER or ANIMAL fly or not.

Example: dragons have a 1009 flag which allows them to cast spells with action 12 (stomp in fiddler). But ingame they do action 12 very rarely like normal monsters.

Another example with flags 1000 (c_ophidian_shaman in anim 85, Terathan in 72 etc....), they have the particularity of having action 12 in cast like the dragon BUT ALSO action 13 and 14 in cast. In the game it is not taken into account and it sticks together to hit itself in melee without using actions (again like a simple MONSTER 0 lamda).

mobtypes MONSTER 1000 => action 12, 13 and 14 cast spells. mobtypes MONSTER 1008 => action fly 19, 20, 21 which are supported but also with action 12 and 13 in caster mobtypes MONSTER 1009 => action fly 19, 20, 21 which are supported but also with action 12 in caster mobtypes MONSTER A00 => here the particularity is that there is very little action and that attack actions 4, 5 and 6 replace actions 12, 13 and 14. mobtypes MONSTER 1004 => actions 7 and 8 are added and action 12 is used as the summoning animation of the monster.

There are other flags but I believe it's client side. The MONSTER 9 is placed on the monsters directed by the body.def (the body.def refers to the monsters with the flags 1009). I think he was supposed to replace the 1009 with less action (maybe remove flying for dungeon dragons) but the flags of the original ID before the replacement in the body.def is not supported count on the clients I use.

Of course the animal flags that are in the MONSTER IDs (0-200) are for those who fly and depending on the flags we add +- actions BUT NOT THAT, I think that the ANIMAL 20 mobtypes transforms the attack 03 (so action 6) in one movement on the water. So the ANIMAL 20 flag should allow the snake and the little frogs to move on the water.

Of course, what I'm saying is purely empirical after having nit-picked a bit in the muls, but I hope I've been explicit enough for us to consider the question.

Jhobean commented 2 years ago

We had some good discussion about this on discord. https://discord.com/channels/354358315373035542/1010257922086928424/1013891598884544544

Apparently sphere never send packet for some anim. Few monster have specific anim and sphere always use stamdars anim.

We should read mobtype flag and depending of npc, send the anim packet differently.

Jhobean commented 1 year ago

Apparently, we need to read the mobtype file. With mobtype file we must choose different anim here: https://github.com/Sphereserver/Source-X/blob/56268c37bfad581d5db9df00c09082027473f8bf/src/game/chars/CCharAct.cpp#L980

DavideRei commented 4 months ago

I changed my Sphere to read mobtypes.txt and read the animation type and flags to make Sphere calls the correct anims.

The flags are not really clear to me. I would say that flag 1000 is a sort of CAN_CAST flag but not all anims where is it used have all the cast actions. For example 14 MONSTER 1000, Earth Elemental, 12 is not a spell cast and 13 and 14 are missing. 24 (Lich) doesn't have 14. We shouldn't mix different flags to make assumption i think, because they are hexadecimal flags. For example CAN_CAST (1000) + CAN_FLY (8) have 12 and 13 but not 14. It's right but we have to treat the flags indipendently. 1009 is CAN_CAST (1000) + CAN_FLY (8) + UNKNOWN1 (1). For the Dragons this flag (1) could be the 12 spell action but there are also 46 MONSTER 1 which is anim2 63 and the anim 12 action is missing.

ID 13, 15 and 16 have 1004. They can cast but only with 12, no 13 or 14. What for should be used actions 7 and 8? For ClassicUO flag 4 is IdleAt8Frame and action 8 seems to be used instead of action 1 for standing/idle animation. About ClassicUO here's the flags it uses. image

There is 8 MONSTER 1900 (1000 + 800 + 100) but the Corpser doesn't have 13 and 14 and 12 seems a special action like come out of the ground. ClassicUO seems to replace action 10, 15 and 16 with 1 and action 11 with 17 where there is flag 100. 800 is not used.

MONSTER A00 should be 800 + 200. ClassicUO seems to replace flying action 19 with walk 0 action and 20 and 21 with 1 where there is flag 200.

If we can find an algorithm i can make a PR

Jhobean commented 4 months ago

Ho nice!!! I'm curious to see how you read mobtype and how you populate info on class system. About the decryption of these number I just fucking don't know.

Prapilk started an sheet to help.. Google sheet

If you want edit, ask permission i'll give acces

DavideRei commented 4 months ago

I will propose my PR when its ready, i'm trying to handle all the different cases