RandomTree ExplosionGenerators

RandomTree ExplosionGenerators

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

RandomTree ExplosionGenerators

Post by Argh »

Basically, I think that ExplosionGenerators need randomized trees, so that we can have more variation per event, instead of all of the randomizations being a single event.

How would it work? Like CExpGenSpawner, RandomTree would allow game designers to call up seperate ExplosionGenerators, but with different functionality:

Code: Select all

[randomtree_example_code_ARGH01]
	{
		class=CRandomTree;
		[properties]
		{
		percentile=10, 50, 40;
		explosionGenerator1=custom:ARGH_RANDOM01;
		explosionGenerator2=custom:ARGH_RANDOM02;
		explosionGenerator3=custom:ARGH_RANDOM03;
		}
	water=1;
	air=1;
	ground=1;
	count=30;
	}
percentile would be a series of comma-delimited numbers, adding up to 100. Each entry specifies the chance of a given event happening.

explosionGeneratorX would be used X times, where X = the number of entries in percentile.

Simple, eh? It really shouldn't be that hard to code (just push the explosionGeneratorX entries to an array, get a random number between 1 and 100, see where it falls, play the Generator), and it'd allow for a lot of really cool randomization!
User avatar
theHive
Posts: 124
Joined: 13 May 2007, 06:54

Post by theHive »

my major suggestion would be not to make the numbers add up to 100, why not make them as a ratio? so 1, 3 would be the same as 25, 75
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

When I read the title, I thought you wanted trees to burn using a random selection of Explosion Generators... oops...

Other than that, I can see this being very useful, especially to make sure that a certain weapon's explosions don't all look the same.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Well, if my freed-from-source ExplosionGenerators becomes what we get... and we get this... well, let's just say that forest fires could become a lot more interesting to watch. Among other things :-)

I don't like the ratio idea, myself, no offense intended.

Almost anybody would understand the idea of making numbers add up to 100% probability. The ratio idea would cause endless stupid questions from modders, and would be no more useful, at a practical level.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Actually the ratio idea closes a hole in your own idea that could be a problem..

For example say I say 20% of the time I want explosion A and 70% of the tim explosion B. What about the extra 10%? Theres no definition as to what todo then is there?

Whereas using the ratio I can use percentages or whatever system I want.

Your own idea falls flat when you want to define more than 100 explosions or want something more specific than 1%
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

But, er... why would you want more than 100 explosions, or less than 1%? I mean... I'm sorry, but I just don't see anybody with that much free time to burn. Not to mention how slowly it'd probably run, if it had to look at that large of an array...
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Guessmyname wrote:When I read the title, I thought you wanted trees to burn using a random selection of Explosion Generators... oops...

Other than that, I can see this being very useful, especially to make sure that a certain weapon's explosions don't all look the same.
You're not the only one >.>
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Argh wrote:But, er... why would you want more than 100 explosions, or less than 1%? I mean... I'm sorry, but I just don't see anybody with that much free time to burn. Not to mention how slowly it'd probably run, if it had to look at that large of an array...
Yeah but maybe you want a 0.5% chance on something? Why not just use floats that add up to 1 or as AF said, ratios? The advantage of ratios is that there is no invalid combination whereas percentages would require that you adjust all values accordingly if you change one.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Well, if you want to bring that in it, why don't we add "critical" explosions..

Bigger AOE, more damage, etc..

Whats the point in having a 1/200 chance for a special explosion, but the expl itself does nothing special itself..
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I can see doing 0.3001, 0.6999, and having the final total have to equal 1.0... that'd make everybody who's really concerned about absolute precision happy, and still be simple for anybody to use.

I don't see any point in the ratios, though- it'd just cause massive confusion, like the dir system, and it'd be less clean mathematically anyhow- think about the size of the ratio problem, and how it'd have to be ordered, in order to result in correct figures, every time the event fired. I'd just make it so that if the events didn't all add up to 1.0, or were higher than 1.0 then if > A + B + C, etc., then C is chosen... simpler and cleaner, and easier to debug when making the generators, too.
User avatar
theHive
Posts: 124
Joined: 13 May 2007, 06:54

Post by theHive »

Argh wrote:...
I don't see any point in the ratios, though- it'd just cause massive confusion, like the dir system, and it'd be less clean mathematically anyhow- think about the size of the ratio problem, and how it'd have to be ordered,|
...
huh? mathematically you calculate the sum once, store it, then run the same routine as your one, but a random number between 1 and x rather than 1 and 100
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Dividing by the sum won't cost major CPU hogs, you known. Normalising allow everybody to use the unit he's most familiar with, fractions of 1 for one, percentile for another, etc... forcing the sum to add to a certain number would add massive confusion and massive math dirtyness because then what happens when the sum doesn't add up becomes unclear. Just let coders code it to be normalised, but keep thinking of it as percentile that must add up.

But of course I am just the idiot for not acknowledging your awesome wisdom on hard core engine optimisation and math purity. :roll:
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Ratios is better because it reduces a reason to give errors/warnings (if percentages don't add up), and with ratios you can still do percentages if you insist on that (by just making it add up to 100), while the other way round doesn't work.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Ratios is more mathematically appropriate imo

And even if the user thinks its percentiles but gets it wrong, the ratio system accounts for that and they get what they wanted anyway.
Torrasque
Posts: 1022
Joined: 05 Oct 2004, 23:55

Post by Torrasque »

Ratio is better because you can still make the 100% method.
With the 100% method, you don't have any choice.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

:roll:

I don't care... by all means, ratios... just build the darn thing, so that I can build the ExplosionGenerators.
Post Reply

Return to “Feature Requests”