Jump to content

How do you handle tasks


Rick
 Share

Recommended Posts

If i understand correct - you all talking about that i calling "messages system".

 

Each active object on creation adds to "listeners list"

They are all have one same method OnMessage(msg), string name and string class

 

I have global function send(name,class,msg,delay)

Message adds to "messages list"

 

In main loop i run messages list

decrace each of it delay value

and if delay became to be zero

compare name\class of message adres and "listener"

if all cool, just call listener method OnMessage with current message object

all done, message sent to all fits objects, removes it from messages list

 

So i can sending messages with delay, and no need to warry abut - when entity will be broken by peaces, when fire sprites to be respawn, sound, etc...

 

It's like Leadwerks messages system, but little updated to handle delay and possible to send many messages per iteration to one object.

 

I have one try to gather Last Chapter with such "messages system", where i'm not acessing to objects directly, all stuff only by messages, and it works good and fast for Last Chapter gameplay.

 

And in the end i'm get separate classes of all objects in world as usual, but they totaly movable from one project to another - without any warry for methods compatibility. If another project don't generate messages - this class will stay silent, if project trying to call unknown method of such messaging-class - just nothing happens, no any crashes.

 

As for me it's best issue with my developements, and when i will return to making gamplay will be use this system.

 

I hope you understand me wink.png

"Better" is big enemy of "good"

Link to comment
Share on other sites

If i understand correct - you all talking about that i calling "messages system".

 

Each active object on creation adds to "listeners list"

They are all have one same method OnMessage(msg), string name and string class

 

I have global function send(name,class,msg,delay)

Message adds to "messages list"

 

In main loop i run messages list

decrace each of it delay value

and if delay became to be zero

compare name\class of message adres and "listener"

if all cool, just call listener method OnMessage with current message object

all done, message sent to all fits objects, removes it from messages list

 

So i can sending messages with delay, and no need to warry abut - when entity will be broken by peaces, when fire sprites to be respawn, sound, etc...

 

It's like Leadwerks messages system, but little updated to handle delay and possible to send many messages per iteration to one object.

 

I have one try to gather Last Chapter with such "messages system", where i'm not acessing to objects directly, all stuff only by messages, and it works good and fast for Last Chapter gameplay.

 

And in the end i'm get separate classes of all objects in world as usual, but they totaly movable from one project to another - without any warry for methods compatibility. If another project don't generate messages - this class will stay silent, if project trying to call unknown method of such messaging-class - just nothing happens, no any crashes.

 

As for me it's best issue with my developements, and when i will return to making gamplay will be use this system.

 

I hope you understand me wink.png

Aily, that is exactly how I have handled communication between C++ game objects in the past, and would recommend that.

 

However, I would not recommend that for Lua because Lua has additional flexibility that allows more direct options. We can actually check to see if an entity has a specific script attached, and we can also check to see if a script attached to an entity contains a function. This would not be possible in most languages, unless you used reflection, and even then it would not be as versatile. We can also call Lua functions with any number of parameters, regardless of how many parameters the function is declared with.

 

So for Lua instead of sending a "message" to another entity, I would just call the function directly. You can add a check if you aren't sure it will be present. Basically you're just getting rid of the message receive function and going directly to the function it would have called anyways, so the messages are just an extra unnecessary layer.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 2 years later...

hi i read so much in the forum and i comming to my questions nearly ,the thing is how i connect attack animations with hurt animations is there someone who gives me an example more abbout this with c ++ or lua or i must finished the animation in blender and connected with controller and import than to leadwerks

 

http://www.leadwerks.com/werkspace/topic/11877-online-battle-players-vs-players-connect-attack-with-hurt-animations/

Link to comment
Share on other sites

I tend to gravitate to finite state machines quite naturally and I'm working on my RPG framework as we speak (full time job permitting....)

 

The way I'm handling it is for each state to go through three stages intro, main, exit, in theory any or all of the stages can be null.

 

For example rather than just teleport the player intra-map or inter-map the intro stage will do the nice anim stuff, the main actually moves the player and the exit an outgoing anim.

 

At present I'm focussing on the player states and getting them all to hang together but the same applies to other stuff as well. Trigger a spawner and intro does the "I'm going to spawn something" anim, the main creates the spawned but I've left the exit null. This is because the spawned entity intro is null, the main just gets its necessary info from its spawner but it has an exit anim which leads into normal movement/behaviour. I get my full desired effect from a combination of the spawner and the spawned.

 

One useful thing is that a stage may or may not introduce a delay before hitting the next stage, very useful for synching up anims.

content over form, game play over all.

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...