Renegade Projects Network Forums

Full Version: MagnaBeamColor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A feature that required me a long time to finally get working: altering the magnetic beam colors!

The way it works is simple.
You add two tags to your magnetic beam weapon:
Code:
IsCustomColor=yes
MagnaBeamColor=192,160,0

This will result in some kind of orange.

There is something pretty weird about all this though, which however brings an advantage with it as well.
Yes, this tag does take RGB colors, but they don't really work as the RGB we know. It's hard to explain, I'll just tell you the effects of it.

Negative effects:
- values below 160 are as good as useless
- the color intensity grows exponentially... 224 is MUCH more than 160
- you can't do any color you want, but you are restricted to about 64 colors

The last effect isn't necessarily a negative one. You can of course have more colors than a rainbow gives you.

Positive effect:
- the brightness of the color controls the translucency
- it is done, I wouldn't have any coding left to do

And this positive effect is what leads me to this discussion.
255,255,255 would be pure whiteness, no translucency at all, while 160,160,160 lights things up slightly.

I will post screenshots asap (too tired right now).
What I want to know: do you prefer full RGB control with a fixed translucency or can you live with less colors and want to be able to have control over the translucency?
Hmm, im not much of a YR modder, but i think something like MagnaBeamColor= with full RGB control, and maybe a MagnaBeamTranslucency= for the translucency...

Just my views Smile
I don't quite know why I did not think of this yet, but it is certainly a good idea.
And since I have the input color and can calculate the output color any way I want, generally this would be possible.

The only problem there might (I really doubt it) be a little performance drop.
Tests will tell.
How about control of beam direction, the current magbeam moves away from the target towards the attacker when the unit is a vehicletype and also does so in the npatch clone of the weapon too.
A difference between buildings and vehicles you say... very interesting.
I didn't ever notice that...
If I can find out how to control this (probably easy since I can make out building/vehicle identification easily), I will of course make it customizable!

Also, you may wonder what's up with the sonic beam.
I may introduce the same code for it so it works with custom colors as well. Of course, the "MagnaBeamColor" name would be reduced to be called "BeamColor", I don't want thousands of different tag names.

I'll also try to do shape modification, it's all a matter of deep research, because the drawing code looks pretty complex.
Well, the poll is obsolete now due to TSHyper's proposal, which I have been working on for the last hour.
I modified the blending routine, you can now give it an RGB value and specify an alpha value between 0 and 1 (percentage if you want).

What I need to find out now is what alpha value the original had, the color should be 176, 0, 208 (calculated from the original blending code).
This new code should also allow me to code IsHouseColor for magnetic beams.

What I want to ask you about is performance.
I tried 12 magnetrons fire at the same time and got a FPS drop, is this normal?

My code uses the x87 floating point intruction set so it should be fast, I hope it's not that that causes the performance drop.
Triple post FTW! >.<

Magnetic beam code is pretty much completed, save for extras like IsHouseColor support or special effects like a negative beam...
I had been trying to find the original color and alpha, no go though, especially since the alpha varies over the beam slightly. So instead, I made it so that if IsCustomColor is set to "no" (default), it will use the good old original blending code.

As for sonic beams (I'm just realizing they exist as well), I will look into making them support custom colors as well.
If I convert my MagBeam blending to a standalone function (won't be too hard I think) this will be a piece of cake.

The wave (general term for the beams that WW used) files will be closed after that, until I figure how to modify their shape. I might already know, however, making them customizable, which would be the ideal goal, I believe is pretty hard... so if I manage to do it, expect new presets rather than polygon defining INI tags for custom shapes Unhappy
So we will be able to customise 1. The mag beam and 2. The dolphin sonic beam and/or the TS sonic beam?
Exactly Smile
MagnaBeamColor=R,G,B (numbers between 0 and 255)
MagnaBeamAlpha=(percentage between 0.0 and 1.0)
MASSIVE BUMP... I know but I had a thought. What about beams that you want to be solid until you cancel the attack mission? Like for instance the Microwave Tank from Gens/ZH. It's solid until the attack issue is canceled or the target is destroyed. As I recall, each time the ROF fires, the game draws a new beam.

If I'm not explaining it right, apologies but I'd like a solid beam-type weapon as well.

In b4 use low ROFs. >_>