[MUD-Dev] Ticks?
Daniel.Harman at barclayscapital.com
Daniel.Harman at barclayscapital.com
Fri Jun 14 17:27:17 CEST 2002
From: shren
> Of course, if you're compulsively going for speed, and are doing
> things in C or C++, you can always stick everything that
> regenerates on a tick in the same memory block, in two parts - the
> rate and the current level. Then the tick thread can live in that
> memory block and not even look at the whole player.
...
> It's probably not the best way, but something about this
> particular inelegance I find elegant. I wonder if it would help
> speed, and by how much, and how much of a pain in the arse it
> would be to code.
Well in terms of cache coherancy you might get some benefit, hell
you could probably use some MMX type instructions (or try vector C
which is meant to do it for you).
If you were really nuts about doing this, you might try and maintain
separate ordered list of creatures at different regen rates as then
you wouldn't have to do a lookup on rate for each update. You could
simply do it once per set, and this might make the MMX aspect more
viable (as I don't think the interleaved data would work, but I know
very little about the extended instruction sets).
Downside is that its just ghastly to maintain (referencing issues,
inserting new players/mobs into the list...). I could see it being
an option if you were really struggling with CPU time, and it was
all being burnt up by regen ticks, but only as a last resort
optimisation. I'm guessing the 80/20 rule would probably say this is
a waste of time and when you are up at 3am debugging some issue with
player/mob hp for the 30th time, you might agree ;)
Dan
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list