Elysian
Programmer
- Dec 6, 2018
- 172
- 43
- 0
So for the past couple of days I've been trying to look into how RuneScape handles various "Actions" or "Tasks" not sure which term to use but an example of these things would be
- Equipping armour (unequipping as well(?))
- Opening a door
- Burying bones
- Eating food
And I'm not sure I got the right idea.
My observations from the actual game is that..
- I can equip multiple items on tick 1 and they all get equipped on tick 2. (certain "actions" of the same "type" can be batch processed?)
- I can perform certain "actions" in 1 tick and they get processed the next tick
e.g: (Equip item -> click on door) and they both process the next tick
- I can't perform certain "actions" in 1 tick and they get processed the next tick
e.g: (Click on door -> equip item) but only the equip will process (guessing equip item has some sort of higher priority?)
Based on my understanding here's what seems to be going on.
RuneScape dictates certain rules for certain actions.
For instance, you're not allowed to bury more than 1 bone per I think 2 ticks, not sure if there is an override or just upright ignore the second action, either way it would have the same effect.
You can queue multiple actions on tick 1 and they will execute together, unless one of the actions has a super high priority (which clears the rest?)
e.g: these were all queued the same tick
-> BURY BONE (LOW)
-> EAT FOOD (LOW)
-> EQUIP ITEM (HIGH)
-> OPEN DOOR (LOW)
The next tick it would only process everything up until (and including) the HIGH one and discard the rest?
Now this is all based off of my observations in-game as well as a brief discussion on Discord.
But am I on the right track here or am I completely off?
This is the structure of how everything should flow in my head at least.
Here's a basic implementation I've done to handle the limitation of actions that the player can perform.
I've not implemeted any sort of ActionPriority yet, because I wanted to make sure that what I had for now was at least on the right track.
https://github.com/PtrStruct/Genesis
It works with James 317 refactored client if you want to boot it up, just remember to grab the 317 cache from OpenRS Archive.
https://github.com/Jameskmonger/317refactor
And as a sidenode, in my head, the term "Event" is just an action which loops, for instance, fletching a log into a bow, but done over the course of all the logs in your inventory.
Also, no idea how this all ties together with animation stalling etc (if it even does lol)
Feel free to correct me as much as you want, I'm here to learn so the more information the better!
Visual representation of the current implementation
- Equipping armour (unequipping as well(?))
- Opening a door
- Burying bones
- Eating food
And I'm not sure I got the right idea.
My observations from the actual game is that..
- I can equip multiple items on tick 1 and they all get equipped on tick 2. (certain "actions" of the same "type" can be batch processed?)
- I can perform certain "actions" in 1 tick and they get processed the next tick
e.g: (Equip item -> click on door) and they both process the next tick
- I can't perform certain "actions" in 1 tick and they get processed the next tick
e.g: (Click on door -> equip item) but only the equip will process (guessing equip item has some sort of higher priority?)
Based on my understanding here's what seems to be going on.
RuneScape dictates certain rules for certain actions.
For instance, you're not allowed to bury more than 1 bone per I think 2 ticks, not sure if there is an override or just upright ignore the second action, either way it would have the same effect.
You can queue multiple actions on tick 1 and they will execute together, unless one of the actions has a super high priority (which clears the rest?)
e.g: these were all queued the same tick
-> BURY BONE (LOW)
-> EAT FOOD (LOW)
-> EQUIP ITEM (HIGH)
-> OPEN DOOR (LOW)
The next tick it would only process everything up until (and including) the HIGH one and discard the rest?
Now this is all based off of my observations in-game as well as a brief discussion on Discord.
But am I on the right track here or am I completely off?
This is the structure of how everything should flow in my head at least.
C#:
public static void Process()
{
/* 1. Fetch Data */
CollectPlayerPackets(); /* <- Reads data from the client */
ProcessPackets(); /* <- Creates "Actions" based off of the data */
/* 2. Process Actions / Interactions */
ProcessActions();
/* 3. Process World Updates (Spawn Ground Items etc.) */
/* 4. Process NPC Movement */
/* 5. Process Player Movement */
/* 6. Combat */
/* 7. Client Visual Updates */
PlayerUpdateManager.Update();
/* 8. Flush and Reset */
FlushAllPlayers();
Reset();
}
Here's a basic implementation I've done to handle the limitation of actions that the player can perform.
I've not implemeted any sort of ActionPriority yet, because I wanted to make sure that what I had for now was at least on the right track.
https://github.com/PtrStruct/Genesis
It works with James 317 refactored client if you want to boot it up, just remember to grab the 317 cache from OpenRS Archive.
https://github.com/Jameskmonger/317refactor
And as a sidenode, in my head, the term "Event" is just an action which loops, for instance, fletching a log into a bow, but done over the course of all the logs in your inventory.
Also, no idea how this all ties together with animation stalling etc (if it even does lol)
Feel free to correct me as much as you want, I'm here to learn so the more information the better!
Visual representation of the current implementation
Last edited: