PDA

View Full Version : insect ingame

Apr 26 2008, 11:58
Hi, I want to understand how the syntax used in the insects and windclutter classes work:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">cost = &#34;&#40;9 + &#40;2 * houses&#41;&#41; * &#40;1 - night&#41; * &#40;1 - rain&#41; * &#40;1 - sea&#41; * &#40;1 - windy&#41;&#34;;[/QUOTE]

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">probability = &#34;5 - &#40;meadow * 0.5&#41; + &#40;forest * 0.4&#41;&#34;;[/QUOTE]

DMarkwick
Apr 26 2008, 19:22
Yeah I&#39;ve looked at those too. Looks to me like you&#39;re constantly multiplying the probability by percentages & arbitrary probabilities to get an eventual final probability of existing.

Example, (1 - rain) sounds to me like when it&#39;s fully raining (rain = 1) then the multiplier is 0, and anything multiplied by 0 is 0. So no insects at all when it&#39;s fully raining. However if it&#39;s only 25% raining I suppose there is a multiplier of 0.75.

So rain, time of day, and sea either do not affect at all, or reduces the probability set out by the rest of the equation. After all any "* (1 - (0 to 1 value))" can only ever reduce a value, never increase it. So this part of the equation influences the probability.

The other part of the equation is some logical way to define the actual probability then. (9 + (2 * Houses)) sounds to me like an arbitrary probability (9) multiplied by twice the value of Houses. Whatever that is. Houses could either increase the probability or decrease it, depending on how you&#39;ve set the logic up. I would guess that Houses must decrease the insect probability, giving you more insects out in the wild, however that&#39;s not what it looks like in the above example. So I would have to say that the insect being defined here is a housefly type insect that you DO want to be more populous around buildings.

**edit**
Missed the point of the question, sorry http://forums.bistudio.com/oldsmileys/biggrin_o.gif however I&#39;ll leave my answer up for others to read.

**edit 2**
Actually, reading it again, I would say that the Probability equation is exactly that, while the Cost equation is a reducer for environment.