Command proposal: zdestruct
Posted: Sun Jan 16, 2022 11:22 pm
There's been a lot of talk about lag lately and fingers pointed at the number of items in the game. This is my proposal for implementing a player accessed command to remove items.
Name: zdestruct
-- Starts with a z because no other command uses this and it will prevent collisions.
Syntax: zdestruct <item> & zdestruct value <number>
zdestruct <item>
places an item into the destructing state.
zdestruct value <number>
places all, non stationary items laying on the ground in the current room with a value in coppers less than the specified number into the zdestruct state
Mechanics:
Both hides, and flags an item as destructing. Items may be retrieved via search and seen via notice. They will otherwise destruct in at most 10 minutes.
ex:
A lantern has been left here.
A torch is here on the ground.
You notice a lantern is hidden here.
You notice a lantern is hidden here.
You notice a mirrored lantern is destructing here. <<--- the new thing.
Coding:
In theory, you could just stick a 5 minute timer on to each item once it is hit by the zdestruct command. However I'm going to assume this will make all the duct tape fall off and crash the mud. So I'll propose a different hack instead.
Create two tables, table A and table B. Both tables run on 10 minute cycles, out of phase by 5 minutes from each other.
Every 5 minutes the server will purge the death-row table (A or B) and then swap the death-row position with the buffer table.
zdestruct command places items into the buffer table. So minutes 1-5 it's placing into table A. Minutes 6-10, it's placing into table B. At minute 5, table A is purged. At minute 10, table B is purged. Wash, rinse repeat.
patch search command to remove a destructing item from its associated table when found and removed from hiding.
This should result in 1 server call to place an item into the destruction state, and then only one more to destroy it. If you are worried about purging an entire table at once, have mud pulses delete first N rows in active table at a time to average out the performance cost. N = row count at table sawp / number of pulses in the period.
Summary: proposal gives players a straightforward way to schedule items for imminent deletion, a way to retrieve them to rescind errors, and a low cost server side implementation.
Name: zdestruct
-- Starts with a z because no other command uses this and it will prevent collisions.
Syntax: zdestruct <item> & zdestruct value <number>
zdestruct <item>
places an item into the destructing state.
zdestruct value <number>
places all, non stationary items laying on the ground in the current room with a value in coppers less than the specified number into the zdestruct state
Mechanics:
Both hides, and flags an item as destructing. Items may be retrieved via search and seen via notice. They will otherwise destruct in at most 10 minutes.
ex:
A lantern has been left here.
A torch is here on the ground.
You notice a lantern is hidden here.
You notice a lantern is hidden here.
You notice a mirrored lantern is destructing here. <<--- the new thing.
Coding:
In theory, you could just stick a 5 minute timer on to each item once it is hit by the zdestruct command. However I'm going to assume this will make all the duct tape fall off and crash the mud. So I'll propose a different hack instead.
Create two tables, table A and table B. Both tables run on 10 minute cycles, out of phase by 5 minutes from each other.
Every 5 minutes the server will purge the death-row table (A or B) and then swap the death-row position with the buffer table.
zdestruct command places items into the buffer table. So minutes 1-5 it's placing into table A. Minutes 6-10, it's placing into table B. At minute 5, table A is purged. At minute 10, table B is purged. Wash, rinse repeat.
patch search command to remove a destructing item from its associated table when found and removed from hiding.
This should result in 1 server call to place an item into the destruction state, and then only one more to destroy it. If you are worried about purging an entire table at once, have mud pulses delete first N rows in active table at a time to average out the performance cost. N = row count at table sawp / number of pulses in the period.
Summary: proposal gives players a straightforward way to schedule items for imminent deletion, a way to retrieve them to rescind errors, and a low cost server side implementation.