Strategic Primer: Actions vs. Goals

On Wednesdays I write about my strategy game, Strategic Primer. Today I write about the computer version I’m designing and writing.

A while back I began musing about how to design an API for Strategic Primer. But at that point this seemed like a long-term consideration; now it is something that I need to be thinking about now.

I think that to make real progress in the code now without making my future plans a great deal more complicated, I need to convert the project into a client and server and hide some of the details in the server.

In particular, I’ve just been implementing unit and building “actions,” which are supposed to be basically atomic, i.e. single steps like moving one tile or harvesting or depositing one unit of a resource. At present the user tells a unit to take an action, and the unit does so.

But the next “feature” on my list to implement is pathfinding. This is something that will require non-immediate execution of player commands, which is what I want in the long run anyway.

What I’m going to do is make such “actions” a restricted API, normally only used internally in the server. What clients will use is an API for manipulating a unit’s “goals,” things like “go to such-and-such place,” “harvest such-and-such a field,” “patrol this section of wall,” “attack such-and-such fortress,” and so on. It will be up to the server to make sure that each goal (taking the next few goals into account too) gets expanded into actions properly.

Thoughts?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s