Welcome, Guest. Please login or register.
Did you miss your activation email?

Pages: [1]
Print
Author Topic: approaching objects  (Read 519 times)
tZee
Community member

Posts: 190


View Profile Email
« on: July 10, 2009, 12:31:41 AM »

We are getting more and more approach functions. I already opened a ticket for that in trac: http://parpg-trac.cvsdude.com/parpg/ticket/70

Now Bretzel added a new type: approach and do XYZ, which is some kind of action scheduling. Now I was wondering if we should implement proper action handling and queuing, like in RTS games? Right now I think that's going over the top a bit, for just queuing an action after approaching something. But what about the future? Do you think we would need this sometime? Maybe even on a more abstract level, where actions don't only have to be related to the PC, but also to some game stuff happening. Like approach door and change map. Or craft item (process) and then add it to the inventory (result, item)?

Right now I can't think of another elegant solution, that doesn't add a function per action to the game. :X
Logged

meggie
Community member

Posts: 30

Python programming looking for some C++ experience

un1meg
View Profile
« Reply #1 on: July 10, 2009, 02:31:48 AM »

From the FIFE perspective, it seems as though we should have a listener in World (or somewhere) that listens to the PC constantly and does things accordingly. I looked briefly at this when I first implemented map changing. The InstanceChangeListener may be appropriate. I didn't really try to get anything to work though. This might just be a lot of overhead though.
Logged

-Meggie
Bretzel13
Community member

Posts: 73



View Profile Email
« Reply #2 on: July 10, 2009, 03:45:35 AM »

I did notice we were getting quite a few approach functions as I was adding another  Grin
I took a look at tZee's ticket and I should be able to merge them into one approach function. It shouldn't be too hard to have it detect the type of object and have it execute the corresponding code
Logged
tZee
Community member

Posts: 190


View Profile Email
« Reply #3 on: July 10, 2009, 09:03:59 AM »

From the FIFE perspective, it seems as though we should have a listener in World (or somewhere) that listens to the PC constantly and does things accordingly. I looked briefly at this when I first implemented map changing. The InstanceChangeListener may be appropriate. I didn't really try to get anything to work though. This might just be a lot of overhead though.

Listen for what? I don't get what you mean/how this is related to scheduling actions.  Roll Eyes
Logged

mvBarracuda
Admin
Community member

Posts: 1120



View Profile Email
« Reply #4 on: July 10, 2009, 09:17:08 AM »

Hmm didn't tie implement some kind of ActionQueue functionality for Rio de hola when PARPG started? I'm pretty sure it's not in SVN right now but the patch itself can be still found in Trac. Might be worth a look (ActionStack.6.patch):
http://parpg-trac.cvsdude.com/parpg/ticket/1
Logged
tie
Community member

Posts: 77


View Profile Email
« Reply #5 on: July 10, 2009, 04:43:37 PM »

There is indeed an ActionStack class (with tests) which I wrote for Rio. This class handled the approaching functionality in Rio, but it can generally be used as a generic action queue.

The ActionStack basicallly allows you to say "run function X until function Y yields this result, then run function Z [until function Q yields this result, then ....]". So, in Rio, instead of running the Kick funciton directly, we  cleared the ActionStack of the hero, and added something like "follow the target until range < 3, then run Kick function".

The ActionStack code can be seen at http://parpg-trac.cvsdude.com/parpg/browser/trunk/game/scripts/agents/agent.py?rev=39. There are also unit tests at http://parpg-trac.cvsdude.com/parpg/browser/trunk/game/scripts/agents/ActionStack_test.py?rev=39.

I don't think the agent movements should be controlled by a world-wide action stack through. I'd rather have an ActionStack for each agent.
Logged
Pages: [1]
Print
Jump to: