Bones' Blog of Stuff About Things

01 Aug

August-ish Start

Light progress made today. I just fixed up the broken navigation links, tidied a bit of code and fixed a bug in the caching that was caused by me not noticing that when the settlements are updated the terrain was being flagged as change because they removed agripotential.

To explain that a little further. The red cells are where people have settled. Every settlement has an internal population and that population farms the land that can be farmed in the cell. This measure of ‘farmable’ land is what I refer to as agripotential and it’s a property of the cell and therefore the map. This wouldn’t have caused an issue, except that the settlement populations grow over time (as long as enough food is available) and as the populations increase, the number of farmers increases and therefore the agripotential of the cell needs to be reduced. It was this reduction in the value that was quite rightly causing the map to be flagged as updated. This wasn’t really noticeable at the start, as there weren’t enough settlements to cause it to happen very often, but by this afternoon, it was pretty much every minute.

I’ve fixed this by splitting the agripotential data out into its own file as well as the settlements and population. This all gives me a good idea for the direction to take next. I think I need to put more of the game config into the database, and more specifically, the update schedule. What I want is the ability to simply move entities between update groups so that, for example, now I need to reduce the settlement update, I could do it in the db and not in the code/cron task.

The downer of the day is that my server is starting to bog down. On the one hand, I think I need to up the memory, as every httpd instance has a copy of the map resident, bringing the load to 80 megabytes a piece. As the server only has half a gig of RAM and is running my mailserver, mythtv, the database itself and various other bits, I think the paging is as much a problem as any code-level performance issue. The other thing I need to do is to fix the navigation coordinates that people can move to as the image caching isn’t helping a lot when the coordinates don’t match all that often.

Performance is clearly going to be a major problem, especially when I consider that I’m going to want to find a host for this stuff and servers aren’t free. I may yet be driven to abandon python for more elements.

Leave a Reply

© 2012 Bones' Blog of Stuff About Things | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo