|Random Placement Test|
|Posted By: treellama||Date: 7/12/13 7:26 a.m.|
I made a simple level in Pfhorte, with rooms to the north, east, south, and west. I put a BoB in each room, and a player in the middle. Next I set the initial count for BoBs to 1. Finally, I ran each test 50 times in both Marathon and Aleph One--the limit of my patience.
An ideal random placement algorithm would spawn a BoB in each room 25% of the time. As anybody who's played House of Monkey (or just read the source code) knows, Aleph One's (Marathon 2's / Marathon Infinity's) placement algorithm is not ideal. The way it picks a random location is by picking a random saved object of any type; then if that object is not the right type, it just increments until it finds one.
In the case of my test map, the saved objects are:
Because of this, I expect a 40% chance of bob appearing in the north room (since if the game chooses 0 or 1 for the random number, it will end up on 1), and a 20% chance of bobs appearing in the other rooms.
What I get from Aleph One is:
Close enough, given how bad the actual random number generator already is.
I repeated the same test in Marathon:
To really verify that Marathon placement really does work that way, I put a bunch of pistol ammo in the map. Now the items are:
I expect the chances of BoB to be in the north room are 14/17, 82%! And only a 6% chance for BoB to appear in any of the other rooms.
Results from Aleph One:
It's clear that Marathon and Aleph One are using the same (awful) random placement algorithm.
Can someone think of something else that might be at work to make Hamish think something is wrong?
|Random Placement Test||treellama||7/12/13 7:26 a.m.|
|Re: Random Placement Test||treellama||7/12/13 7:27 a.m.|
|Re: Random Placement Test||Godot||7/12/13 8:44 a.m.|
|Re: Random Placement Test||treellama||7/12/13 12:07 p.m.|
|Re: Random Placement Test||poena.dare||7/12/13 7:36 p.m.|
|W T 1111 *NM*||treellama||7/13/13 2:28 a.m.|
|Re: Random Placement Test||Godot||7/13/13 3:05 a.m.|
|Re: Random Placement Test||treellama||7/13/13 3:46 a.m.|
Problems? Suggestions? Comments? Email firstname.lastname@example.org
Marathon's Story Forum is maintained with WebBBS 5.12.