In my current project, it is time for me to think about the world timer. I'm not sure what Byond is capable of, and I don't want to start creating something in depth that I will have to destroy and start all over again with. I know I need a world timer, for MUD ticks, but I'm not exactly sure what I can get away with. Here is a list of some of the things that require it:
Movement: I'd like for every movement command to be processed at the minimum of once every two seconds. This goes for PCs and NPCs.
Combat: Combat continues automatically once initiated, tbough certain moves, etc can be executed while in combat. I want combat to be based on the same timer as movement.
Events: Most events need to be timer sensitive (especially scripted events), though some need not be.
Anyway, I'm curious curious what all the possibilities and repercussions of a system like this are. This is a text-based game, no turfs yet, so I can't use view() or anything to keep NPCs etc from running AI when it is pointless for them to. If anyone has any comments or suggestions about this aspect of a game, I'd really appreciate it.
=$= Big J Money =$=
ID:153045
Mar 10 2005, 3:56 pm
|
|
Basically, when the command like sleep() and etc. is called, each BYOND tick is a tenth of a second. So 10 ticks would be 1 second, etc.
Use basic math skills and you'll work out a nice timing system for your game. For your movement, it's a simple enough thing of using a variable and changing the variable as the guy moves. So when he's moving, make sure he can't execute the move command again while moving, to stop him from running around speedy-like. Use sleep() and check the variable, etc. Combat should be no problem as long as you include things like sleep() and do checks on commands etc. Same again, good use of if() and sleep() will enable you to do this. |
~X