Hello Guest

Problems with Rendering Multiple Entities

  • 20 Replies
  • 23771 Views
Re: Problems with Rendering Multiple Entities
« Reply #15 on: July 09, 2012, 13:00:35 »
It looks like Entity.tick() can remove itself from the entities list? If that's the case, then you would need to keep a separate list of entities that were deleted and delete them after running through the tick() loop. Alternately, if an entity can only ever delete itself, you could do a reverse 'for' loop (instead of a foreach) which would keep the removed item from affecting the tick() loop.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Re: Problems with Rendering Multiple Entities
« Reply #16 on: July 14, 2012, 22:55:01 »
Only problem I can see with that is the fact that it would seem EVERYTHING needs to run through the tick() loop to actually run. I'll see what I can engineer, and maybe I'm not understanding it quite right, but let's see.
Coder, Mastermind, Friend

Re: Problems with Rendering Multiple Entities
« Reply #17 on: July 19, 2012, 18:10:53 »
I'm not figuring it out. Anyone else have an idea on how to fix this?
Coder, Mastermind, Friend

Re: Problems with Rendering Multiple Entities
« Reply #18 on: July 19, 2012, 18:18:06 »
This question seems to have morphed. Can you restate the issue you're working against now?

Re: Problems with Rendering Multiple Entities
« Reply #19 on: July 19, 2012, 23:24:25 »
Sorry, your right...
I'm working against a ConcurrentModificationError
Coder, Mastermind, Friend

*

Offline basil

  • **
  • 81
Re: Problems with Rendering Multiple Entities
« Reply #20 on: September 03, 2012, 23:02:44 »
you have probably a nested remove() in a iteration over the list itself.

you can use a list or set that works with concurrent access or you have to que all read and write properly in you game loop.