Mindwerks / worldengine

World generator using simulation of plates, rain shadow, erosion, etc.
MIT License
982 stars 128 forks source link

AStar error #120

Closed esampson closed 8 years ago

esampson commented 8 years ago

When I run at higher x and y resolutions the program tends to crash with the following error:

Traceback (most recent call last): File "/usr/bin/worldengine", line 9, in load_entry_point('worldengine==0.18.0', 'console_scripts', 'worldengine')() File "/usr/lib/python2.7/site-packages/worldengine-0.18.0-py2.7.egg/worldengine/cli/main.py", line 449, in main args.verbose, black_and_white=args.black_and_white) File "/usr/lib/python2.7/site-packages/worldengine-0.18.0-py2.7.egg/worldengine/cli/main.py", line 27, in generate_world step, verbose=verbose) File "/usr/lib/python2.7/site-packages/worldengine-0.18.0-py2.7.egg/worldengine/plates.py", line 81, in world_gen return generate_world(world, step) File "/usr/lib/python2.7/site-packages/worldengine-0.18.0-py2.7.egg/worldengine/generation.py", line 195, in generate_world ErosionSimulation().execute(w, seed) File "/usr/lib/python2.7/site-packages/worldengine-0.18.0-py2.7.egg/worldengine/simulations/erosion.py", line 64, in execute river = self.river_flow(source, world, river_list, lake_list) File "/usr/lib/python2.7/site-packages/worldengine-0.18.0-py2.7.egg/worldengine/simulations/erosion.py", line 234, in river_flow world.elevation['data'], current_location, lower_elevation) File "/usr/lib/python2.7/site-packages/worldengine-0.18.0-py2.7.egg/worldengine/astar.py", line 229, in find p = pathfinder.find_path(start, end) File "/usr/lib/python2.7/site-packages/worldengine-0.18.0-py2.7.egg/worldengine/astar.py", line 119, in find_path self.o.append(f_node.lid) AttributeError: 'NoneType' object has no attribute 'lid'

psi29a commented 8 years ago

What is for you 'higher'? We need to know more about the parameters you used to duplicate and write tests for please.

esampson commented 8 years ago

This is what I ran that recently caused the error:

worldengine -x 2048 -y 1024 -r --gs --export-bpp 32

I previously ran worldengine -r --gs --export-bpp 32 with no problems. In the past I've had the same problem occur when I've used -x 1024 -y 512, although occasionally it would run successfully.

psi29a commented 8 years ago

Nice to see you taking advantage of the export tool :D Let me know if you encounter issues (in new tickets please).

So the trick is that the x and y are not symmetrical. Great use case. Do you have a seed number? The seed is used to make things deterministic, meaning that I can have WE do the same operations as you tried, and we can duplicate the tests and I can write tests-cases for them.

If you can, please list seeds that are known to cause errors.

Thanks much for the report! :)

psi29a commented 8 years ago

Found the problem: https://github.com/Mindwerks/worldengine/pull/124

psi29a commented 8 years ago

Which was that A* naively assumed that height-map dimensions are symmetrical. This was true when it was used inside of WorldSynth, no longer true in WorldEngine since you can give asymmetric values like height of 128 and width of 64. Now fixed. :)

psi29a commented 8 years ago

Please test!