samowen62 / DeathRaceGame

Code for Death Race (tentative). A racing game similar to f zero gx!
2 stars 4 forks source link

AI Implementation Scheme #1

Closed samowen62 closed 6 years ago

samowen62 commented 7 years ago

We have implemented a mechanism to extract the control points from a bezier curve in blender in the form of an xml file and upload them in unity. Must write guide on how to do so Must also get the points adjusted on the track prefabs transform so they represent the track more.

The scheme for AI will go as follows:

  1. Bezier points will be read in on startup
  2. The curve will be generated and parametrized by arc length
  3. Every X distance we will record a point on the track as reference.
  4. For each point we will look at the next N points on the track and calculate a weighted sum representing the target direction of a ship at that point. (Farther away points get less weight supposedly)
  5. We will determine an algorithm to adjust the AI ship's horizonal axis and space bar on/off based on the desired direction vector and it's distance from the center of the track. Must determine what the formula will be
samowen62 commented 7 years ago

This system has been changed since there are other modifications to make.

New system:

  1. In Blender bezier curve -> mesh for a series of points. Also export bezier points .co and .radius to know the width of the track at each control pont.
  2. Points imported through xml. Into Unity.
  3. Another pass done in Unity to link specific track points with width mulitpliers based on the 2 closest Bezier points in the sequence.
  4. This width can be multiplied by the base width (length in blender [found with the LeftPanel -> GreasePencil -> Ruler/Protractor tool] * scale of the track [SHOULD BE UNIFORM IN X/Y/Z!!!])

During the game we have trigger spheres to let the machine know which track point it's closest to. We will treat this locally as flat space with uniform width.