Azrapse: Really nice! Also, I was about to ask about the length of the lasers, but you read my mind. :D
Thank you so much, and for now, I have plenty of data to work with.
I still have lots work ahead with the AI. I'll keep you all informed.
Sekir_Delyn: Your welcome!
I'm really interested in the project! Thinking about to do the same, but I lack of programming knowledge to this level. AI bugs me the most! How can you replicate that?
Oh, i just remembered that the main reason that started this series of posts, the Roll and Pitch ratings, we still don't have proper meaning for those ratings.
Also, do you have any way to test the speed, lifespan, and damage of capital ship's lasers? I think they are longer, last longer, and maybe deal more damage?
Also, do capital ships shoot different kind of lasers against fighters than against other capital ships?
About your question on the AI:
I posted some diagrams a while ago about what I had planned to do. Well, most of those became actually much more complex than I expected.
I have divided the AI in two layers: flightgroup and individual ship.
Flightgroups have a set of orders given to them in the mission file. It tells when do they come in, when do they go away, how many waves, if they are part of the player's goals and how. But most importantly, they have an order given, and a primary and secondary objectives.
Depending on their flightgroup's order, a ship gets whay I call a "flightplan". A flight plan is a
non-deterministic finite automaton that gets assigned to the flight group at mission start.
For example, there is the "Attack Enemies" flightplan. Or the "Fly home" flightplan. Or the "Close escort" flightplan.
Each flightplan has a number of states, with transitions between them. When a ship AI needs to "think" what to do next, it checks the state it is currently at in the flightplan. Then the state tells her what game action to perform immediately, and which condition must be matched for the state to consider itself finished, and move onto one of the next states in the flightplan.
If you aren't lost by now, let me put an example. Currently, I have a test mission that I use while I am coding the AI engine. It is the Collector's CD-ROM edition of the Y-Wing Historical Mission 6: Rescue Ackbar.
In that mission, Red 1 and Red 2 are two AI ships whose orders are Attack Enemies.
The flight plan for Attack Enemies is something similar to:
-
If you have no target, choose one. Based on "Attack Enemies" and Flightgroup RED primary and secondary objectives, I choose the closest enemy. It selects T/F Alpha 1.
-
If you have a target, fly to combat range. The AI determines what the combat range is based on the weapon of choice. Because Attack Targets, and its target being a fighter, it selects the laser cannon. The laser cannon reports that at its current speed and laser charge, the combat range starts at 1.66 km from the target. So the Y-Wing flies until it is at that distance from the target, then moves on to the next state.
-
If you have a good shot, shoot. The default AI routines always try to aim the ship to the trajectory of the target. Later on, I plan to modify this to accept different AI difficulty levels (Rookie, Veteran, Ace...), so that Rookies aim at where the target is, while Aces aim at where the target is going to be. Currently, all my AIs are Aces, so the Y-Wing fine tunes its bearing to aim at where the target is, plus the target speed vector multiplied by the time the laser will take to reach the target. This is the equivalent of the player waiting to get a lit targeting reticle. If the Y-Wing is close enough to this ideal bearing (there is a margin of error), it shoots its weapons.
-
If you are too close, prepare another attack run. If the AI determines that it has reached too close to the target, in particular, if the distance between them is less than 100 m or so, it moves away from the target until it reaches again half the max distance of effective combat range.
This automaton is not linear, but there are multiple transitions between those states, because at any moment, for example, the target might be destroyed, hyper out, etc, then the AI jumps back to the first state, or whichever is a good candidate.
I'm not sure if you were actually interested on this wall of text. But basically that will give you an idea of what I am doing right now, and why I consider this to be the hardest part of the game. You need to get these behaviors right so that the game feels like X-Wing and not some other game. And there are many conditions, variants and mission orders. Even if I worked 8 hours a day on this, it would take me several months to complete only this part. So patience. :)