[Gadget] Replace spring default trees with random feature

[Gadget] Replace spring default trees with random feature

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

[Gadget] Replace spring default trees with random feature

Post by Forboding Angel »

Basically the gadget would find spring default trees, and remove them, then replace in those locations, features from a list.

I wanted to do this myself, but tbh I don't really know how. Anyone wanna do it?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: [Gadget] Replace spring default trees with random feature

Post by knorke »

kind of similar:
http://code.google.com/p/conflictterra/ ... ner.lua#96
(replace metalrich features with mineable resources)
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Gadget] Replace spring default trees with random feature

Post by Forboding Angel »

Thanks. That should give me a starting point. I don't actually need this, but I just thought it would be neat to have.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: [Gadget] Replace spring default trees with random feature

Post by Jools »

It's a nice idea, but there are many problems with outsourcing the tree development like this.

First, the behaviour of 3rd party features needs to be completed. I'm thinking mostly of fires and ability of units to demolish them.

Secondly, I think 3rd party features lack the ability of simplifying the structure when seen at large distance, thereby minimising lag. Having 7000 3rd party trees and bushes on a map causes a lot of lag on many systems.

So, in the end, a better solution would be to improve the default handling of trees in the engine. And in general, the correct way to develop the engine in general should be to in-source as much as possible, not to lua it. Why? Because things should be handled by the part that handles it best. Flexibility is overrated.

Well, that's my opinion. Go ahead and disagree.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: [Gadget] Replace spring default trees with random feature

Post by smoth »

Jools wrote:Translation:
You should not use features as the engine trees have lod.
tons of other games have tons of trees and handle them better. It would be better to investigate WHY the features are expensive, how we can get lod on them and move on.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: [Gadget] Replace spring default trees with random feature

Post by Jools »

smoth wrote: other games are expensive
I agree.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: [Gadget] Replace spring default trees with random feature

Post by smoth »

Jools wrote:
smoth wrote: other games are expensive
I agree.
?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: [Gadget] Replace spring default trees with random feature

Post by Jools »

It was just a response to the fact that you used a direct citation style and didn't reproduce my text in verbatim. You got the meaning of what I wrote right, but if you alter the contents you should use indirect style of citation.

Nothing personal, it seems to be a spring forum style that I'm unacquainted with, so I had to respond with my own miscitation.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2700
Joined: 25 Aug 2004, 13:31

Re: [Gadget] Replace spring default trees with random feature

Post by bobthedinosaur »

lod possibly? dont those "other games" use levels of polies based on LOD?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: [Gadget] Replace spring default trees with random feature

Post by jK »

You don't need a gadget for that.
I already told you once you can just override the featuredefs and replace them with models.
And that I already did that for ZK, but never commited it cause the FPS-drop is just too huge currently (tested with trees with 300-500 triangles).
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Gadget] Replace spring default trees with random feature

Post by Forboding Angel »

I already tried that JK, but I didn't have any luck. Moreover, I would like to replace the engine trees with a slew of randomized trees instead of a single model.

@jools, you need to have another look at this: http://code.google.com/p/spring-feature ... 2Ffeatures
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: [Gadget] Replace spring default trees with random feature

Post by Jools »

Cool, a repository of 3rd party features to use. That's all nice, but I'm already using those AD0 trees.

I needed to work a lot more with them though, mainly scale them better and make their hitspheres cylindrical (cylY). I also added a featuredead tag and made them non-blocking.

So what's missing still is the fire gadget and an animation when they are demolished (but I guess that's not so important). I'm still working on the fire gadget.

My concern, and this was what I meant with my previous post, is that if we take a feature that's not a tree and make a tree of it, then spring doesn't anymore know that it's a tree, and all those things have to be made from scratch.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: [Gadget] Replace spring default trees with random feature

Post by jK »

Forboding Angel wrote:Moreover, I would like to replace the engine trees with a slew of randomized trees instead of a single model.
There are like 20 different treedefs, you can give each one a diff model.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Gadget] Replace spring default trees with random feature

Post by Forboding Angel »

Yes, but all of them are so similar (there are only 2 distinct types) that most of us just picked one and used that one all over the entire map.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: [Gadget] Replace spring default trees with random feature

Post by smoth »

Much of that belongs in game logic(as in ba or whatever) not thrust upon all projects
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Gadget] Replace spring default trees with random feature

Post by Forboding Angel »

smoth wrote:Much of that belongs in game logic(as in ba or whatever) not thrust upon all projects
Well... duh. :roll:

It's worth noting that your trees (the ones I used in riverdale) would make nice low poly replacements.

@jk, is there any chance you could point me towards the feature names for these 20 or so engine trees?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: [Gadget] Replace spring default trees with random feature

Post by jK »

Code: Select all

-- $Id$

local DRAWTYPE = { NONE = -1, MODEL = 0, TREE = 1 }

local treeDefs = {}

local function CreateTreeDef(type)
  treeDefs["treetype" .. type] = {
     description = [[Tree]],
     blocking    = true,
     burnable    = true,
     reclaimable = true,
     energy      = 25,
     damage      = 5,
     metal       = 0,
     reclaimTime = 25,
     mass        = 20,
     drawType    = DRAWTYPE.MODEL,
     object      = ((type%4<1)and('tree0.s3o'))or((type%4<2)and('tree1.s3o'))or((type%4<3)and('tree2.s3o'))or('pine.s3o'),
     footprintX  = 2,
     footprintZ  = 2,
     collisionVolumeTest = 0,

     customParams = {
       mod = true,
     },
  }
end

for i=0,20 do
  CreateTreeDef(i)
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

return lowerkeys( treeDefs )

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: [Gadget] Replace spring default trees with random feature

Post by MidKnight »

*golf clap*
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: [Gadget] Replace spring default trees with random feature

Post by Jools »

So no matter which tree is chosen, they have same parameters with regard to:

Code: Select all

height
mass
damage
featureDead
collisionVolumeScales
Some of these trees are bigger, some are small shrubbery. Those paramewters need to be set based on which tree is placed imo.
Post Reply

Return to “Lua Scripts”