I finally managed to get around and "finish" a small gadget (see attached file) for the map Core Platform.
It takes units that somehow manage to enter the voidground/voidwater zones and throws them into the void using movectrl (*). After a short time of falling and tumbling, the unit is destroyed (without wreckage).
*except units with "canFly" in unitDefs: they are pushed up a bit
When the unit is destroyed, I would like to have a visual and audio effect. Audio works well.
For the visual, I tried one of Forb's CEG effects. Unfortunately, this is only visible as long as it happens above the lowest level of the map (total black in the heightmap); even with all ceg visibility options enabled. If the unit is destroyed further down, the effect not visible anymore (but the falling unit is).
Since it needs some falling time/distance to look good, I basically ruled out modifying the height map levels that much.
So -after maybe too much introductory explanation- is there a way to have an effect displayed below the lowest map level?
[solved] Visual effect below ground (voidground/water)
Moderator: Moderators
Re: Visual effect below lowest map level (voidground/voidwat
Sure you have underwater=true for visibility conditions? Exact ceg would be useful.
This looks related: https://github.com/spring/spring/blob/9 ... r.cpp#L104
Seems it is no possible to spawn a CEG below the terrain.
Your map does voidground and partly transparent terrain etc but I see no exceptions for that. (Whether the effect would 'in theory' be visible does not matter when it never gets spawned.)
Did not test but should be easy to confirm or refute like this:
Spring.SpawnCEG ("bla", x,Spring.GetGroundHeight (x,z),z)
then change it to see if it still spawns if the coordinates are a little lower:
Spring.SpawnCEG ("bla", x,Spring.GetGroundHeight (x,z)-10,z)
This looks related: https://github.com/spring/spring/blob/9 ... r.cpp#L104
Code: Select all
const float altitude = height - groundHeight;
if (altitude < -1.0f) {
/* underground! don't spawn CEG! */
Your map does voidground and partly transparent terrain etc but I see no exceptions for that. (Whether the effect would 'in theory' be visible does not matter when it never gets spawned.)
Did not test but should be easy to confirm or refute like this:
Spring.SpawnCEG ("bla", x,Spring.GetGroundHeight (x,z),z)
then change it to see if it still spawns if the coordinates are a little lower:
Spring.SpawnCEG ("bla", x,Spring.GetGroundHeight (x,z)-10,z)
Re: Visual effect below lowest map level (voidground/voidwat
Can't post the ceg script right now since not at home; will do later. But underwater is definitely true.
I had tested the y level from which on it isn't displayed anymore by changing the y position manually. And the limit is y=-90 which is the minheight of the map (and at that place also the ground level).
I don't insist on using a ceg effect; I just thought it might be the easiest way. But any method to give some small visual feedback is OK for me (*). And since I am not very familiar with spring lua scripting, I am looking for suggestions which method could be used
* It doesn't even have to be performance optimized, since this situation does only happen very, very rarely.
I had tested the y level from which on it isn't displayed anymore by changing the y position manually. And the limit is y=-90 which is the minheight of the map (and at that place also the ground level).
I don't insist on using a ceg effect; I just thought it might be the easiest way. But any method to give some small visual feedback is OK for me (*). And since I am not very familiar with spring lua scripting, I am looking for suggestions which method could be used

* It doesn't even have to be performance optimized, since this situation does only happen very, very rarely.
Re: Visual effect below lowest map level (voidground/voidwat
I think only part that matters is if the CEG is spawned above terrain or below terrain.qray wrote: And the limit is y=-90 which isthe minheight of the map (and at that place alsothe ground level).
(at least if that altitude check is correct part of engine)
It might be worth a feature-request to allow to call SpawnCEG() with below-ground coordinates: if some gadget does that then engine should just assume there is a good reason

For example when the ground is invisible or even if just to see only the top part of effect clip through terrain.
Spring's Lua GL drawing does not care if it something is under terrain, so can use that. Maybe a billboarded sprite with a "flare" texture that fades out or something would already look okayish.But any method to give some small visual feedback is OK for me
Re: Visual effect below lowest map level (voidground/voidwat
Dirty hax available i think:
1) Write a ceg that takes the damage operator to shift the position of the second phase, a spawner.
2) Spawn the ceg via gadget while specifying damage = depth.
Alternatively second phase could be not a spawner but some other projectile class. Unsure if this woudl work at all.
1) Write a ceg that takes the damage operator to shift the position of the second phase, a spawner.
2) Spawn the ceg via gadget while specifying damage = depth.
Alternatively second phase could be not a spawner but some other projectile class. Unsure if this woudl work at all.
Re: Visual effect below lowest map level (voidground/voidwat
I know this may seem like a hacky workaround, but it might make sense. You need to be using 16bit raw for heightmap in this case as you would lose too much precision otherwise.
Set one pixel (bottom right, or whichever, just make sure its not top left (x=0,z=0)) to be absolute black, and shift the rest of the heightmap up by 50%.
Set one pixel (bottom right, or whichever, just make sure its not top left (x=0,z=0)) to be absolute black, and shift the rest of the heightmap up by 50%.
Re: Visual effect below lowest map level (voidground/voidwat
Just for completeness: as promised above, the ceg script is attached to this post.
Thanks for all the suggestions!
Since Anarchid's proposal seems like a hack (sorry
) with unsure outcome and Beherith's idea would involve quite some effort(*) and still be limited depth wise and not cover the slope areas close to the visible grounds, I think I will give the GL solution proposed by 8611 a try.
Since I am really new to (Lua) GL and the wiki page lists all the functions but not much explanations, do you happen to know a simple example or some introduction which you could point me to?
Originally, my idea was to have some visual effect similar to switching off an old CRT TV (like when switching off an Android smartphone).
(*) height map is made manually in inkscape and krita
You're right. It's only above/below ground. Which just coincidentally is the same at this position in the map.qray wrote: And the limit is y=-90 which isthe minheight of the map (and at that place alsothe ground level).
Right. Or maybe an additional option to trigger below surface visibility?!8611 wrote: It might be worth a feature-request to allow to call SpawnCEG() with below-ground coordinates: if some gadget does that then engine should just assume there is a good reason![]()
Thanks for all the suggestions!

Since Anarchid's proposal seems like a hack (sorry

Since I am really new to (Lua) GL and the wiki page lists all the functions but not much explanations, do you happen to know a simple example or some introduction which you could point me to?
Originally, my idea was to have some visual effect similar to switching off an old CRT TV (like when switching off an Android smartphone).
(*) height map is made manually in inkscape and krita
- Attachments
-
- blue_explosion.lua
- (13.4 KiB) Downloaded 4 times
Re: Visual effect below lowest map level (voidground/voidwat
*if* CEG never can get spawned under the ground the making some random pixel superdeep like Beherith suggest would not do anything.
For GL details better to trust wiki or some tutorial but something like this works:Since I am really new to (Lua) GL and the wiki page lists all the functions but not much explanations, do you happen to know a simple example or some introduction which you could point me to?
Code: Select all
function widget:DrawWorld()
gl.PushMatrix()
gl.DepthTest (true)
gl.Texture("bitmaps/wake.png") --this texture that exists in BA
gl.Translate(100,100,100)
gl.Billboard()
gl.TexRect(0,0,50,50)
gl.PopMatrix()
end
Re: Visual effect below lowest map level (voidground/voidwat
Thanks for the input! 
Already started on the side reading some basic OpenGL introductions. Will see what I can cook up.
With luaGL it will be probably also more reusable for other maps without adjustments...

Already started on the side reading some basic OpenGL introductions. Will see what I can cook up.
Yes, I would have had to change the complete ground in the void to superdeep - which admittedly would not have been very complicated if you touch height map anyway; but as mentioned above, this would have still left the (steep slope) transition borders uncovered.8611 wrote:*if* CEG never can get spawned under the ground the making some random pixel superdeep like Beherith suggest would not do anything.
With luaGL it will be probably also more reusable for other maps without adjustments...
Re: Visual effect below lowest map level (voidground/voidwat
Found some time to implement it in the gadget and it works like a charm!
Thanks again!

Thanks again!