Author Topic: Coding  (Read 9424 times)

Fluffy203

  • Guest
Coding
« on: 22 March 2010, 03:54:23 »
Ok coding is so much more fun that any other type of modding , but now i'm curious can i make the system recognize what unit is fighting which unit and make it create a death animation?

Zoythrus

  • Guest
Re: Coding
« Reply #1 on: 22 March 2010, 04:05:08 »
i dont entirely understand what you mean...

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Coding
« Reply #2 on: 22 March 2010, 04:59:42 »
Yah, explane more...  :|
Get the Vbros': Packs 1, 2, 3, 4, and 5!

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Coding
« Reply #3 on: 22 March 2010, 19:43:38 »
You mean like, making it so the engine knows your Archer just got hit by a Behemoth, so he plays a special death animation where he gets flattened?

Gabbe

  • Guest
Re: Coding
« Reply #4 on: 22 March 2010, 20:30:01 »
i think dh got it...

Zoythrus

  • Guest
Re: Coding
« Reply #5 on: 22 March 2010, 20:48:33 »
Stronghold:Crusader did this, the guys who were shot with an arrow used a death anim of them dying with an arrow through them

Fluffy203

  • Guest
Re: Coding
« Reply #6 on: 22 March 2010, 21:18:44 »
Oh yeah thats what i'm talking about , that is going to be sweet  :D

Hectate

  • Guest
Re: Coding
« Reply #7 on: 22 March 2010, 22:33:03 »
The system already recognizes the TYPE of damage dealt (for use with armor types), why not just add different outputs when death is a result of one of these types? That'd be a start. I'm not sure how much more difficult it would be to add unit types. You'd need variables in the XML of course.

Fluffy203

  • Guest
Re: Coding
« Reply #8 on: 22 March 2010, 23:01:56 »
exactly thats a good start , but i would much rather have it more user friendly such as the user can input it in there like

<death animation>
   <unit attacker name="blah"/>
   <anim-speed value="55"/>
   <animation path="models/snatcher_standing.g3d"/>
   <sound enabled="false"/>
</death animation>
   

That is what it will probly look like in the xml for user friendly and easy to mess with  ;D
   

Zoythrus

  • Guest
Re: Coding
« Reply #9 on: 22 March 2010, 23:15:55 »
howabout

<death animation>
  <attack type>
     <type name = "slashing">
     <type name = "piercing">
  </attack type>
  <anim-speed value="55"/>
  <animation path = "models/spearman_dying_sword.g3d"/>
  <sound enabled="false"/>
</death animation>

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Coding
« Reply #10 on: 22 March 2010, 23:17:25 »
No, Fluffy's method is better. ::)

Do I really have to explain why?
Egypt Remastered!

Proof: Owner of glest@mail.com

Zoythrus

  • Guest
Re: Coding
« Reply #11 on: 22 March 2010, 23:19:30 »
but what if you wanted the same animation for more than one attacker? then it would group all of the "slashing" and "piercing" deaths together

Fluffy203

  • Guest
Re: Coding
« Reply #12 on: 22 March 2010, 23:38:50 »
then just copy and paste it lol , i'm going to see how i can get this in action cause that is what i want in game , so let me get on this  ;D and my way is more simplistic even though yours incorporates the attack types , i'd much rather it be controlled by which attacked it is , but if you don't put a specifc unit in there it will just null out the rest of the code and play the reg death animation  ;D

Zoythrus

  • Guest
Re: Coding
« Reply #13 on: 22 March 2010, 23:52:58 »
but then, if you added your mod to another one (like as a mod pack), it would be easier just to add the weapon types

Fluffy203

  • Guest
Re: Coding
« Reply #14 on: 23 March 2010, 00:38:47 »
lol i think my way is more simply the attack types could come in handy such as if hit with impact type make the animation expolde him , but idk still probly going with my way

Hectate

  • Guest
Re: Coding
« Reply #15 on: 23 March 2010, 02:14:48 »
One thing you'll have to consider is other mods. What happens when a "Oompa-Loompa" hits your guy with a arrow? Sure, the "killed by archer" animation would be perfect - but the game will never know because he wasn't killed by an archer.

Using damage types can account for new and different mods, since to be compatible you have to have similar damage and armor types.

I'd recommend a hybrid approach that uses both. Give specific killed-by-unit deaths priority over damage-type deaths. That way if a Behemoth flattens your guy, then you have your special animation. But if I make a mod with a Mecha walker that can do "crushing" damage, the guy still gets flattened.

Fluffy203

  • Guest
Re: Coding
« Reply #16 on: 23 March 2010, 02:19:08 »
I love your way and i'm now working on this , but for not being the best coder it may take some time guys , right now i'm trying to get the DeathAnimationSkillType to first get all of the animations stuff you know the basics , animation speed , speed and sound. What i think will be the hardest is having the unit recognize what unit/type of damage it is taking , so bear with me guys this might take some time  ;D

Can an experienced coder help me out here , how would i have the system register that the attacker that is attacking is indeed the right unit or have the system register that the attacker is using the right attack type anyone?

What i think i have to do here is A) create a deathanimation skill type in the header which i've done B) i'm coding it in the cpp right now. C) Create an attackertype which will be defined with the attacking units attacktype then bool if true then play the animation if else then play regular death animation sound right ?
« Last Edit: 23 March 2010, 03:07:04 by Fluffy203 »

Zoythrus

  • Guest
Re: Coding
« Reply #17 on: 23 March 2010, 03:20:36 »
I'd recommend a hybrid approach that uses both. Give specific killed-by-unit deaths priority over damage-type deaths. That way if a Behemoth flattens your guy, then you have your special animation. But if I make a mod with a Mecha walker that can do "crushing" damage, the guy still gets flattened.

i can agree with this...this has my approval  :thumbup:  (not like that means much or anything)

Fluffy203

  • Guest
Re: Coding
« Reply #18 on: 23 March 2010, 03:27:54 »
I'm going to try to make it hybrid , but at first i'm going with your approach anyway using attacktypes since its already there and very compatiable with other mods , then i'll stack on the other bool If Attacker= blah then do death animation , if not the attacker unit then look for the attackertype then produce death animation , if attacker unit =null then produce regular die animation  :thumbup:

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Coding
« Reply #19 on: 23 March 2010, 13:01:07 »
Also, on top of the hybrid, make it so a unit can be killed by two units and use the same animation, basically just make it so you can put multiple unit names in each death tag. :D
Egypt Remastered!

Proof: Owner of glest@mail.com

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Coding
« Reply #20 on: 23 March 2010, 15:56:54 »
This sounds cool, but will we need to add an attacker value to every xml that is out there?
Get the Vbros': Packs 1, 2, 3, 4, and 5!

Fluffy203

  • Guest
Re: Coding
« Reply #21 on: 23 March 2010, 20:58:41 »
i'm going to try to workaround with the damagemultiplier and get the attack types that way to make teh deathanimantion occur , but if i go hybrid yes you will ahve to have the <attacker name = "blah/>

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Coding
« Reply #22 on: 24 March 2010, 01:40:03 »
I haven't had time to read through this whole thread, but a couple of comments on things I did see...

1. There is no need for a new skill class. Just use 'die' with some additional parameters.

2. You can get the Unit who did the killing very easily, see UnitUpdater::damage()

Cheers.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Fluffy203

  • Guest
Re: Coding
« Reply #23 on: 24 March 2010, 02:00:46 »
You are so Awesome silnarm , if there was a rep system you would have my full support  ;D ;D ;D ;D

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Coding
« Reply #24 on: 24 March 2010, 13:01:01 »
Quote
I haven't had time to read through this whole thread, but a couple of comments on things I did see...

1. There is no need for a new skill class. Just use 'die' with some additional parameters.

2. You can get the Unit who did the killing very easily, see UnitUpdater::damage()

Cheers.

:thumbup:
Egypt Remastered!

Proof: Owner of glest@mail.com