Zania Day 16: AI 2
Completed work:
Create AI linked list for updates on AI decision at each frame
- Who is creating AI? (DO THIS FIRST)
- SpawnAI is not called, have to find a new AI() somewhere in all the code.
- Alternatively, maybe find out whether or not flash cs4 has a function to search all code base.
Added debug trace information to each function
Found out that it was the test code I inserted in Sol that automatically allocated all possible actors
Quite impressed by the xml loading scheme I wrote a year ago. It’s just too messy with a structure half in place and lots of little code snippets for testing.
AI Spawner working, function name changed to CreateAI. Proceed to work on AI intelligence.
2 months to release date, 1 month to alpha
- Define what is the most simple working release
- Player ship
- Health and weapons
- AI ships
- Increasing AI numbers
- Decide which is a necessary feature for the above to work and cut the rest.
Future expansion in AI. Constructor will create 4 types
- Simple
- Advanced
- Predictive targeting
- Intelligence Matrix
- Loads xml adaptive matrix based on evolution
- Evolution achieved by selecting and mutating the ai that scores the highest against players
- Positive scores = time +damage done to player + killing players
- Negatve scores = death
- Matrix input = Player position, player angle, player velocity, player angular velocity, current position, current angle, current velocity, current angular velocity.
- Matrix output = accelerate, rotate, shoot
- Matrix cell = 10 layers of 8 AND, OR and bypass. Each layer takes 1 frame to execute.
Incomplete work:
AI class will make movement decision on each frame update.
- Remove gravity for now
AI Targeting (Do this first):
- Get Player position
- Get Current position
- Face player?
- ApplyTorque
- Radian calculation using atan2
- Problems
- Limit radian range to one circle only and redo the calculation
- Limit angular velocity for now
- Create a test system where there are no gravity nor planet to test the AI
- Distance from player?
- ApplyForce?
- Player in weapon range?
- Attack
- AI’s simple first iteration algorithm
- Define player position, approach player, shoot when within range.
Need to change actor creation to be based on sol.xml loading. (See Sol class)
Need to bring shooting action to the SolarSystem spawner and create a new constructor for bullets.
- Right now it’s the ship that spawns the bullets.
- Do I want ships to spawn the bullets?
- Bullets does not need interaction with the rest of the system besides the physics
- Physics already linked.
- OnCollision event? Bullet upate? Or the solarSystem’s job?
Leave a Reply