1
\$\begingroup\$

Suppose I'm creating a racing game.. I would like to implement an awareness system AI, that will suggest to the player that he can buy that booster or some other upgrade, .. etc. How should I start implementing that? A FSM ? A decision tree ?

Suppose that I have variables like, how many crashes, how much is the damage, how many gates I have passed, .. etc how would I use those variables then to say for example you need to buy that stuff?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I would use some sort of points system assigned during the race.

So each time a player crashes in the corner - add a point to "steering upgrade suggestion", each time he looses a race add a point to "engine upgrade", brakes for prolonged periods and misses an apex - "better brakes", gets overcome by an opponent in a straight line - "booster" and "engine" upgrades. You get the picture.

Detecting the right events can be tricky. You might need to add some cooldown period between adding more points or diminishing returns to the same item, so that e.g. multiple crashes during the same race wont make the steering upgrade score go sky-high. For example when player crashes into the corner you need to foresee and account for player could be hitting the walls of the corner a dozen of times before coming to a stop - that should be treated as a "one cornering fail", not a dozen. Said that, counters probably should be float values.

Another tricky part is to come up with the right triggers and balance the points required to fire up a suggestion.

Considering that events won't happen that often and will be read even rarer, optimizing the underlying data structure does not really matter.

\$\endgroup\$
5
  • \$\begingroup\$ What data structure should be used ? just a dictionary is enough? about the right triggers,isn't a threshold is not enough ? like if the points of streeing upgrade suggestion is over 50, then fires it ? \$\endgroup\$
    – user54791
    Jan 17, 2015 at 13:13
  • \$\begingroup\$ @andre: I have expanded my answer to address these questions. \$\endgroup\$
    – Kromster
    Jan 17, 2015 at 13:18
  • \$\begingroup\$ So it's just a counter, the implementation to each item ? \$\endgroup\$
    – user54791
    Jan 17, 2015 at 13:48
  • \$\begingroup\$ I'd make it a bit more complicated than a simple int counter. But the idea is there, yes. \$\endgroup\$
    – Kromster
    Jan 17, 2015 at 13:54
  • \$\begingroup\$ you can tell me how complicated you want to do it, I'm really interested :) \$\endgroup\$
    – user54791
    Jan 17, 2015 at 22:48

You must log in to answer this question.