OOK, Once I Owned a Kestrel, is now being revamped. Previously, it was to be released solely on iPhone and iPad. Now, iPhone, iPad, and other mobile devices are dropped and it will be primarily a desktop project. Welcome to the new OOK. Enjoy.

Report article RSS Feed Artificial Intelligence in OOK

Ah, the ever-illusive, and incomprehensibly complex subject of intelligence. I hear there are some amazing feats in creating artificial implementations going on these days. Robots that can be taught just by holding up an object and saying its same - astounding!

Posted by teh1ghool on Apr 19th, 2010

Ah, the ever-illusive, and incomprehensibly complex subject of intelligence. I hear there are some amazing feats in creating artificial implementations going on these days. Robots that can be taught just by holding up an object and saying its same - astounding! Additionally, it seems like in this day and age no game is complete without some form of AI (Artificial Intelligence). This includes OOK. I have plans and I have thought them over well, yet they still require that much more thought be put into them. Let's explore the behavioral patterns that the AI in OOK will need to demonstrate.

Friendly or Neutral Ships

All ships in a system will need to be programmed to go about their usual business of flying to and from planets and space stations, and jumping out of systems. Due to the fact that in OOK one may collide with other ships and asteroids, a system of pathfinding will need to be implemented. My initial thought is, ok, I'll create a few waypoints and encourage the ships to stick to them. That's a great start, and that's what I am doing. A ship will calculate the shortest route through waypoints to its destination and take it. However, what if two ships happen to cross paths and collision is imminent? Once again, I have thought of a solution for this. Every ship will draw a ray forward to its next destination (which may be a waypoint or another object). If the two ships are close enough, their rays intersect, and the game calculates that they will collide at their current speed, it will act in accordance with the laws that boats follow while on water. The ship on the relative left will slow down until they will no-longer collide, and then hold that speed for several seconds before increasing speed once again and resuming normal operation.

Hostile Ships

While there will be numerous personalities for ships, the basis of the AI behind them while hostile will be retained. The simplest of the hostile AIs that I will be programming will be 'GTFO'. In order words, the ship is a scared, sorry bastard and runs away as fast as possible. All that will need to be done is use the Friendly/neutral ships' AI and set the target to the nearest SAR (Subspace Accelerator Ring). The rest of the personalities will be another story. Some ships will start running if they get hurt too much, others will fight to the death, and hey, why not throw some suicidal dive bombing ships into the mix? The initial code will be the same. A ship in question will have to be able to chase the player through asteroid fields and even avoid head-on collision should the player charge the AI ship as well. For this explanation I will dedicate a paragraph.

I contemplated hard on how I might let a ship follow the player through an asteroid field without putting too many calculations through the core. It took time, but I believe that I have solved this problem. Hitting other objects can potentially destroy one's ship, so that will be avoided by the player at all cost. If I sample the player's speed and compare it to the last speed/angle that was sampled I can get a good sense of what the player is doing. By recoding only certain samples and dropping them into a queue (with a maximum number of samples and old being pushed out) I can let the AI follow the player's exact movements. Should the player hit an object and come to a stop, it will skip recording that point and record the next so that the AI doesn't follow the player into the object that it ran into. Should the AI ship catch up to the player when this happens, it will switch to a new set of actions. In this case, they will be stopping and shooting at the player. While this will take some fine tuning, I believe it will generate some interesting and very dynamic behaviors.

Two final notes

Should an AI ship detect waypoints - which are only seen in asteroid fields as navigational beacons - in between its current location and the target's oldest vector/location sample, it will attempt to navigate to the target the same way friendly/neutral ships navigate toward planets and stations.

Below is a diagram of how sampling might work.

White = Player path
Red = AI Path
Green = Samples added to AI waypoint queue
Brown = asteroids

OOK AI Tracking Diagram

Help Me Out

I am interested in your thoughts and opinions, so please share them with me! They will help me greatly!

Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
[ook] Once I Owned a Kestrel
Platforms
Windows, Mac, Linux
Engine
Custom Built
Contact
Send Message
Official Page
Spiralnebuladev.com
Release Date
TBD
Game Watch
Track this game
News
Browse
News
Report Abuse
Report article
Related Games
[ook] Once I Owned a Kestrel
[ook] Once I Owned a Kestrel Single Player Role Playing
Related Engines
SIO2 Free Open Source 3D
SIO2 Free Open Source 3D GPL Released Nov 1, 2009
Related Groups