MUD-Dev
mailing list archive
[ Other Periods
| Other mailing lists
| Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
[MUD-Dev] optimizing code
This is in reply largely to a recent post by Mr. Gray. In it, he mentioned
that a significant part of his processor overhead was due to his 150
mobiles all moving about every 2 seconds.
Mobile ai is the biggest pain in my neck, and I'd love to hear ideas on
how to improve them generally while retaining most or all of the
functionality.
Essentially, our mobiles have two "timers" attached to them. One covers
attacking and one covers most other things. Every half-second, the code
decrements each timer on every mobile. If the timer is up, it checks to
see if the mobile should be doing something (either attacking someone or
doing whatever else). Now, our actual routines are not that complicated.
Quite a few mobiles (mountain lions, elk, rabbits, thugs in the sewers,
etc) wander around randomly, but other than that, mobiles that are not
directly involved with a player (and aren't wounded or whatnot) don't do
much.
I cannot really think of a better way to do this in principle and I'm
wondering if any of you can. I use a custom language and compiler, so keep
that in mind when offering language-specific suggestions. I'm sure some of
you clever coders out there have much better ways of doing things, and I'm
sure many of us could benefit from your knowledge. Thanks!
--matt
- Thread context:
- [MUD-Dev] World-file parsing and RTTI?,
The Arrow arrow#trelleborg,mail.telia.com, Wed 10 Feb 1999, 18:45 GMT
- [MUD-Dev] Re: optimizing code,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Wed 10 Feb 1999, 02:41 GMT
- [MUD-Dev] code profiling,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Tue 09 Feb 1999, 06:00 GMT
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Tue 09 Feb 1999, 03:31 GMT
[ Other Periods
| Other mailing lists
| Search
]