Page 1 of 1

Activities and actions unifying

Posted: Fri Apr 07, 2023 1:06 pm
by Ignatus
In the game code and rules, we have two things much overlapping: activities and actions. Actually, requirements for most activities are requirements for the actions to set to them, and you e.g. can't continue fortifying if your terrain has changed to an unsuitable one to perform "Fortify" (or do I mistake here?). Thus, we would better unify these activities with corresponding actions, just redefine the action concept in that action takes zero or more turns to perform, and record in the actors' objects that they are busy with one or another action. I have already requested in a ticket making "Found City" an activity, I got a response that it should be generalized, and that's how it could be done.

There are though special activities that don't correspond to what we can call an action, that are "Idle", "Explore", "Fortified" and "Goto". They don't take a rules defined amount of turn, and they (except "Fortified") are more intristic for human or AI control. Probably, they should be separated from other activities into a special concept, or even two concepts: e.g., a user may want workers to look around as in "Sentry" mode while they are digging something, and let some unit may be at once fortified, "sentrying" and converting its terrain.

Re: Activities and actions unifying

Posted: Fri Apr 07, 2023 6:11 pm
by cazfi
Ignatus wrote: Fri Apr 07, 2023 1:06 pmThere are though special activities that don't correspond to what we can call an action
Couple of days ago osdn #47734 went in, for a bit similar goal of making some things that are not externally actions, actions internally.

Re: Activities and actions unifying

Posted: Sat Apr 08, 2023 3:54 pm
by cazfi
What I have in mind for actions myself:

- Now on 3.2 will only get some refactoring and minor additions (mainly consistency) within the existing system
- Towards 3.3 will work on generalized actions

Combining activities and actions would make a lot of sense, but I think it comes more naturally after we have actions generalized otherwise - then support for non-instant actions (i.e. current activities) would be only one new feature to add to that data model.

Re: Activities and actions unifying

Posted: Sat Apr 08, 2023 8:06 pm
by Ignatus
By the way, there is a difference in how autoexplore and autosettlers tasks are indicated while both are basically similar agents. "Explore" is an activity that (alongside with "Goto") just is not sent to players with limited knowledge of the unit. It's really difficult to figure out where the autosettlers client icon comes from: actually, it is set in fill_unit_sprite_array() if the unit is NOT exploring AND its .ai_controlled field (.ai in packet) is set AND it is not a military one. For military ones, a sprite called "auto_attack" is used instead (like, we don't have such a function since v.2.0 at least?). Maybe we should ever change boolean .ai_controlled to an agent enum specifier instead.