Phill Djonov | 1 Jun 2010 21:17
Favicon

Re: sparse components

On Tue, Jun 1, 2010 at 10:38 AM, Richard Fabian <raspo1 <at> gmail.com> wrote:
> I've still got a general problem with appreciating joins on tables. I haven't been
> able to look at them without getting scared of the N*M problem, but think that
> most of the joins I would have done in the past on database queries are now
> sequences of selections with decision tables built from previous selections.

I've had similar experience.

One of the titles I worked on used an in-house database engine (with a
real query language built around it). We weren't using it for anything
beyond high-level game data (inventories, shop data, npc spawn data,
dialog trees, any and all data in the UI, that sort of stuff), but
there was still a fair amount of data in it and we found that
sequences of selections is all we really even needed in almost every
case. So much so that we didn't even bother with a proper join syntax
- all we had was something like

select from table1 col1, col2, table2[keycol=col3].valuecol ...

and it never turned out either limiting or a problem. The full
N*M-expand-then-filter case turned out to be, in our case anyway,
ridiculously rare. I think we wrote a loop to take care of it outside
the db engine by hand in the one or two spots it did turn up (which
were easily optimized based on other knowledge about that particular
join which would have been difficult to derive from a raw query). At
any rate, an absurd number of silly loops chock full of crazy
often-fragile logic melted away into simple "foreach result in query,
do action" constructs.

It also made for a *really* elegant server -> client data sharing
mechanism that replaced a large number of ad-hoc encodings (sync
commands, per-entity state bits, other madness). The game knew which
tables had to be kept synchronized, and rounding up the rows which
changed since the last network tick and shuffling them over was one of
the smallest, simplest, and most useful loops I've ever seen.

Cheers!
Phill
_______________________________________________
Sweng-Gamedev mailing list
Sweng-Gamedev <at> lists.midnightryder.com
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com


Gmane