Refactoring AI

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: Refactoring AI

#11 Post by Technology »

EternalHarvest wrote:Common things in tasks:

Waiting for Network::IN_GAME
- can this be done with mutexes?

Arguments handling and validating
- can be handled in base class

Code: Select all

sub interrupt { $self->{interruptionTime} = time }
sub resume { $self->{giveup}{time} += time - $self->{interruptionTime} }
- can be handled in base class with unified method of storing timeouts in tasks
Why not a task like "waiting for bot to log in"?

That task is:
- created by an event (log out)
- mutually excluded to run simultaneously with all other tasks that are not allowed to execute while being logged off
- of higher priority than those other tasks
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: Refactoring AI

#12 Post by kLabMouse »

Technology wrote:
EternalHarvest wrote:Common things in tasks:

Waiting for Network::IN_GAME
- can this be done with mutexes?

Arguments handling and validating
- can be handled in base class

Code: Select all

sub interrupt { $self->{interruptionTime} = time }
sub resume { $self->{giveup}{time} += time - $self->{interruptionTime} }
- can be handled in base class with unified method of storing timeouts in tasks
Why not a task like "waiting for bot to log in"?

That task is:
- created by an event (log out)
- mutually excluded to run simultaneously with all other tasks that are not allowed to execute while being logged off
- of higher priority than those other tasks
Agree. But that task must be in "Idle" state while Active. So It block all other tasks, yet does not consume CPU time.