Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Feature] Spacephobia returns. More efficient.
#1
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:

  • Picks a random tile within some radius given by the programmer and checks if it's a /turf/space. If it is OR if our radius is touching the map edge, then we trigger the effects.
  • Only works on the station z-level. Because I use hardcoded for the map size for that z-level (300x300). I think there might be a map.size or something where I could get those for any z-level, but I can't find it.
  • There is a tick counter so that it will only run the logic every X number of ticks. I have it set to run like each 4 or 5 times I think.
  • I increased the probability for a faint or scream emote. But that can change.
(This video is super boring, only watch if you want proof that it works.)
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/goonstati...6/pull/104
#2
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.
#3
(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.
#4
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
#5
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


Forum Jump:


Users browsing this thread: 1 Guest(s)