Tint Effect Tech Demo

Exhibition Tech Demo - Tinting c40d731

No permission to download
Projects meant as a technical demonstrator or instructional tutorial.

DCurrent

Site Owner, OpenBOR Project Leader
Staff member
This module shows scripted tinting in action and provides everything needed to install it into your own projects.

Tinting is a powerful drawmethod feature that allows you to overlay colors on sprites in real time. It has tons of uses, and compared to remaps is a more elegant solution for special effects like freezing, shocks, burns, poison, etc. You'll save yourself a ton of time and get cooler looking effects in one stroke. See the included readme for details.


DC

Update 2015-05-13:

  • Spelling correction in script comments.
  • Different color mix for freeze. Really makes it stand out more.
  • Kula's sprites replaced with .png and up to date palette commands.
 
Thanks gents! There's a lot more where that came from and more elegant ways to implement it - I just tried to keep things basic so others could plug n' play.

I'll try and upload more of these mini demos as time goes by.

DC
 
Thanks for the demo DC.

This kind of mini demo is a great way to show a feature and how it works ingame.
 
Uploaded new version with some minor updates. See first post.

1uidbor_-_0001.png


DC
 
I'm against using scripts in update.c or updated.c cause they hog everything and slow down gameplay, i would prefere to have something like this hardcoded so it works only when command is included in pain animation , cause it runs all the time even if effect is not active, thats just totally upside down.Ive seen slowdowns happening because of simple stuff like text displayed using updated.c , i dont know but for me using something like this which runs all the time is last resort if everything else fails.
Some stuff need to be run in updated because it needs to last certain amount of seconds, maybe it would be better to include timer in scripts so when it will reach 2 seconds or so then script will be disabled/turned off.
Its easy to add drawmethod and tint to burn animation and its not a big deal, the only problem is with freeze animation , it would be nice to set tint color for freeze in header instead of picking light blue palette for it.
Something like freezetint  0_150_250
And you wouldnt have to use freeze palette and hide it etc. cause character would be tinted automatically, there also could be separate flag which alpha blending we would like to use for it.
 
bWWd said:

This is not hardcoded for the very reason you stated about updated.c scripts. Anything hardcoded eats resources too, except for everyone, whether the author chooses to use the functionality or not. Aside, the engine does have a hardocded solution with remaps if you want to go that route. Scripted tints just happen to be an improved option.

Now as for updated.c, I was more than clear that updated.c is not the optimal way to apply tints, and that it isn't the method I use myself.

Damon Caskey said:
There's a lot more where that came from and more elegant ways to implement it - I just tried to keep things basic so others could plug n' play...

In case it matters, I use takedamagescript to bind a temporary entity. That entity does double duty of providing the extra visual effects and controlling tints. It's simple, efficient, and effective - but also well beyond what most neophyte authors are capable of understanding.

I intentionally coded this to use updated.c so it would be simple for those less experienced authors. Not just for ease of use, but so they can grasp the concept and get started doing things for themselves. It wasn't made for you (as in, someone who already knows how to write advanced scripts), and I honestly don't understand why you're complaining about it.

DC
 
bindentity serves only as timer so how about implementing something for scripts that would make this hackaround with bindentity obsolete, all we need is timer for script to be active and then unactive/removed after timer will reach certain amount of seconds specified in script.
This timer could also be used to display text strings for certain amount of seconds cause they need update.c as well cause in practice its a waste of resources to run checks on every frame of gameplay and check if script should or should not be activated.
There has to be better way to do stuff like this and time based scripts could be solution.
 
bWWd said:

You make good points, but all of these things are already taken care of by the tools available.

bindentity serves only as timer so how about implementing something for scripts that would make this hackaround with bindentity obsolete..

It depends... I don't just use bindentity because I need a timer. It's there for the visual effect (flames, frost, electricity, whatever). I consider binding something to be perfunctory for effects, because tinting alone can't really sell it. The fact it can also serve as a controller/timer is just free gravy.

This timer could also be used to display text strings for certain amount of seconds...

Text objects don't need an update script, and they already have a built in set and forget timer.

There has to be better way to do stuff like this and time based scripts could be solution.

As for other things, you bet that timers are super useful, but adding a timer to scripts doesn't warrant hard coding. What you are asking for is an update.c that only runs for a short time and then stops. But you can already do that yourself:

Code:
time_current    = openborvariant("elapsed_time");
time_expire     = getindexedvar("time_to_expire");

// If no time is set or has expired we exit.
if(!time_expire || time_expire < time_current) return;

//...do stuff...

There are even predefined oncreate() and ondestroy() functions that can be used to set things up and clean them.

If we were to put script timers into the engine, it would look and work 100% exactly like this. A hard coded version won't be any faster, so there's no reason for us to add one.

DC




 
But there can be only one update.c , you cant have like 4 of them one after another and then disable them, what bugs me is that checks are performed in update that slow down everything even if script executed if check returns "true" isnt activated, all 'false" returns slow everthng down and thats just weird way to code stuff, i dont need to run checks all the time during gameplay, i just need something like update script with its own timer working similar to lifespan feature, i would like to just get rid of that constant checking in update.c , now only way is to use workaround with bind entity which isnt even meant to be used like that, simple solution could be finally implemented for convenience.
Even something simple like "blinking every second" effect cant be done without bindentity or update.c .
There is something wrong with update.c that slows gameplay, i dont know what it is but i stay away from script that runs on every frame, ist just wrong to use it for that tint effect like in your example, that effect  is supposed to run when enemy gets hit but update runs on every frame of the gameplay checking if enemy got hit and if its supposed to add effect or not, that is wrong and timer could solve that problem.
 
Hey DC quick question have you tested this script with the zoom script? I think because the tint script is controlling the engines drawmethod it cancels the effect of zoom and all other drawmethod functions such as scaling and transparency. I know you stated you use a more complex version in your personal mod so I didn't think you would have the same issues
 
I have and they work perfectly together. I've seen the way you've tried to put in the zoom effect function - it's not correct at all. You need to look into how function calls work. There are plenty of examples.

DC
 
nsw25 said:
this ruins alpha settings, drawmethod settings and also positioning of platforms.... why am I the only one experiencing this ?

Don't worry your not the only one, it does affect drawmethod because i tested it on my mod.
 
I am confused why would anyone use this scripted version over the hardcoded tint built into the engine ?
 
I tested this and tested it some more, and had no problems with it interfering. I'll look into that with more depth.

@msmalik681, the tint is being set in response to conditions. In this case burning or freezing. That's impossible using the hard code command and wouldn't be nearly as dynamic even if you could do it. If you haven't tried the module, play it and watch how the freeze has a graduated thaw effect.

DC
 
nsw25 said:
DC If you like I can send you a small demo of mine without the tint which you can then apply tint to test and you will see the various changes it does.

Sure. Will see what I can do.

DC
 
Back
Top Bottom