Post Reply 
Some math problems from video games.
08-24-2017, 08:00 PM
Post: #1
Some math problems from video games.
As far as my experience goes, normally in a game there is, aside from the ubiquitous logic that is required in programming, a lot of math involved in the graphic engine, or graphical interface and/or in the physics engine; but there are few games that involve non-trivial math in terms of game mechanics (that is, the set of rules that normally are taken in consideration by the player to win the game).

Well a recent sets of geometrical problems arose in Gladiabots (I recommend the game if you like solving problems with logic. I also recommend Euclidea). I did not attack them yet but I think they may be interesting.

In the game a damaged robot can flee from enemies, but until today the flee options were somewhat limited. Recently it was introduced the "free from all units that satisfy those conditions". The "all" part was mapped to the average position on the map of all the units that satisfy the given conditions.

In images, it is the following.
[Image: cRmunZVl.png]

So if the red points (enemies) don't move, the damaged robot (black) will move away from the blue dot in a straight line.

People complained because sometimes this solution does not really ensure that the damaged robot follows the shortest path (shortest as in "shortest felt by a player") to go away as quick as possible from the closest enemy and at the same time from all the other selected enemies. So they started to proposed several ideas.

The first based on the average angle. The angle between the robot and an enemy is given by: robot, enemy, fixed point on the map (so far East is chosen. That is the point x=50, y=0 . The map has points from x=-50 to x=50 and y=-50 to y=50). The resulting average of all angles computed against the selected enemies determines a place on the map from which the robot flees.
My observation about this is that (a) even with static enemies, the point could move as soon as the robot moves (because the angles change). I still have to prove this though. (b) due to (a), the robot may not follow a straight line while fleeing (as for 'a' I need to prove this as well). (c) there could be multiple points that could generate the computed average angle given the triplet: robot, resulting point, fixed point. For example for an angle of 90 degrees there is an entire semi circle of possible resulting points if I am not mistaken.

Then there is the proposal with adding vectors. One draws the vectors from the robot to the selected enemies, and then add those, finding the resulting vector that would determine a point (on the map or on an extended plane since the map is limited) from where to flee. Questions: is this point equal to the one found with the average angle in all cases? (I would tend for the "no")

Third proposal so far :
[Image: QrHOiLo.png]
(actually the circle can be draw with the radius equal to the furthest selected enemy from the given robot)

Questions: is the point computed as shown from the figure above effective compared to the average position? (for effective, see earlier paragraphs). Would it lay on the same line that connects the average position of all selected enemies?

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Some math problems from video games. - pier4r - 08-24-2017 08:00 PM



User(s) browsing this thread: 1 Guest(s)