Creating a computer-aided version of WCTO

Hmm, clearly a problem. When you say 'couldn't fire' do you meant it didn't show up on the target list? Did other missiles have it show up? If the ferret WAS on the target list, did the missile just not 'fire' in the combat results report?
The Ferret appeared as a valid target for my FF missiles, but not for the DF missile. Either there's a problem with the DF's fire arc (as opposed to, say, an HS missile) or with the possibility to fire it at range 2, no matter what maneuvers your target executed in the turn before. (Since I did a Hard Brake or an Immelman with the Ferret...)

I'll experiment some more before I have to leave. :)
 
Well, looks like I did it:

Warning: Cannot use a scalar value as an array in /home/agespast/www/www/avacar/phase4/weapon.php on line 40

Warning: Cannot use a scalar value as an array in /home/agespast/www/www/avacar/phase4/weapon.php on line 41
shipConstructor (2): MySQL query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SELECT 'name', 'x', 'y', 'angle', 'speed', 'hp', 'rot_death', 'target' FROM `pieces` WHERE `id`=

I could fire the DF missile at the Ferret this time, but I think I didn't issue the order. (Couldn't deselect the DF, so I closed the missile selection menu altogether.) Then again, I'm not sure why I'd deserve the above warning, other than letting the fighters fire their guns at each other. ;) Maybe the Ferret died... (Hull points were at 7 IIRC.)
 
The Ferret appeared as a valid target for my FF missiles, but not for the DF missile. Either there's a problem with the DF's fire arc (as opposed to, say, an HS missile) or with the possibility to fire it at range 2, no matter what maneuvers your target executed in the turn before. (Since I did a Hard Brake or an Immelman with the Ferret...)

I'll experiment some more before I have to leave. :)

You can pretty much always drop an FF as long as there is any ship in range (Friend or Foe) so no surprise there. You should have been able to fire the DF however, so that needs looking at.




Well, looks like I did it:



I could fire the DF missile at the Ferret this time, but I think I didn't issue the order. (Couldn't deselect the DF, so I closed the missile selection menu altogether.) Then again, I'm not sure why I'd deserve the above warning, other than letting the fighters fire their guns at each other. ;) Maybe the Ferret died... (Hull points were at 7 IIRC.)

I think I forgot to include a 'if weapon firing dialog is closed, ignore the missiles' check, so it probably tried to fire it anyway.

As for the error messages:
Warning: Cannot use a scalar value as an array in /home/agespast/www/www/avacar/phase4/weapon.php on line 40

Warning: Cannot use a scalar value as an array in /home/agespast/www/www/avacar/phase4/weapon.php on line 41
shipConstructor (2): MySQL query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SELECT 'name', 'x', 'y', 'angle', 'speed', 'hp', 'rot_death', 'target' FROM `pieces` WHERE `id`=

They correspond to the multiturn data, which gets stored for things like multi-turn weapon locks. When you tried to fire the dumb-fire, it attempted to reset any existing multi-turn lock from another missile...however having none there, there ended up being a type-casting problem (as the default multiturn data, if you have none, is '-1', but if you do have some, it is an array. This is necessary for the way the database handles storage). I need to address that. The SQL warning tells us that it has now failed to update 1 of the ships in the database, so we've likely got a ship synchronization errors that I'll have to fix manually once I fix that code bit.

Good catches, and none should be hard to correct.
 
Hmm, looks like the board clean-up doesn't work at the moment to kill ships. This says the ship was destroyed, and it clearly has negative health... I haven't coded explosion icons in yet, but it technically should have at least vanished! I'm going to use this as an opportunity to finally build the 2nd last class we need, the 'environmental object' class that inherits from 'indicator'. This includes (eventually) asteroids, explosions, and flak. When I finish prototyping, I'm going to rollback turn 41 and onward such that I can re-process the ferret death.
 
Okay, after a fairly productive evening, I believe I have gotten basic environmental objects online. Without an end-phase-engine, the explosion will stick around for a while; I'll probably just edit it out in a turn or so. The good news is that the explosion WAS self-generating!

I've introduced a broadsword as a replacement. I realized, in doing so, that I hadn't done anything about turrets yet. I'll address that either tonight or tomorrow morning, but at the moment, I think it is going to treat the turrets as forward-facing neutron guns...

I also put in fixes for all the other reported combat-related bugs, EXCEPT the 'could not fire DF' bug, as I haven't tried to reproduce it.

Also, for those out there that have code access, I decided that since these 'alpha demo' files are fairly required to do testing, I've added the combat_alpha_demo.php to the repository. You should now be able to run tests of the code, although you'll need to edit the ship_popup.js to have the following change to the orders click-function:

$('.order').click(function() {
var ship_id = $(this).attr('id').split('_');

var preengine;
//Temporarily blocked out to allow the alpha demo to function
/*switch ($('#phase').val()) {
case '1': preengine = 'movement_preengine.php';
break;
case '2': preengine = 'combat_preengine.php';
break;
case '3': preengine = 'endphase_preengine.php';
break;
}*/
//preengine = 'movement_preengine.php';
if ($('#phase').val() % 2 == 0) {
preengine = 'combat_preengine.php';
} else {
preengine = 'movement_preengine.php';
}
$.post(preengine, {
id: ship_id[1],
game: $('#game').val(),
turn: $('#game_turn').val(),
phase: $('#phase').val(),

}, function(html) {

$('#orders_window').html(html);

});


});

I won't bother releasing the movement_alpha_demo, since it is done its usefulness, and there won't be a end_phase_alpha demo, since the phase4.php file would take over at that point.

For those out there reading, I still need a fair amount of testing on this. I know each time we hit a bug, I have to then fix it and you all have to wait, but after multiple hours of toying with the code, it is nice to have you guys help out (and hopefully have fun?) with the ships.

Of primary interested (aka not yet tested):

Can HS missiles lock properly? (i.e. lock at all? From non-rear angles (aka wrong)?, etc.)
Do multi-turn lock missiles (aka IR/Torp) work properly?
 
caught another bug where the ship pop-up window hadn't been displaying the number of weapons in a chain/pack properly. Now you'll see x2 and x4's and such. Note that this will retroactively update all the old turns as well, since the displays are generated on-the-fly, so you can only compare against a screenshot, if you have one.

Note that the broadsword lists 'Turret' 3 times, because it actually has 3 different weapons with only 1 gun per string, as each orientation is a separate weapon... which reminds me that Turrets get to target independently; bah, that's another complication to the combat_preengine.
 
Noticed the turret issue before reading this, so I won't complain about that. :p They're rather behaving like a rear turret at this point, though - I can target the Durango in turn 42, even with my mass drivers. (Probably because independent targeting isn't implemented yet.) I fired all guns at Command 1, just to check...

However, in the same turn, the Rapier couldn't launch an FF missile towards the Broadsword - which should be possible according to the rules.

Definitely good to see the actual number of missiles now! :)

As a side note, the phase shields don't act as phase shields (Broadsword's guns ripped through the Durango's shields in turn 43), but I presume that's because phase shields aren't coded in yet.
 
And some more bugs...

Turn 46:
- The Broadsword can fire an FF missile, although there's no target in its range (Rapier) or fire arc (Durango).

Turn 49:
- Both Rapier and Broadsword launched an FF missile, but it didn't show up on the map (although it should appear and just sit there, right?). Also, both ships still have their full FF missile loadout after turn 49.

Turn 52:
- The Broadsword should be able to get a torpedo lock at the Durango. (Not firing it yet, but locking on...)

Turn 57:
- In the "Orders" screen, the Durango claims to "decrease throttle down to -1" instead of "0."

Turn 58:
- No bug: The Durango finally did its left turn! I think it kept on going straight the last two times, although I ordered it to turn left. However, on both instances before, I clicked the pull-down menu with nothing in it (instead of "maintain turn left" or something similar). This time, I didn't click it and it seemed to work.
- The Broadsword still can't launch a torpedo at the Durango, although both ships have been maintaining their straight course for a few turns.

I'll stop now - you probably have enough to fix right there. ;)
 
Okay, these are some great bugs. Here is my guess on what is going wrong, and I'll report back later if I was right or not.

Noticed the turret issue before reading this, so I won't complain about that. :p They're rather behaving like a rear turret at this point, though - I can target the Durango in turn 42, even with my mass drivers. (Probably because independent targeting isn't implemented yet.) I fired all guns at Command 1, just to check...
Not sure why they're behaving like a rear; this definitely needs looking into.

However, in the same turn, the Rapier couldn't launch an FF missile towards the Broadsword - which should be possible according to the rules.
Hmm, okay I'll need to relook at missile locks in general; they seem broken.

As a side note, the phase shields don't act as phase shields (Broadsword's guns ripped through the Durango's shields in turn 43), but I presume that's because phase shields aren't coded in yet.
Hmm, I thought I *had* coded phase shields. Weird. Well they're easy enough to code in if I haven't (if shield_regen=-1, do no damage). I'll nail this bug this morning.

Turn 46:
- The Broadsword can fire an FF missile, although there's no target in its range (Rapier) or fire arc (Durango).
Actually, the broadsword is within 1-2 squares of the dumb fire missile that got shot back in turn 40 or so. Right now, missiles just aren't showing, but a DF is sitting there from turn 40 through to turn 51. At some point, the DF just vanishes for no good reason, however, which makes me nervous.
Turn 49:
- Both Rapier and Broadsword launched an FF missile, but it didn't show up on the map (although it should appear and just sit there, right?). Also, both ships still have their full FF missile loadout after turn 49.
Weird; that's also strange; I don't see any missiles having actually been fired.

Turn 52:
- The Broadsword should be able to get a torpedo lock at the Durango. (Not firing it yet, but locking on...)
More broken locks.

Turn 57:
- In the "Orders" screen, the Durango claims to "decrease throttle down to -1" instead of "0."
That may just be some message inclarity on my part, but that was what I coded it to say. It is trying to say the THROTTLE achieves a change of -1, not that the speed becomes -1. The Durango is probably a bad example for this, but let's say you had a speed of 3 but an acceleration of 1/3. The first time would say throttle to -0.333, the second time to -0.666, and the third time to -1, at which point your speed drops from 3 to 2.

Turn 58:
- No bug: The Durango finally did its left turn! I think it kept on going straight the last two times, although I ordered it to turn left. However, on both instances before, I clicked the pull-down menu with nothing in it (instead of "maintain turn left" or something similar). This time, I didn't click it and it seemed to work.
I notice there are a bunch of times when the throttle data reads turn:null. It should be reading turn:-0.5. This might be the hint I need to figure out why it comes up blank sometimes.

Also, the explosion disappeared right away... I know that's probably what you guys would expect, but without an end_phase, it shouldn't have been cleaned up.
 
Bugs about missile locks found so far:

I was doing a $bearing !=0 check which was dangerous, on the DF. Since I am now using atan2 for bearings, I often get bearings that are at numbers like 4.029e-14, which is clearly 0, but will fail a != check. Since I built DF targetting first and copied it for modification on the other missiles, it looks like I forced some of the other missiles to have a straight-only arc like the DF, which is likely why they weren't offering locks properly. This probably will solve the torpedo, dumb fire, IR initial lock-not-even-offered issues.

Also noticed that the hidden missiles were attracting locks; at the moment missiles can only lock on ships.

Aha; the reason torpedoes aren't locking is because, surprise, I forgot to code the torpedo target acquisition routine!

Successfully had Rapier DF the Broadsword, AND the broadsword has ordered a torpedo lock. Now I can test out the multiturn lock system.
 
Alpha demo isn't working right now, so I assume you're on it... :p
It occured to me that the turrets don't necessarily have to act as rear turrets, but maybe as a rear-facing gun with opportunity fire, since opportunity fire would have worked in that special case! Still not sure why the mass drivers were in there, too, but I'm sure these issues will be solved once you've sorted out turret fire. :)

Speaking of opportunity fire: Is there a way to display this in the "Orders" window? Maybe in a "tooltip" sort of way when you select a target that's out of your primary range...?

Good luck squishing those bugs! ;)
 
Yeah, sorry I was doing active debugging. I just fixed the issues with the missiles and explosions going away.

Opportunity fire doesn't currently have a direct indicator, but if you see your refires disappear again, that's likely why. I can code one in down the road.
 
Found 2 more bugs:
1. Ship multi-turn target id's weren't being recorded.
2. Missiles were depleting just for a lock! Should be on fire-only.

Both fixed.
 
For anyone wanting to run the code, I forgot you'll also need to change the run_engine.php as follows:
Replace the switch($turn['phase']) statement with:
if ($turn['phase'] % 2 == 0) {
combat_engine($orders, $turn);
} else {
move_engine($orders, $turn);
}
 
Alright! We fired a torpedo after a 3turn lock! I recommend you guys try it.

I have to take a break for a few hours, so feel free to mess around. I haven't finished dealing with the list Ironduke created from earlier today, but you're welcome to try to break the supposedly now-fixed issues, or find new ones.

The next thing on my list is to look into the turning issue. Keep the durango going in circles for a bit. It looks a little bit like he'll turn properly if it's ALSO trying to accelerate/decelerate, but having trouble if turning is all he does. It can accelerate without turning though, so that's not a complete correlation. I haven't fully tested, that was just an observation from looking over the orders database.
 
I'm back at debugging. Currently look at turn 64, and as of right now, the Rapier can fire all weapons at the targets behind it as if they are in front of it.

Hopefully by the time one of you looks at it, it'll be fixed. That may have explained some of the other strange behaviour from before.
 
Okay, fixed the rear fire issues (turrets still not dealt with), also fixed the erroneous FF targets.
 
Fixed left turn problem for cap ships (looks like it was a typo; apparently the right turns were okay).
 
Avacar, you sure are a hard-working man! ;)
Now, who of you has ordered the Durango off the map? I tried to avert it, but couldn't change its speed and course in time... Guess that's why we now have an error message about "unexpected number of templates." :p
 
Back
Top