[Feature] Spacephobia returns. More efficient. - Printable Version +- Goonstation Forums (https://forum.ss13.co) +-- Forum: Discussion (https://forum.ss13.co/forumdisplay.php?fid=6) +--- Forum: Patches (https://forum.ss13.co/forumdisplay.php?fid=30) +--- Thread: [Feature] Spacephobia returns. More efficient. (/showthread.php?tid=11458) |
[Feature] Spacephobia returns. More efficient. - kyle2143 - 01-21-2019 I've heard that before it was removed, spacephobia was super inefficient because it looped through all the things that a mob could see to look for a space tile. This completely does away with that. Now, it just takes a random turf within a radius of the player. If it's a space tile (even if they can't see it) then they have a chance to suffer the effects of the phobia. (I didn't change the actual effects, but I upped the probability of them to account for the lower probability of randomly hitting a space tile near you). This stuff is the pr description:
Video: https://streamable.com/9ome8 You can take or leave it. Personally, I never liked spacephobia at all and don't mind if it never comes back. But lack of efficiency for something that can easily be made more efficient should not be a reason to remove something. https://github.com/goonstation/goonstation-2016/pull/104 RE: [Feature] Spacephobia returns. More efficient. - Firebarrage - 01-23-2019 This should include a check for visibility - otherwise it is far too debilitating. I cant think of many places on the popular stations where you arent within 1 screen of space at all times. RE: [Feature] Spacephobia returns. More efficient. - kyle2143 - 01-23-2019 (01-23-2019, 06:57 AM)Firebarrage Wrote: This should include a check for visibility - otherwise it is far too debilitating. I cant think of many places on the popular stations where you arent within 1 screen of space at all times. That's not how this patch works. I think I've explained it poorly. This patch does not have exactly the same effect as old spacephobia, but instead does what I considered to be a close approximation of it which is far more efficient in terms of runtime complexity. Let me compare the way it used to work before removal with how it works in this patch. Old Spacephobia: - Every life tick, search through view() on the mob and if a turf/space is found, then you have a chance to suffer from the screaming/fainting effects of space phobia. - Searching through view means looping through every object within some given radius of the mob. A human player can see I think 7 tiles in each direction. So that means the view proc is checking an area 15x15; worst case scenario, that's about 200 tiles. What's more, it loops through the objects found on those tiles tiles too. This is horribly inefficient. For further information about how view works, see Lummox JR's response in this thread: http://www.byond.com/forum/?post=2130277 My Spacephobia: - The key part of this patch is that it does not use the view proc, nor does it use any loop at all. Instead of checking all visible tiles within a radius, it checks only one. This is the benefit of my spacephobia over the old one. The runtime complexity of generating a random number is O(1), compared to the O(n^2) of view. - The negative side of my patch is this. It doesn't matter if the mob can see a space tile. Checking if the random tile selected is viewable by the mob would completely negate the performance improvement that this method I've chosen provides. - So because it randomly chooses a tile near the mob, this means that the more space tiles there are around the mob, the more likely they are to be scared and scream/faint. - Lastly, (I said this on discord, but not in my thread here) the radius range is up for debate and change, as are the probabilities (I had the probabilities high for testing and just left them as such, they should probably be lowered). Presently the radius I'm using is 5 tiles. It's hard for me to say without playtesting a good deal, but I think any range between 3-6 could work. RE: [Feature] Spacephobia returns. More efficient. - Frank_Stein - 01-23-2019 Three makes sense for range. That is just far enough that if you were standing by a glass window to space, it would trigger. Granted, this would also trigger if the space tile was near a solid hole. You could handwave that as the Crewmembers spacephobia being bad enough they didn't even like having only one wall between them. I suppose you could also run another tile check, after the first is selected, you could check tiles near it for more space tiles before triggering. Overall longer than one tile, but still much less than 200 RE: [Feature] Spacephobia returns. More efficient. - ZeWaka - 03-11-2019 another idea for revamp, not necessary just a random idea you could just rename it to vaccumphobia, and just check if the room they are in is spaced |