Jump to content
  • Advertisement
Sign in to follow this  

Do you keep a collection of handles in your game for your components

This topic is 915 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 sometimes would want to change the execution order of the components,

for example, if every component exposes the update and lateupdate methods to the outside world,

I would want to have the transform component to execute last,

so the AIMover had already placed the agent to the correct location,

after that the transform component will take the location and transform that object and it becomes

the world matrix of the object.

Same philosophy applies to lateupdate.

your opinions please?



Share this post

Link to post
Share on other sites

Thanks for the comments, I need a fix for my spaghetti kind of data flow of my game for sure.

Edited by lucky6969b

Share this post

Link to post
Share on other sites

An approach I found very useful is to have flexible execution order at the high level (aka manager) system and then a second "bucket" based system for different kind of game objects/entities.

Share this post

Link to post
Share on other sites

This is perhaps a shameless plug, but when I first learned about ECS I tried writing my own framework, and I implemented a way for the user to specify execution dependencies:



In my project, the dependency tree is resolved and flattened into a linear ordered list of systems to execute. Thus, when calling world.update(), I only have to iterate through the list and call system->update(). This sounds like the exact thing you need. It might also be a possibility to flatten the dependency tree into multiple lists of systems, where each list contains systems that can be executed in parallel. Just a thought.

Share this post

Link to post
Share on other sites

You could always just make each function have a dependency tree,

so maybe something like

class CComponent

  void AddTickPrereq(CComponent* Component, ETickGroup Tick)
  void RemoveTickPreReq(CComponent* Component)

CComponent* SomeComponent = new CComponent()
CComponent* PostComponent = new CComponent()
//set the tick prereq

//some where prior to ticking all game objects
std::vector<CComponent*> TickComponents

for(Component : GetAllSceneComponents())
    TArray<CComponent*>& PreReqs = Component->GetPreReqs()
   //add all pre reqs
   for(PreReq : PreReqs)
       //make sure it doesn't already exist in update list
   //now add this component

//now you can tick all components in the proper order
for(auto Component : TickComponents)

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!