I am studying entity indexed components and came up with a naive C++ implementation which just iterates over all entity "hash tables" and applies update/delete/insert functions in place. I'm having trouble maintaining a logical view of the game world (i.e. updates shouldn't be visible while iterating) and there is no attempt at maintaining spatial or temporal coherence of data.
I wonder whether there are libraries suitable to store components that are commonly found in games (position, movement, hp etc.) and allows ~500 queries per second on a netbook class computer over a database of ~10000 components total. Or is this even feasible? How much I can accomplish with this approach?
In essence I want to be able to do something like this with reasonable efficiency:
moving_update(DB) :- alive(DB,A),alive(DB,B),wontcollide(DB,A,B),
move(DB,A),move(DB,B).
wontcollide(DB,A,B) :- get_component(DB,position,A,PA),
get_component(DB,position,B,PB),...
move(DB,A) :- get_component...,update(DB,position,A,NewP).
DB=loadgame();
loop{ moving_update(DB); blow_stuff(DB); collect_loot(DB);...}