ID:194535
 
I don't like pre-discussing my projects, but then I don't like people thinking I'm not doing anything either...

So in addition to work on DragonSnot (new splash screen up for that by the way -- kinda cool), I've been putting most of my time into 2 projects that are really 1:

BaseCamp: from here you can reach Everest!

BaseCamp is base code for almost any kind of game. It will provide an event cycle for you if you wish, will handle mob movement and click-to-move for you (with NO work on your part!), and will completely handle saving/loading players in savefiles for you. Actually it already does all that and I just need to document it.

If anyone uses it, I'll expand it to cover standard game functionality like spells, high scores, and turn-based email. I'm committed to building all my future games on it (unless it just doesn't make sense).

BaseCamp is simply taking the various code that I tend to copy/paste for each project and putting it together in a configurable library.

To make sure it's totally generic and supports everything it should, I'm doing a couple of games on top of it. First is Byzantium, next is Sneak (Gazoot has made Sneak a DDT game and made the mistake of telling me to do whatever I want to it!)

Byzantium: The game named for its first two letters.

For a non-BYOND-related 3D game project I might get involved in, I need to research squad-based AI. And I've always really really wanted to do some intelligent combat AI.

So this is a game where each player (the computer can be a player) starts with a leader, and has to recruit squad members, then go about strategically destroying the other players. The squad members will act on their own or on your orders.

I'm having a lot of fun building this, and amreally glad I learned a bit about ant-based AI, cause it makes life much simpler.

I've blathered enough, so if you want to know what ant-based AI is, you have to ask!
I really like the "BaseCamp" name and slogan. Lovely! I am intrigued to see what it does, though I find reading unfamiliar code confusing (one reason I've never used any library other than the HTML one!).

Z
In response to Zilal
On 11/25/00 11:21 pm Zilal wrote:
I really like the "BaseCamp" name and slogan. Lovely! I am intrigued to see what it does, though I find reading unfamiliar code confusing (one reason I've never used any library other than the HTML one!).

Z

Yeah I like the slogan a lot too. I'm not sure where it popped into my brain from.

Well hopefully this won't be confusing. It will be fully documented, you shouldn't need to look at the code, and here's an example of all you have to know:

////////////////////////////
// BaseCamp configuration //
////////////////////////////
// Change these values to turn on/off BaseCamp features.
game_controller
auto_event_cycle = 1 /* If true, GameController starts up an event cycle which gets called once per game tick.
Any object can participate in the event cycle by adding itself to the
GameController.event_cycle_receivers list, after which that object's EventCycle()
function will be called each tick. By default, mobs do this automatically when
they are created. */

player
auto_save_mob = 1 /* If true, BaseCamp assumes that player keys are associated with only one character,
which is saved/loaded in the savefile automatically for you when the player logs
in and out. You can override this on a per-player basis. For customized behavior
(such as to support the player having multiple characters), turn off auto_save_mob
and add your own Read()/Write() support for mobs. */

mob
auto_event_cycle = 1 /* If true, mobs add themselves to GameController's event_cycle_receivers list so that their
EventCycle() function is called each tick. You can set this value on a per-mob basis.
The default mob EventCycle() function calls TurnCheck(), and if the time specified by
movement_rate has passed since the last turn, TurnCheck() calls PerformTurn().
You can override any of these functions to customize the mob behavior. */

click_to_move = 1 /* If true, the player clicking on the map causes their mob to move to the turf or
object that was clicked. You can set this value on a per-mob basis. */


Speaking of which, these days the primary Deadron library functions are as simple as this to understand:

var/timezone = -7
var/timestring = dd_time(timezone)

and

dd_StepTowards(target)

But on to ant-based AI...

People who make experimental robots for a living (that is, college professors and grad students) have discovered that it is very very hard to make a complicated intelligence. Big hammers don't work very well for AI. Trying to recreate brains doesn't tend to work too well.

Then they looked at ants. An ant colony is a very complicated place. But each individual ant is very stupid, with just a little bit of programming telling it what to do, such as "walk around until you find food, when you do, lay down a scent and walk back home".

It turns out this approach works well for robots too...that is, make a bunch of small robots, give them simple goals without telling them exactly how to do it, and the set of robots will end up solving the problem.

For example, in the Byzantium game, each player/computer has a single leader, who puts together a squad based on whatever units happen to be around: scouts, infantry, and snipers in any combination.

Their primary goal is to protect the leader, and then to kill the other players.

To protect the leader, I need them to surround him in some logical manner, but I don't know ahead of time which units he will have. Five scouts, or two infantry and one scout and one sniper, or what? That's when I was reminded of the ants.

So instead of trying to put together a big algorithm to handle intelligent unit placement, I just do this:

1. The leader finds a defendable spot as pre-defined in the code (right now that means he looks for a corner) and moves to it.

2. Each of his units moves to a point as close to the leader as their range of fire.

3. Then each unit moves randomly until they are that far from the leader AND from any units of the same type as themselves. This is where the ant stuff comes in -- just have them move randomly until they find the spot, rather than trying to figure out the spot.

The result, after 30 seconds of jostling around, is a set of units spread out in a semi-circle from the leader, providing maximum firing coverage and cross-fire, no matter which units they are.

Man, I have waited SO long to get to do combat AI!