Add support for event-driven effects via scripts?

For AI and campaign script related discussions and questions
Post Reply
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Add support for event-driven effects via scripts?

Post by MaNGusT »

Can the gfx effects event be scripted? or is it still hard-coded?
I want to add some effects that will appear in needed events and do some moves. Also I need a parameter - how many times an effect will be repeated or how long an effect will be visible.
Well, I want to add a crater(or fired earth) and some dust in the air on the places where units blow up. Crater will appear at blow and lose transparency over time, dust will just repeat texture animation few times on specified places.

For first time there could be few events like: onUnitDeath, onUnitFire, onUnitMove, onBuildingBlow, etc. where I can set up what files must be placed and its coordinates with the center point in the event center and its appearing time.
Image
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Add support for event-driven effects via scripts?

Post by aubergine »

There's a few extra functions that will be needed to do that sort of stuff - for example fireWeaponAt() and functions to allow basic map editing.

As for stuff dissipating over time, maybe same approach as on weapon trails could be used (the way their smoke fades over time)?

Here's a list of the events currently in the game: Events & Timers

It's currently not possible to directly position objects though, although that's something that would be massively useful for a huge number of things. Eg. if we could place objects, and especially change the texture on them (like we can with skybox to some extent) we could create all sorts of custom effects, weather and a bunch of other stuff.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Add support for event-driven effects via scripts?

Post by MaNGusT »

aubergine wrote:functions to allow basic map editing.
Why? The crater or fired earth effect can be a square model with a transparent borders in texture that will be placed on terrain on unit death event and disappear over time.
Image
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Add support for event-driven effects via scripts?

Post by aubergine »

Because if you add a model to a map, such as a feature, just as a aesthetic thing, it will start to mess with the game mechanics -- ie. it will be treated by the game engine and AIs as an actual object on the map, rather than just a graphic effect.

It would be better, therefore, to have some map editing functions which would allow terrain changes, etc., and those other functions I mentioned to "fire weapon" (in other words, do the weapon explosion effect, which doesn't have to look like an explosion - it can be whatever is desired).

This way a texture change (and possibly even minor terrain deformation) could do the crater effect, and weapon effects could be used to create dust clouds or whatever.

For example, the mine features in NTW were done using weapon fire effect, but with a radar ping as the weapon -- so player would see radar pings where their own mines were. In terms of dust clouds, things like the existing effects shown when a sky scraper is destroyed could be used and so on.

That being said, I really would like some sort of script-driven way to add square models to the map, or more specifically rectangles (don't really need sides for most requirements). The texture could be applied to them through script (filename of a png, like we can do with setSky() function) and their lighting and alpha could be scripted also, along with their position, rotation, scaling, etc. That would facilitate things like your craters and also a bunch of stuff I want to do with clouds.

As a custom object with type EFFECT and not owned by any player, they could be set to be non-blocking, and not treated as an object so they wouldn't affect path finding and so on.

You could then have functions like:

* addEffect(...) // add an effect rectangle to the world, returns the effect object
* enumEffects(...) // get a list of all effect objects in the world, optionally filtered somehow (eg. get list of all Crater effects)
* effectLighting(effectID, ambientRGBA, diffuseRGBA, specularRBGA) // set lighting for an effect
* removeEffect(effectID) // remove an effect
* setEffectPosition(x,z,y, roll, pan, tilt, scale) // change position, rotation and scale of an effect
* setEffectTexture(effectID, texture) // set effect texture (note: due to game limitations, can only update once per 100ms)
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Add support for event-driven effects via scripts?

Post by MaNGusT »

Now I think that it'll be just a waste of time to add this high amount of code. In the end it will look like hybrid effect system with messed up code while to be correct it should be divided onto script-event system and particle effect system.
We don't have the particle engine, so I just thought about something that can be easily added via scripts..
Image
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Add support for event-driven effects via scripts?

Post by Per »

I want to see what I can do in that regard, but it is a bit down on the priority list...
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Add support for event-driven effects via scripts?

Post by MaNGusT »

Per wrote:I want to see what I can do in that regard, but it is a bit down on the priority list...
Oh, your famous to-do list with items long from here to mars. :D
Image
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Add support for event-driven effects via scripts?

Post by aubergine »

Having ability to add rectangle objects, position/rotate/light/texture them would still enable a vast array of new effects, particularly atmospheric effects.

A rectangle would be like single side of skybox, with ability to do those extra things to it. Hopefully not too much coding, but would unleash vast array of new possibilities with very few polys.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Add support for event-driven effects via scripts?

Post by MaNGusT »

and will impact performance because these kind of effects should be calculated on video card.
Image
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Add support for event-driven effects via scripts?

Post by aubergine »

There is no calculation being done though. Eg. If I put a cloud in the sky, it's just a rectangle with image of cloud on it and lighting applied by OpenGL.

I could have dozens of clouds and still be using far less time than a single droid takes to render.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Add support for event-driven effects via scripts?

Post by MaNGusT »

I mean if represent triangle as primitive particle of the effect that will have few parameters as color, brightness, moving speed and direction, etc. that's how particle graphics engines work. They just create a mass of particles which moves, rotates and disappear.
Image
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Add support for event-driven effects via scripts?

Post by aubergine »

Yes, but I imagine introducing a particle engine will bring it's own set of problems to overcome.

What I'm looking for is an interim measure, that would still be viable long term, which is the ability to create a rectangle and put my own texture on it, rotate, position, and light it. And I'm not talking a small particle-sized rectangle, I mean a bigger rectangle that, for example, would have an image of a cloud, or the sun, or or fog of whatever. There are a gazillion effects that can be achieved using just a few rectangles and some ingenuity.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Post Reply