Up to Main Index Up to Journal for March, 2020 JOURNAL FOR FRIDAY 6TH MARCH, 2020 ______________________________________________________________________________ SUBJECT: A fortuitous bug DATE: Fri 6 Mar 16:33:32 GMT 2020 TLDR: Players can now kill other players… Recently I’ve been procrastinating over combat and health in WolfMUD. Now and again I’d open up my editor and poke at the code, try out a few ideas. Still I didn’t have a way of one player being able to execute commands for another player. For example if one player kills another player the dead player should execute the QUIT command. Wednesday evening, during one of my experiments, I noticed something odd. I had killed another player and that player had been removed from world. I couldn’t see them at the location where they were killed, the WHO command showed only me on the server and the logs showed the player had been saved when they died. Using the #DUMP command on the location confirmed the dead player was no longer there. However, in the TELNET session for the killed player I could still watch what was going on and use most commands — oddly I couldn’t move around and leave the current location. It turned out that the dead player had a stale back reference to the location through their Locate attribute. This was due to attr.Inventory.Remove not setting attr.Locate.Where to nil. This bug has now been fixed. This bug gave me an inkling of an idea. Would it be possible to use the fact that a player is no longer in the world as a signal that they have quit? Currently cmd.state returns the command just executed. This is received by the frontend which checks for QUIT being issued and uses it as a signal to return the frontend to the main menu. This is the crux of my procrastination — if the command to QUIT didn’t come from the frontend in the first place it wouldn’t be returned to the frontend — so no signal to quit when a player is killed. For the remainder of Wednesday evening, and then Thursday evening, I hacked away on the frontend, cmd.state and the HIT and QUIT commands. By the end of it players could hit, and now kill, other players :) North bridge You are standing on the west side of an incomplete bridge. By the looks of it the city wants to expand onto the far banks of the river. Down river to the south you see another bridge in a similar state of construction. You see Diddymus here. The only exit you can see from here is west. H:30/30> Diddymus hits you. H:25/30> Diddymus hits you. H:20/30> Diddymus hits you. H:15/30> Diddymus hits you. H:10/30> Diddymus hits you. H:5/30> Diddymus hits you. Diddymus killed you! ______ / \ / \ | R.I.P. | | | | | | | __|________|__ You have been saved. You leave this world behind. [Press Enter for Main Menu] Main Menu --------- 1. Enter game 0. Quit Select an option: > The actual changes I ended up committing were surprisingly small. I had my simple solution at last — without having to overhaul the frontend and comms packages :) One minor update, the HIT command can no longer be used in a crowded location. There are still a few glitches I’m working on — once killed a player just sitting at the main menu will regenerate health. A killed player will still emit “gives a strangled cry of ‘Bye Bye’, slowly fades away and is gone.” when they are killed. The code also needs some refactoring and the tombstone seen above is hard coded. My changes to the prompt code have also broken a lot of tests, which I’m now fixing. However, everything seems to be working and is now on the public dev branch. Having solved this problem, I can now start working on all the other features proper combat is going to need. After sorting out the aforementioned glitches first of course. -- Diddymus Up to Main Index Up to Journal for March, 2020