Twisted River Community - Second Playable Revision


I've spent the last three days mostly rewriting the jobs and resources systems and implementing various AI tasks, buildings and UI views.

I've removed scrollable maps and saving and loading (my arch-enemies; I couldn't get them to work in time the last time either :-() from my todo-list and finished everything else except the campaign and balancing.

There's a new revision up.

New screenshots:

[Title Screen]
The title screen featuring a pretty public domain photograph.

[Free Play Screen]
The "Free Play"-scenario. All buildings here are fully functional. :-)

(log in to comment)


I found this game the most engaging of the entries, in spite of (because of?) low framerates and what looks like bugs, like some people getting stuck not doing anything.

I took a peek at the code, trying to see if there was anything that could be done to speed it up, and didn't find much. There was a call to sort using a custom sort function - this could be optimized by generating a new list of tuples (newKey, oldVal), where newKey is the value that your custom sort function would have cared about. Then sort this new list with the default sort routine, and then strip off the newKey values. This is almost always faster than using a callback inside the sort function.

Also, I noticed that there are a lot of functions, and one of Python's weaknesses is function call overhead - the game could be made somewhat faster by removing functions that just serve as accessors for "private" member fields.

I suspect, though, that where most of the time is going is the pathfinding. I see that the pathfinding is deliberately noisy, to reflect the "mind" attribute of the person, but perhaps there'd be some way to cache the paths so that frequently traveled pathways wouldn't require a full A* search each time. Or, if not, only do a partial A* search each tick.

Just some suggestions - I'd love to see this game polished up and posted to the Pygame website.