Sign in to follow this  
lucky6969b

Architecture for workflow

Recommended Posts

There are several components in my application.

1st) state machines - drives what the agent is going to do next

2nd) task manager - manages all the tasks coming in and out of the scene

3rd) observer pattern - draw attention to agents when a task comes in

 

How do I put them together?

When a task does come in, say a truck carrying some troops that I want to annihilate.

Firstly, I've some arrival component that signals the truck to arrive in which they composite

some troops inside of this object. Then I use observer pattern to signal the task manager,

and create a task in the manager and push a task through to the NPCs

And when say my army's NPC notice it when their state machines has some pending 

tasks in their queues, they start to action. This is just a brainstorm...

Is it the way to go for the design stuff?

Thanks

Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites

That is A way to go, not sure about THE way to go.

The three things you mentioned (state machines, task managers, and observers) are tools and patterns.  It's roughly akin to saying you've got a hammer, a screwdriver, and a lathe, now you're wanting to know how to use them all together.

What you've got seems to work.  Going through your description you have something in your simulation that detects the thing is within range. That triggers a function call (observer pattern) and the thing that responds to the call in turn schedules a new task.  You have objects running their own state through state machines, and transitions within the state machine can be called by function callbacks as observers or called as functions from other task scripts.  All of that seems like a viable path.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this