Scripts / Explosions - Possible Using Lua

Author
Message
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 5th Sep 2018 01:29
Hi all

So I opened issue 319 - Explosions - Enhancement Suggestion - on git hub which Lee has marked as an enhancement for Game Guru.

In part:
'The best way to make any game unique is to add custom media - for everything
Now, we have the setting to make an entity explode-able, but it always plays the same decal animation and the same sound.
It would be nice to be able to have an option to assign a sprite-sheet of your choice. That way we can add our own custom effects for when an object is destroyed in-game.'

To me having just one explosion and one audio for this is pretty bland and boring - pathetic in short - sorry Lee , and I know this was probably intended to be developed further but we all know that can take a looong time.........

My LUA skills are basic to say the least, but thought I might give it a crack, so before I go down that path I just wanted to ask:
1) is this doable in LUA
2) is it relatively easy
2) or is it complicated perhaps requiring quaternions or whatever Amen Moses calls them
4) or can Lee just add this to the engine tomorrow - you know it should be there

Reliquia....
aka OldFlak
Intel(R) Core(TM) i3-4160 @ 3,60GHz. 8GB Ram. NVidia GeForce GTX 750. Acer 24" Monitors x 2 @ 1920 x 1080. Windows 10 Pro 64-bit.
PM
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 5th Sep 2018 13:55
1) I do not think so. You need a command which let you create/play a decal on a position. Of course you always can set some decals in the map and hide them. Then before the object is destroyed you can hide the object and send a "message" to the decal that it should play there. But this creates problems if you have more explodable objects which explodes at the same time.
2) No, at the moment not really. It would be better to mod the source for this.
3) I dont know, maybe there is a way with quaterions, but I am not expert in this stuff.
4) Tomorrow? No. Maybe a week implementing and then a lot of testing. If it would be easy, I would add it myself and create a pull request.

Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Sep 2018 16:24
Quaternions are simply a way of calculation rotations in 3d space that doesn't suffer from the drawbacks of Euler angles.

For positioning entities relative to one another they are invaluable but for explosions you need to use decals. Of course for positioning and rotating decals relative to another entity you can use quaternions, I have a thread around here somewhere on that subject.
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Sep 2018 17:54
sure you could fake it with decals but don't forget that an explosion should also impact a force onto the game world if you want it to be really believable - this is one thing the stock explosion does very well.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Sep 2018 14:55
The explosive force part is easy to do in Lua, simply find all physics objects within a specific range, calculate the direction vector from the centre of the explosion to the centre of the object, calculate the force to apply and give them a push.
Been there, done that, got all the T-Shirts!
PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 7th Sep 2018 11:01
Lol - thanks for the replies, my head is already exploding just contemplating attempting the task!

Reliquia....
aka OldFlak
Intel(R) Core(TM) i3-4160 @ 3,60GHz. 8GB Ram. NVidia GeForce GTX 750. Acer 24" Monitors x 2 @ 1920 x 1080. Windows 10 Pro 64-bit.
PM
Bolt Action Gaming
GameGuru Tool Maker
10
Years of Service
User Offline
Joined: 24th Oct 2013
Location: Harrisburg, PA (USA)
Posted: 7th Sep 2018 20:02
On a hyper-basic level:

Place 'exploding entity'. Give it health. Set it to explode=no.
Place a hidden decal with code that specifically checks for a global flag to get set.
Once global flag is set, it shows itself for say, 300ms, then destroys itself.

The 'exploding entity' will then have code that simply checks if it dies, sets the 'unique death flag' to 1 and that will trigger the decal's explosion code.

Similarly you can use the unique death flag to trigger physics pushes in other objects with some minor code adjustments in a nearly identical fashion.

Login to post a reply

Server time is: 2024-04-26 06:54:39
Your offset time is: 2024-04-26 06:54:39