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


Messages In This Thread
RE: [Feature] Spacephobia returns. More efficient. - by kyle2143 - 01-23-2019, 08:27 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)