Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
November 17, 2019
arrowPress Releases







If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

AI is Voodoo

by Robert Basler on 09/09/15 03:27:00 pm   Featured Blogs

6 comments Share on Twitter    RSS

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

(Originally from onemanmmo.com)

I've been programming for 34 years now. I have never had something like this happen before.

I was working on a feature for the AI for the units in my little RTS game The Imperial Realm::Miranda. If the AI decides to move to attack an enemy, I want it to return to its original location afterwards so units don't just wander off whenever an enemy comes by.

To implement this, after a unit is downloaded to the client, I save the unit's home position so it knows where to go back to. With an existing unit exactly nothing happens then -- just like I planned it.

A brand new unit's Y location isn't actually set to a good value when it is downloaded, (shortly after it is downloaded, some other code on the client sets the Y value to place the new unit at the right height above the terrain.) The first time the AI wakes up and looks for something to do, it sees the change in Y and as far as it is concerned, the unit has moved from its home. The AI then tries to move the unit back to its home location (where it actually is already) however, as part of the process of moving to its destination, it does a collision check to make sure that the destination it is moving to doesn't have any other units on it. If its destination is blocked it will move to the nearest clear location.

I had another feature on my task list which said:

Make new units find a good position to park instead of just appearing on top of one another in front of the war factory.

A bug in the AI does that for me now completely for free!

The first time a unit moved aside after creation I was completely astonished.

AI is voodoo.


Related Jobs

Square Enix Co., Ltd.
Square Enix Co., Ltd. — Tokyo, Japan
[11.17.19]

Experienced Game Developer
Bit Fry Game Studios, Inc.
Bit Fry Game Studios, Inc. — Portsmouth, New Hampshire, United States
[11.16.19]

Gameplay Engineer
Bit Fry Game Studios, Inc.
Bit Fry Game Studios, Inc. — Portsmouth, New Hampshire, United States
[11.16.19]

Game Network Engineer
Bit Fry Game Studios, Inc.
Bit Fry Game Studios, Inc. — Portsmouth, New Hampshire, United States
[11.16.19]

Backend Engineer





Loading Comments

loader image