Advertisement Jump to content
Sign in to follow this  

Having one mover per game object is unstandable...

This topic is 595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'd rather having singleton for each type of mover because

if I had 1000 game objects, I would have 1000 such movers flying around in the system.

If I had 2 types of movers for each game object, I'll have 2000 movers....

This is keeping to grow exponentially....


But Having said that, when using a singleton for mover types,

I need to setup the owner of each request, because I push them into threadpool,

when it comes out, I don't know whose is whose.


The problem I come up with this, is when I forgot to set owner, or forgot to set it,

everything will be screwed up...


I really don't want to give the mover some unnatural arguments, because I'm just interested in the results afterall.

But I really hate to setup the owner for each request...

Your opinion please?



Edited by lucky6969b

Share this post

Link to post
Share on other sites

It's not clear what you mean by 'mover', or why you might need more than one per game object, or why it would grow exponentially instead of linearly. It's also not clear how the threadpool factors into this, or what the requests do.

Could you please explain this more specifically?

Share this post

Link to post
Share on other sites

If the question is, "how can I ensure asynchronous pathfinding requests know who submitted them" then the answer is trivial; force the request to include the submitter. You say you "hate to setup the owner for each request", but that should not be difficult - just pass in a pointer - so there is presumably something else that you aren't telling us which makes this awkward.

If you're worried that the object doing the request might get deleted before the request comes back, you can use a weak pointer, or you could store an ID or a name instead of the pointer.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!