![]() ![]() The simplest way to do this is to keep an object that is indexed by process ids or names and contains processes. These components are also commonly found in OS, usually to help abstracting things further.Ī process table is a way of managing currently running processes on the kernel or scheduler. It will commonly offer an API to interact with the OS as a whole (for example a tick() method to run everything) or partially (for example adding processes to run and similar). The kernel is usually the entity that keeps the whole system together. The scheduler manages execution order of processes and will generally offer some way for the kernel to get the next Process to run. processes generally have at least some sort of id (for the instance), a name (the process "type") and a priority (or ordering purposes) attached. The logic is usually executed by a run() method. Process (runnable entity) Ī process contains logic for a certain part of the bot, like a module in a non-OS bot. These are the fundamental components that you will definitely find in one form or another in any Screeps OS. ![]() Other than these three there are a lot of different names for similar concepts and seemingly endless possibilities to name/design the details of the system. ![]() The most common components are process, scheduler and kernel. At some point your process will rise enough in priority to be run. You can prevent this "starvation" of the logic in OS very easily by increasing the priority of processes that have not run in a while. The remedy for this is usually to work based on bucket levels and deactivate parts of your code base. The great thing about a working OS is that this is all there is to managing code execution order and CPU: The OS manages everything for you in the background.Ī quick example for CPU management: If you are at your CPU limit constantly and your ticks get cut off because your bucket is empty you might not ever run logic that you put at the end of your main loop. All game logic is usually contained or referenced in these processes, then the programmer assigns priorities to the processes and decides when to start them. Once a player is at that point they either stick to the concept or start abstracting the different modules more.Īn OS style bot is based on processes. Usually at a certain point of logic complexity this gets out of hand though. For beginners, starting with a tutorial code style bot, it is very easy: They decide in what order things should run and then just write a chain of if-else/switches to accomplish this order. General philosophy Įvery Screeps player has to decide in what order the different modules of their code base will run. 2.1.2 Scheduler (decides what to run next). ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |