[Defconapi] controlling fighters
spooq
spoooq at gmail.com
Mon Jul 27 19:08:55 CDT 2009
Uh, obviously the airbase code doesn't work unless you use
game->SetActionTarget(game->GetOwnUnits()[i],
-1,
game->GetLongitude(cityIds[1]) + 5.0f,
game->GetLatitude(cityIds[1]) + 5.0f);
2009/7/28 spooq <spoooq at gmail.com>:
> Apologies if this has been sent multiple times, having internet trouble.
>
> void Bot::think() {
> for (unsigned int i = 0; i < game->GetOwnUnits().size(); ++i) {
> switch (game->GetType(game->GetOwnUnits()[i])) {
> case TypeAirBase:
> if (defcon <= 3) {
> game->SetMovementTarget(game->GetOwnUnits()[i],
> game->GetLongitude(cityIds[1]) + 5.0f,
> game->GetLatitude(cityIds[1]) + 5.0f);
> }
> break;
> case TypeBomber:
> case TypeFighter:
> game->SetMovementTarget(game->GetOwnUnits()[i],
> game->GetLongitude(game->GetOwnUnits()[i]) + 5.0f,
> game->GetLatitude(game->GetOwnUnits()[i]) + 5.0f);
> //game->SetLandingTarget(game->GetOwnUnits()[i], game->GetOwnUnits()[0]);
> break;
> default:
> game->SendChatMessage(composeString("Unknown type for unit %d",
> game->GetOwnUnits()[i]), CHATCHANNEL_PUBLIC);
> break;
> }
> }
> }
>
> 2009/7/26 spooq <spoooq at gmail.com>:
>> Hi guys, thanks for the response.
>>
>> I'm also away from my computer, but I'll send some sample code when I
>> can, should be about 24 hours from now. I did try using
>> SetMovementTarget() and SetLandingTarget(), but the fighters just went
>> to their initial target then returned to base. Pretty sure the target
>> location was within the fuel range, I was just testing things out with
>> a single AI in the game. At first I thought I had to change the
>> status, but for fighters there is only attack mode anyway.
>>
>> Robin, are you still actively developing the API, or are you more in
>> bug-fixing mode now? Thanks for fixing the issues with the bot being
>> initialised twice.
>>
>> I'm playing with the whiteboard functions, for example drawing a
>> Veronoi diagram of all the cities (pointless because GetDistance()
>> allows easy implementation of GetNearest(), I know, but it looks
>> cool). How expensive are these functions in a real-world networked
>> game? Would drawing lines that flash every second or two wreck the
>> connection?
>>
>> Thanks,
>> Luke
>>
>> 2009/7/26 Luke Meyers <n.luke.meyers at gmail.com>:
>>> Sorry, I wound up getting distracted from this project (did a bunch of
>>> reading, then never got back to coding after my initial forays); can't
>>> offer any insight.
>>>
>>> On Sun, Jul 26, 2009 at 10:02 AM, Robin
>>> Baumgarten<robin.baumgarten at gmail.com> wrote:
>>>> Hi Luke,
>>>>
>>>> Did you use SetMovementTarget() to do that? I'm on holiday and don't have my
>>>> desktop with the DEFCON environment with me. Basically, there's
>>>> SetActionTarget(), which sets the target of the current status of the unit
>>>> (eg., shooting at ships for a bomber in normal mode or shooting a nuke for a
>>>> bomber in nuke mode); and there is SetMovementTarget(), which sets the
>>>> movement target for the unit. I don't remember if it accepts the location if
>>>> it is outside the fuel range. There is also a function to get that distance,
>>>> although i don't have it's name on the top of my head.
>>>>
>>>> Robin
>>>>
>>>> 2009/7/22 spooq <spoooq at gmail.com>
>>>>>
>>>>> Can someone please post code showing how to control a fighter after
>>>>> its initial attack has been set?
>>>>> _______________________________________________
>>>>> Defconapi mailing list
>>>>> Defconapi at lists.introversion.co.uk
>>>>> http://lists.introversion.co.uk/listinfo/defconapi
>>>>
>>>>
>>>> _______________________________________________
>>>> Defconapi mailing list
>>>> Defconapi at lists.introversion.co.uk
>>>> http://lists.introversion.co.uk/listinfo/defconapi
>>>>
>>>>
>>>
>>
>
More information about the Defconapi
mailing list