Jump to content

Which NPC gets to move first?


nonzerozen
 Share

Recommended Posts

My understanding of writing a game loop is that you have to loop through all the objects who need to react and update each loop. Looping though a collection of something usually implies an order of execution.

When making a sports simulation game where all the players are NPCs, who gets to move first or last can have significant tactical advantages/disadvantages. In real life we move and act independently and in real time,

but with a game loop the NPCs are at the mercy of the developer and the order they choose.

So my question is, how do you decide which NPC gets to move/react first?

Link to comment
Share on other sites

Right. Because the NPCs are not rendered individually in individual game loops. They are all rendered in the same loop iteration. It doesn't matter which one gets to update itself based on the current state, because they will all update based on the same state, at the same iteration of the game loop. So it really isn't an issue.

Obviously. :D

Thanks. Don't know what I was thinking.

Link to comment
Share on other sites

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...