Monday, July 12, 2010

Test Framework Update

As planned, I've added test cases for the following unit commands:
  • siege
  • unsiege
  • cloak
  • decloak
  • burrow
  • unburrow
  • lift
  • land
  • load
  • unload
  • unloadAll
  • unloadAll(Position)
I've also added test cases for the following unit commands:
  • setRallyPosition
  • setRallyUnit
  • rightClick(Position)
  • patrol
  • holdPosition
  • stop
All test cases run without error as a DLL in Broodwar memory and as a separate client process. Now only the following unit commands are left to be tested:

  • attackMove
  • attackUnit
  • rightClick(Unit)
  • follow
  • repair
  • returnCargo
  • cancelConstruction
  • haltConstruction
  • cancelTrain
  • cancelTrain(Slot)
  • cancelAddon
Once I add test cases for these last 11 functions, I plan to add a test map that specifically deals with unit destruction and AI module call backs. For example, when a unit dies it should generate an onUnitDestroy callback. I also plan to re-write the way BWAPI generates events and callbacks to facilitate the process of making them behave the same way on the client as on the server. To do this, I'll make BWAPI just generate Events in the appropriate places, rather than both Events and perform the callbacks immediately. Then, right before AIModule::onFrame() is called I'll translate the events into callbacks and perform them. This will make the AIModule callback behavior virtually identical to the Client Events since they'll both be called at the same point of execution in GameImpl::update() for the most part. I'll also need to make some modifications to the way units get destroyed or become invisible so that their last frame of valid unit information is still available at the time of the callback or Event. For example, right now when an enemy unit dies, the client doesn't have access to the last frame of valid unit information because it is erased in GameImpl::onUnitDestroy(). I plan to make this function just set a flag in the UnitImpl class to indicate that the unit is dying, and only add UnitDestroy events. The UnitData struct for the recently destroyed unit would then be cleared after the AIModule::onFrame() and Client update functions have been called.

No comments:

Post a Comment