Jump to content

Math Issues


kowalski

Recommended Posts

My question to some extent walks the line, in what would be considered a scripting question. However given the nature of this platform and MTA SA I think a greater understanding of this topic would be extremely valuable to many. As math forms the basis for the foundations of a great deal of things within video games in general, to avoid moving into TLDR territory. 

My question is pretty simple I've placed markers plotting a path, around the Las Ventures Airport. (See the map below for a reference)

?u=http%3A%2F%2F3.bp.blogspot.com%2F_L6E4hOYhics%2FR1QCOfNXo-I%2FAAAAAAAAKFA%2FkRFxG-bgwbk%2Fw1200-h630-p-k-no-nu%2Flv%2Bair.jpg&f=1&nofb=1

A car is placed south near the AT-400 hangar, and the points are order in a fashion that if each are followed sequentially. The car will loop this runway endlessly without human intervention. 

From what I am aware the execution would function something like this. in dot points.

1. The car would check all points and select the one that is closest to the position of the vehicle.(Thus the car would proceed north towards the left turn)

2. The second stage would be setting orientation.

Step 2 is really were the problems stands for me personally how would the orientation system work. How would this be done and what form of math would allow for that. Generally what materials would be worth studying that could be useful in dealing with these issues?

  • Like 1
Link to comment

While I cannot point you to any materials outside of my experience, let me chip in with some of my ideas...

This is a problem of detecting all possible paths around a recommended path (set out by your "dot points") using the movement rules of a GTA SA car and the game physics. To solve the game physics question you need to solve collision detection (NOT intersection!) problems of a GTA SA collision model that consists of triangles, cones, spheres and boxes in movement directions. This is an active part of my research but suffice to say there is no perfect mathematical solution other than the best approximation you can come up with around sin/cos/euler equations, all in all hard work. The better the approximation the better the player will feel your solution, that's important. The game world can be loaded from the official game .col files in connection with the game map files for placement.

What about the game physics and the GTA SA car rules? Suffice to say it is using a weird FPS based approximation so you better study it based on experience and what the game has to offer through configuration files (handling data, model data, the game executable in the worst case). Vehicles have the most complicated collisions, followed by objects followed by peds (which are just a box or cylinder I believe).

From your post one could be deluded to think that the only route you need is the nodes you have put. But think about this problem as a navigational issue. Your nodes are just recommendations which in real life the path is more complicated. From 4 points on a map you might have to expand them into 117.

Just maybe you could start by taking a look at algorithms like Breadth-first search - Wikipedia and navigational data structures. Hope I could guide you somewhere useful!

Link to comment
8 hours ago, kowalski said:

In principal I am only really looking into what math is required for a node follower

If you want to know based on a 2D orientation whether you want to turn left or right to face toward a point, you can invert the 2D coordinate system with center point set to the position of your entity to get local coordinates (lx, ly) from the world coordinates of your entity. If lx > 0 then you have to turn right. If lx < 0 then you have to turn left. This idea involves Linear Algebra but getting the idea is another topic.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...