Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Mar 28, 2024 11:19 am
All times are UTC + 0
Add AlphaImage to firing anims
Moderators: Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [17 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
kenosis
Commander


Joined: 19 Aug 2009
Location: Moscow State University

PostPosted: Sun Dec 14, 2014 4:19 pm    Post subject:  Add AlphaImage to firing anims Reply with quote  Mark this post and the followings unread

Only alphaimages on PARTICLE SYSTEMS can be erased in RA2.
Thus we use an empty anim to detonate a warhead, use that warhead to trigger an particle system, to let it display its alpha image. And use next to link the dummy anim to the real one you wanted.

Simple logic.

Why not AttachedParticleSystem on weapons?
If you are using a weapon that uses railgun for damage, or a FireStream that indicates the trace of projectile, or any other particle systems. In that case light remains until the particles fade out.

Why not directly add warhead and damage to the anim itself?
Then lights will remain the same until the anim ends. Looks a bit strange for me. You can use it anyway.

Why damage on the anim?
If no damage is used, the warhead wont be applied. Set warhead verses to avoid real damage.



*************THE RULES PART PREPARED THE ALPHA IMAGE**********


Particle system:
[IsslySystem]
HoldsWhat=IsslyParticle
BehavesLike=Smoke
Lifetime=1
AlphaImage=smallexp            ;  CHANGE THIS FOR DIFFERENT ALPHAIMAGES



Particle:
[IsslyParticle]
Image=INVISO
BehavesLike=Smoke
MaxEC=3                ;THIS DECIDES HOW LONG ONE FLASH WILL LAST


Edit your Fire2 warhead. It is default warhead for all animations' damage and cannot be changed without patch. If you use patches, you can name any warhead.
[Fire2]
Verses=5%,5%,5%,5%,5%,5%,%,5%,5%,5%,5%
Particle=IsslySystem



***************SOME EXTRA EFFECT*************************
[HE]
Particle=IsslySystem     ;So you add this effect to debris. Just a sample.







*************AND IN ART YOU PUT THE ALPHA TO USE*************
Art:
[AnimThatYouGiveToTheWeapon]   ;ANIM THAT YOU GIVE TO THE WEAPON
Image=INVISO
Next=TheRealAnimYouWanted   ;THE REAL ANIM YOU WANTED
Damage=1
;Warhead=YourWarhead if you are using patches.






Edited: Removed tags that has no effect.



15.gif
 Description:
 Filesize:  362.28 KB
 Viewed:  29971 Time(s)

15.gif



smallexp.shp
 Description:

Download
 Filename:  smallexp.shp
 Filesize:  3.87 KB
 Downloaded:  445 Time(s)



Key Words: #Tutorials #Modding #RedAlert2 #YurisRevenge #Rules.INI #Art.INI 

_________________
Tired of grabbing my random SHP conversions? Why not learn to create SHPs for yourself?

Last edited by kenosis on Mon Dec 15, 2014 5:54 pm; edited 13 times in total

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account Yahoo Messenger Account
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Sun Dec 14, 2014 4:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

For a tutorial you should explain a bit more the necessary keys.
Also remove the keys that are not necessary.
e.g. on the Particle you don't need all the damage stuff (your translucent keys on the particle also make it unnecessary CPU-heavy)

much shorter is this code (copied from TI)
Code:

;the particle system
[AlpMuzzleTNYSys]
HoldsWhat=MuzzleLight
BehavesLike=Smoke
AlphaImage=ALMUZTNY
ParticleCap=0
Lifetime=2

;the particle shared by all PS's using AlphaImage
[MuzzleLight]
BehavesLike=Smoke
MaxEC=2
Image=CLRANIM ;a dummy SHP with 10 empty frames


The title is also confusing, since it says "firing anims" while this tutorial shows how to add them to normal anims like explosions.

For firing anim (ie muzzle flash) use
AttachedParticleSystem=AlpMuzzleTNYSys
on the weapon of the unit

_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
kenosis
Commander


Joined: 19 Aug 2009
Location: Moscow State University

PostPosted: Sun Dec 14, 2014 5:05 pm    Post subject: Reply with quote  Mark this post and the followings unread

No lag since it uses inviso. Not the tag that lags but huge translucent animations.

And enough of necessary explanations on how to adjust the duration. What else to be said? The whole logic is also explained——so one would easily understand the logic and write own(if he doesnt want to copy paste)


Also this is a different method from TI. What if you use something that need particle's existence?

Quote:
The title is also confusing, since it says "firing anims" while this tutorial shows how to add them to normal anims like explosions.

So firing anims are not normal anims? And the light on debris explosions art attached to the WARHEAD, another different thing.

_________________
Tired of grabbing my random SHP conversions? Why not learn to create SHPs for yourself?

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account Yahoo Messenger Account
ApolloTD
Commander


Joined: 19 Nov 2003

PostPosted: Sun Dec 14, 2014 5:44 pm    Post subject: Reply with quote  Mark this post and the followings unread

You should use TI method of using alpha in system primarily so you don't have to draw or process actual subparticle which is less laggy approach (ParticleCap=0).

Only reason for using subparticles for alphas is when you need to form animated alpha via particle links requiring Gas type system then.

Back to top
View user's profile Send private message
kenosis
Commander


Joined: 19 Aug 2009
Location: Moscow State University

PostPosted: Sun Dec 14, 2014 6:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

No. If you use railgun and a long lasting particle for it, what you will get? The flash remains until all particles fade out.

One frame empty animation+ inviso particle wont lag at all.(due to my tests)

I doubt Smoke particle causes lag than Fire is because in this case alpha stays a bit longer and overlaps. If the alpha is in huge size like TI nuke then it lags of course.

_________________
Tired of grabbing my random SHP conversions? Why not learn to create SHPs for yourself?

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account Yahoo Messenger Account
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon Dec 15, 2014 11:11 am    Post subject: Reply with quote  Mark this post and the followings unread

kenosis wrote:
No. If you use railgun and a long lasting particle for it, what you will get? The flash remains until all particles fade out.

Go more into detail. It's hard to follow your mental leaps.

a) It's correct, when using railgun logic, you can't add this as an additional ParticleSystem, since only 1 PS can be applied to a weapon.
Your initial tutorial however is not made for firing anims, but for explosion anims (2 different things).
So you should explain/make clear that your tutorial is for the general case of animations and not for the special case of firing anims. This is where the confusion starts: title and content don't match.

For firing anims you can simply assign directly AttachedParticleSystem. (though indeed not in the case when you use railgun logic)
For explosions you add the warhead to the art.ini animation.

So by following your tutorial you can indeed use a dummy animation that uses this alpha PS on its warhead.
railgun weapon-> Anim=DummyAnim -> DummyAnim with warhead -> warhead with PS -> PS with alphaimage

However this has absolutely nothing to do with the fact that your code example has way too many keys and is CPU-heavy.

b) when attaching it to the railgun, you of course have to add the alphaimage to the railguns PS and thus it will of course be played as long as the particles. But that's a different story and has nothing to do with this code for an Alphaimage PS.

kenosis wrote:
One frame empty animation+ inviso particle wont lag at all.(due to my tests)

Tests on your one PC don't tell a lot.
My 3 PCs are also lag-free from AlphaImages and OneFrameLight logic, but others in the TI team have extreme lags by these. Thus my tests didn't show anything.

A small scale test with only 5 to 10 anims/PS playing at the same time also doesn't tell anything about real battles with several hundred anims being played, or any online gameplay where synchronization might also play a role.

kenosis wrote:
I doubt Smoke particle causes lag than Fire is because in this case alpha stays a bit longer and overlaps. If the alpha is in huge size like TI nuke then it lags of course.

It's not the BehavesLike type that can lag, but how you configure it.
In your case unnecessary transparency calculations are done, fade-in and out effect calculations, unnecessary damage calculations (as a alpha PS it doesn't need to do any damage) and in general wrong keys are set.

e.g.
FinalDamageState=14
Report=FLAMTNK1
are not used by Smoke type Particles
Damage, Warhead and MaxDC are also not read/used by Smoke Particles, thus you add redundant keys which only confuse the modder who wants to understand the tutorial code. Wrong keys can also lead to unexpected/unstable behaviour ingame.

with EndStateAI=19 you tell the game to render the particle till frame 19 of the INVISO.SHP. this SHP, if it exists at all (i think WW never added it as a SHP file) has only 1 frame.
the other keys like DeleteOnStateLimit, StateAIAdvance etc are obviously only copied into the particle without knowing what they do, because they are completely wrong set and unnecessarily used here.

_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
kenosis
Commander


Joined: 19 Aug 2009
Location: Moscow State University

PostPosted: Mon Dec 15, 2014 12:55 pm    Post subject: Reply with quote  Mark this post and the followings unread

There is significant difference between AttachedParticleSystem on weapons and warhead on an empty animation. Your logic is also weird, since you attach your particle system to the WEAPON, but not the animation. Then it can be any weapon WITHOUT a certain firing anim,  so your logic should be called "alpha upon firing". Firing anim is NOT a special case for general anims. Why it is special?  Because you use it on weapon but not on warhead explosion? NO. Why you specially distinguish FIRING ANIM from ANY ANIM that is used on explosion? The only special anim I know is buildup.

Quote:
So by following your tutorial you can indeed use a dummy animation that uses this alpha PS on its warhead.
railgun weapon-> Anim=DummyAnim -> DummyAnim with warhead -> warhead with PS -> PS with alphaimage


THIS IS EXACTLY WHAT I SAID HERE. JUST PUT THE DUMMYANIM  ON A NORMAL WEAPON.


And for the lag part:
1200 explosions with the alpha shp I gave here slows the game to like in mission. For only one or two seconds.You won't have so many on the battlefield right?

I deliberately made it 2000 lights (noticeable lag) and recorded the progress, well, not by HUMAN EYE to judge, with different settings. The conclusion is that with or without the translucent, damage,warhead,damage state,the system with spawn or not, the number of frames displaying that 2000 flashes remains the same(82 frames as I opened the videos in gif editor). The only thing that mostly affected the process is MaxEC, for how much time the light remains, how many lights used and the alpha itself.
More lights= lagger, more time= lagger, bigger alpha=lagger. Obviously, don't even need this test to show.
I have twenty hundred lights displayed. Twenty hundred damages and transparency, but still no difference.
And test on 5000 alphas. 5000 debris with the same particle,be they with damage, transparency or not, lagged for 266 frames from firing to that all lights are out. Still no difference for the CPU part.

Quote:
unnecessary transparency calculations are done, fade-in and out effect calculations, unnecessary damage calculations


NO DIFFERENCE AT ALL


BTW, inviso.shp is in ww's mix file


But anyway. Extra useless tags is not a good sample. I will edit it.

_________________
Tired of grabbing my random SHP conversions? Why not learn to create SHPs for yourself?

Last edited by kenosis on Mon Dec 15, 2014 1:15 pm; edited 1 time in total

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account Yahoo Messenger Account
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon Dec 15, 2014 1:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

I think i overlooked or didn't put much attention to your last short art.ini entry
[AnimThatYouGiveToTheWeapon]
i took it as a generic random name and thus the confusion started on my end.
the preview is showing mainly explosion anims, 90% of the text is for generic explosion anims
and only the last bit is making the jump back to firing anims.

There is a difference between firing and explosion anims, when you start working with debris, long lasting anims, aircraft getting the animation etc.
Firing anims follow the unit around.
Explosions stay on the same place.


Since i read your title and most of the text was about generic explosions, i was simply missing the much shorter solution using AttachedParticleSystem, which works in most cases too.
This is also shorter/cleaner than the way over art.ini:
art.ini
Weapon->Anim=alphamuzzle ->art.ini alphamuzzle ->warhead -> particlesystem
AttachedParticleSystem
Weapon->ParticleSystem

This way you can also reuse the same alphaeffect for multiple different weapons with each having a different firing anim. This makes it very efficient.
In your case you have to create a new animation for every firing anim and explosion on which you want to show the alphaeffect.

kenosis wrote:
Your logic is also weird, since you attach your particle system to the WEAPON, but not the animation. Then it can be any weapon WITHOUT a certain firing anim,  so your logic should be called "alpha upon firing".

As a tutorial with explaining text, yours should have mentioned things like this in the initial post, so my posts wouldn't have been necessary and caused so much trouble Wink
You know the typical questions a tutorial should answer like: "why do it this way? why not the other way? what are the pro and cons of this way? is there another way? how does it work?" etc

Last edited by Lin Kuei Ominae on Mon Dec 15, 2014 1:20 pm; edited 1 time in total

Back to top
View user's profile Send private message
kenosis
Commander


Joined: 19 Aug 2009
Location: Moscow State University

PostPosted: Mon Dec 15, 2014 1:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
Firing anims follow the unit around.
Explosions stay on the same place.

Laughing  WHY. It's the behavior, I admit they are different but any trick on explosions can be done on firing anims.

_________________
Tired of grabbing my random SHP conversions? Why not learn to create SHPs for yourself?

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account Yahoo Messenger Account
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon Dec 15, 2014 1:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

Let them spawn art.ini debris and you'll understand the difference.

btw, your code is also problematic, since the animation is doing damage and thus damaging the unit that fires a weapon with this anim.

_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
kenosis
Commander


Joined: 19 Aug 2009
Location: Moscow State University

PostPosted: Mon Dec 15, 2014 1:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
Only alphaimages on PARTICLE SYSTEMS can be erased in RA2.
Thus we use an empty anim to detonate a warhead, use that warhead to trigger an particle system.

Quote:
"why do it this way?

Hmm. OK I'll adjust the order.


STILL NO DIFFERENCE. Do you mean if a unit is moving and so the debris spawning point will follow? And is that worthy of any special  distinguishment? Naturally there is no way(except flameguy,then it acts just like firing anim that follows unit,except that it has nothing to follow) to let explosions move. It is not "tags used to work on the anim wont work if you put the anim on another place", which I would call a difference. Or do you mean something else? By SAME I mean
Quote:
"any trick on explosions can be done on firing anims.

Let's stop this meaningless discussion on how they are different or not..... We both know how they behave and how to make use of them.

Damage on anim:
If you set no damage for the anim, the warhead wont be used. 1 damage x 5%=no damage

_________________
Tired of grabbing my random SHP conversions? Why not learn to create SHPs for yourself?

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account Yahoo Messenger Account
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon Dec 15, 2014 2:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

kenosis wrote:
Do you mean if a unit is moving and so the debris spawning point will follow?

yes, and if the anim is played on a certain height due to FireFLH or above water etc.
Depends how important you see the difference. I guess in TS it is a bit more important since there you use art.ini debris a lot more for workarounds than in RA2 for which you get all necessary keys and logics ready-made by the Ares team.

kenosis wrote:
Damage on anim:
If you set no damage for the anim, the warhead wont be used. 1 damage x 5%=no damage

no clue about RA2, but in TS 0.1 damage is still rounded up to 1 damage. Especially Damage on animations it can also calculate values such as Damage=0.01 (e.g. flames and fire) so you have after 1000 frames 10 damage applied to the object. Damage in art.ini seems to accept also float values while in rules.ini only integer is accepted.

_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
Graion Dilach
Defense Minister


Joined: 22 Nov 2010
Location: Iszkaszentgyorgy, Hungary

PostPosted: Mon Dec 15, 2014 5:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

Art.ini debris is often laggy and lacks experience. Which are major issues in RA2.

_________________
"If you didn't get angry and mad and frustrated, that means you don't care about the end result, and are doing something wrong." - Greg Kroah-Hartman
=======================
Past C&C projects: Attacque Supérior (2010-2019); Valiant Shades (2019-2021)
=======================
WeiDU mods: Random Graion Tweaks | Graion's Soundsets
Maintainance: Extra Expanded Enhanced Encounters! | BGEESpawn
Contributions: EE Fixpack | Enhanced Edition Trilogy | DSotSC (Trilogy) | UB_IWD | SotSC & a lot more...

Back to top
View user's profile Send private message Visit poster's website ModDB Profile ID
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Mon Dec 15, 2014 11:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

i think the main reason for the lag is because when art.ini debris are used,
they also get a traileranim (like shown in Kenosis gif in the first post).
Thus the main lag-problem is the traileranim which quickly ten to twentyfolds the amount of played anims.
10 debris lasting for 50 frames spawning every 2 frames an traileranim are 250 anims in total.
Now let 20 explosion with such debris appear and you force the game to play 5000 animations.

_________________
SHP Artist of Twisted Insurrection:  Nod buildings

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
kenosis
Commander


Joined: 19 Aug 2009
Location: Moscow State University

PostPosted: Tue Dec 16, 2014 6:06 pm    Post subject: Reply with quote  Mark this post and the followings unread

The existence of anims is already a a factor of lag.  

Another recoreded test:
5000 debris and keep trailer seperation unchanged, only edited debris,trailer animation and expire animation.

Lag level max: trailer anim visible, debris visible, explosion visible. Took 542 frames until all anims are out.

Lag level 2:trailer anim used inviso, debris visible, explosion used inviso. Took 326 frrames.

Lag level 1.9 all used inviso. As it was hard to decide how the process ends, used mouse frame rate as indicator. Somewhere between 290 and 310 frames mouse anim returns to normal rate. A little bit better. Just a little bit.

If we don't keep the anims in our screen: judging only by mouse frame rate, it makes the progress around 10 frames faster. Considering possible mistakes in human eye judging, this may have no effect at all.

_________________
Tired of grabbing my random SHP conversions? Why not learn to create SHPs for yourself?

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account Yahoo Messenger Account
ApolloTD
Commander


Joined: 19 Nov 2003

PostPosted: Tue Dec 16, 2014 8:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well, LKO I'd just like to add that BehavesLike= type does play its role in defining lag due to hard coded behaviours as game engine itself has to DO the movement instead of the shp having the movement while game would then draw anim that remains in one place technicly.

Just like Smoke has its hard coded behaviour to move the particle upwards and Gas enforces random floating movement the longer the particle remains.

If Particles are used simply as alpha carrier, using wrong type is unoptimal as some of the type processes are still carried out despite dummy image.

Of course, its not necessarily very drastic but does play its impact along any translucency settings, some safeguards can be to set Translucency=0 to enforce always off and ideally NOT using spawns= in system, multiple particle spawns (in effect multiplied alphas) is always more laggy and sadly actual smoke needs this.

Using TrailerAnims on debris is very much not advisable, the lag factor goes drasticly up if the trailer anim is longer than 3 frames even at full speed (900 rate which is default)

Debris without trailers not lag much at all, do run fairly smooth even in high numbers.

Main problem with traileranims is indeed that they have to start a new instance of anim on every frame (if set trailerseperation=1) but game can't erase them as fast given the length of the animation run and this results running quite many animation overlap even in single debris just to give the illusion of trailering smoke etc.

For the record, ARES support for alphas allows erase them even without particle use gladly but it is not always enough ideal Smile

Back to top
View user's profile Send private message
kenosis
Commander


Joined: 19 Aug 2009
Location: Moscow State University

PostPosted: Tue Dec 16, 2014 8:47 pm    Post subject: Reply with quote  Mark this post and the followings unread

But you can still delete maxec on smoke, which makes the light disappear just too fast, like as if the type is fire. The difference between particle types is not noticeable if set the parameters like that and the particle itself is invisible. Anyway since alpha image won't really follow the particle, but refresh the alpha and position, when Next Particle appears......in most cases if it is not used for alphaimage animation, but a simple light, then makes no difference.

_________________
Tired of grabbing my random SHP conversions? Why not learn to create SHPs for yourself?

Back to top
View user's profile Send private message Send e-mail Visit poster's website Skype Account Yahoo Messenger Account
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [17 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.2066s ][ Queries: 14 (0.0128s) ][ Debug on ]