Skip to main content
Added an answer to the (revised) second question.
Source Link
vijoc
  • 411
  • 2
  • 7

RenderingSystem running every Update while AI Systems are running each 100ms.

This shouldn't be a problem. For example, simply have your AI systems accumulate the delta passed to them, and only take action when it exceeds 100ms. I.e. four (dramatically unstable fps) loops could look like this:

aisystem.update(20ms) -> 20ms
aisystem.update(21ms) -> 41ms
aisystem.update(60ms) -> 101ms, take action -> 1ms
aisystem.update(20ms) -> 21ms

Most likely this is not the best way to go about it, but it is one possible implementation.

Or maybe I'm overcomplicating things and should do something different instead of "jumping" between systems?

As for your second questionCorrect, I reallyyou don't understand what seemswant to be the problemjumping between systems. It seems to me thatThe way I see it, you described one system, not a perfectly valid way to movegroup of systems. This one system could be called something like AiMovementSystem. And it simply does what you described in your question. I believe you are a bit confused with the unitsdefinition of System. A System basically iterates through a group of Entities with correct Components -- you don't have a movement system for each entity that should move.

RenderingSystem running every Update while AI Systems are running each 100ms.

This shouldn't be a problem. For example, simply have your AI systems accumulate the delta passed to them, and only take action when it exceeds 100ms. I.e. four (dramatically unstable fps) loops could look like this:

aisystem.update(20ms) -> 20ms
aisystem.update(21ms) -> 41ms
aisystem.update(60ms) -> 101ms, take action -> 1ms
aisystem.update(20ms) -> 21ms

Most likely this is not the best way to go about it, but it is one possible implementation.

As for your second question, I really don't understand what seems to be the problem. It seems to me that you described a perfectly valid way to move the units.

RenderingSystem running every Update while AI Systems are running each 100ms.

This shouldn't be a problem. For example, simply have your AI systems accumulate the delta passed to them, and only take action when it exceeds 100ms. I.e. four (dramatically unstable fps) loops could look like this:

aisystem.update(20ms) -> 20ms
aisystem.update(21ms) -> 41ms
aisystem.update(60ms) -> 101ms, take action -> 1ms
aisystem.update(20ms) -> 21ms

Most likely this is not the best way to go about it, but it is one possible implementation.

Or maybe I'm overcomplicating things and should do something different instead of "jumping" between systems?

Correct, you don't want to be jumping between systems. The way I see it, you described one system, not a group of systems. This one system could be called something like AiMovementSystem. And it simply does what you described in your question. I believe you are a bit confused with the definition of System. A System basically iterates through a group of Entities with correct Components -- you don't have a movement system for each entity that should move.

Source Link
vijoc
  • 411
  • 2
  • 7

RenderingSystem running every Update while AI Systems are running each 100ms.

This shouldn't be a problem. For example, simply have your AI systems accumulate the delta passed to them, and only take action when it exceeds 100ms. I.e. four (dramatically unstable fps) loops could look like this:

aisystem.update(20ms) -> 20ms
aisystem.update(21ms) -> 41ms
aisystem.update(60ms) -> 101ms, take action -> 1ms
aisystem.update(20ms) -> 21ms

Most likely this is not the best way to go about it, but it is one possible implementation.

As for your second question, I really don't understand what seems to be the problem. It seems to me that you described a perfectly valid way to move the units.