PlomRogue Development Blog

7DRL 2015, Day 7

tl;dr: I (sort of) finished my 7DRL game Please the Island God (or PIG for short) on time. Get it here: http://files.plomlompom.de/7drl/7drl_2015_day7.tar.bz2. (See below for some problems you might encounter.)

A screenshot of "Please the Island God" version 1.0.

Last day of work

As promised, I took an evening off on Saturday for some social life. But I couldn't take my mind off the game during that time. I left the party early to continue working on PIG. On my way home, I met fellow 7DRL participant erlehmann. His 7DRL 2015 project Zoo Tycon shares topical similarities with PIG. We discussed and compared our algorithms for animal population control. He gave me nice hints and ideas for PIG.

Back home, until early morning, I kept testing and balancing the game I had so far. This was a little frustrating for one major reason: As processing-intense as my game is, it gets almost unbearably slow on my old netbook. I did some minor improvements / bugfixes. I then slept through until 2pm.

Up again, I made a list of open issues, must-have, and nice-to-have features. Time to prioritize! One major thing missing was the second half of missions I had planned. Until then, the Island God only gave the player agricultural missions. I wanted one or two missions to engage the animals directly.

Performance was another major issue, as I had experienced the night before. I decided to look for quick ways to improve my game's speed first. I reasoned that building the final two missions needed some playing, testing, balancing – something I would not be able to get done before midnight with the current game speed. So time spent on cheap optimizing now might speed up the other work, too.

Cheap optimizing, unfortunately, did not get me very far. I sped up the game by ~25% at most. So I turned to less cheap optimizing. I had some ideas on how to restructure certain complicated parts of my code to drop lots of unneeded processing. I spent much time on this endeavor. In the end, when finished, it did not do any good. That was probably a waste of time. Fortunately I set myself a time limit for working on the performance: 8pm. I did respect that deadline, and actually stopped a little earlier.

The time before 8pm was not entirely lost, however. Much of it involved the running of a testing script – to check whether code changes I made changed the game states the PIG server generated (rule of thumb: if it did, I made a mistake somewhere). Due to the slowness of my machine, these test runs took great amounts of time. I had to wait for their results before doing further server code changes. So I had some spare time for other tasks.

I used that time for lots of minor stuff: to think up log messages for certain events, to improve the client's visual interface design (as non-server code, I could harmlessly change and re-compile the client), to deactivate all window management features from the client (remember, I accidentally created a whole in-terminal window manager, with features entirely useless for my 7DRL), to update and extend the documentation, to plan the remaining two missions. I managed to implement a lot of the nice-to-have (as opposed to the still open must-have) stuff on my to-do list.

Shortly before 8pm, it was time for the must-have stuff. One major game design change: I removed the GOD_MOOD variable. During previous playing/testing, it turned out to be rather unimportant, barely affecting the player's situation. The Island God's missions define growing rewards / punishments for certain behaviors, to directly affect GOD_FAVOR. The flexibility gained by making this growth a function of GOD_MOOD, instead of hardcoding it, was minimal. No good reason to keep the player occupied with one more statistic.

I then added two more items, and the two missions I had planned. I barely had time to test those, given the slowness of my machine. But for some final tests, I came up with a short-term solution to the performance problem: a remote login on a friend's machine with much greater processing power than my netbook. This was fast enough to, in the final 30 minutes, run several automatic simulations of entire games, to test and balance plant and animal start distributions and fertilities (something that would have taken many hours on my own machine).

I kept optimizing these numbers up to the last minutes. Then I packaged the current state of my 7DRL branch, uploaded the file to my web hoster, and declared my game finished in the RogueTemple 7DRL database. Then it was midnight, and 7DRL officially over for me.

The result (how to play, likely problems)

You can download Please the Island God version 1.0 here: http://files.plomlompom.de/7drl/7drl_2015_day7.tar.bz2. To extract it, use bzip2 and tar:

$ bunzip2 7drl_2015_day7.tar.bz2 
$ tar xf 7drl_2015_day7.tar 

Then go into the directory that emerges, build the game with the ./redo script (if you lack any of the software needed, this will produce instructions on what to get), and run it:

$ cd 7drl/ 
$ ./redo 
$ ./roguelike 

If all went well, this should start the game, plus basic instructions on how to play it. More details can be found in the file ./README.

./roguelike may take a while to start up, and the game may be intolerably slow on your system. I have no easy fix for that right now (except, of course, getting a stronger machine). But rest assured I'm interested in speeding up the game, for my own machine is somewhat too weak for it. I already got some advice for further optimizations.

The game may also seem to crash when overwhelmed with processing. This is probably just the client quitting due to lack of answers from the (busy) server: ./roguelike is a wrapper to starting both ./roguelike-server and ./roguelike-client, and it's just the latter that may need re-starting. In fact, starting ./roguelike instead of ./roguelike-client in this situation will spawn a second server process. Two server processes will quickly fight it out, with one giving up, but there may still occur some race conditions I have not yet researched. So always try ./roguelike-client first after a sudden exit, not ./roguelike for a second time. (To kill off the server process for good, do "echo QUIT >> ./server/in". This command tells the server to quit. Once it's finished its current game state processing and is ready to poll for new commands, that is …)

Further plans

I'll mostly keep PIG the way it is for now. There may be some very minor bug fixes, and I may improve some log messages. It would be nice to tell the player at some point that feeding animals (by dropping food to them) gives GOD_FAVOR bonus points, for example. I may also attempt to optimize its performance – it would be lovely to play my own game on my own slow netbook!

If anyone else wants to extend the code, or re-use parts of it, they're free to do distribute the results under GPL terms.

Long-term, I may grow PIG further, but I must do something else first: expand the main branch PlomRogue engine with all the features I added to it during the 7DRL. Just copying the code over won't do in many cases: I created horrible spaghetti code (especially during the last day) that I don't want to poison my main branch with. I'll have to do lots of refactoring, and re-coding. I may find new ways to optimize the performance then. Finally, when the engine is ready to perform PIG (delivered to it as mere data input) to a satisfying speed, it will be easy to extend it further.

Comments

No comments on this page.

Write your own comment