A recent thread at TIGsource on procedural map generation (here -- http://forums.tigsource.com/index.php?topic=5174.0) encouraged me to try my hand at it in pyglet. However I would describe myself as an enthusiastic but hack hobbyist when it comes to programming, so I'd greatly appreciate any feedback anyone has on the program I wrote in order to improve it.
Here it is at pastebin: http://pastebin.com/m27fa5e72 Some specific questions I have: 1. Right now it seems like I repeat a lot of code to generate the map at each resolution, but each block of code is slightly different enough that I'm not sure how to abstract the process. Any tips on this? 2. The generation code requires some hand tweaking if for example the map size is changed. Is there a more general way to write the generation such that this tweaking wouldn't be necessary? 3. Since the generation itself takes a couple of seconds, I want to immediately draw the window and a loading screen when the program is run. My current method for this is to schedule a one-shot function (generate) which creates an instance of the Map class (which does all the generation) and then call pyglet.app.run(). So while the Map class does its work the loading screen (just a text label) is drawn to the window. This seems kind of convoluted, so is there a better way to structure the program to display a loading screen while the script generates the actual map? 4. Currently, at each resolution of the map each tile is represented by a single sprite. I'm doing this so all the tiles can be rendered in a batch for each resolution. This seems OK but I feel like there would be a simpler (and faster?) method. Any advice? Of course any and all comments on the code would be great. Thanks for any feedback! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
