About this blog
A log of my progress in writing a game despite a busy everyday life as a regular worker and father of a one year-old baby (as of august 2014)
Entries in this blog
After finishing implementing the game sequence, there are still some boring points to do, like saving and presenting the highest score.
To understand, I have to explain the logic of my framework : a Game is a collection of Gamelets that are independants. For instance, I have a gamelet for the main menu, one for the actual game, etc... And now I have a gamelet for the player stats.
How do these gamelets exchange data ? I use a Session object (a simple maps of Objects identified by a String), like a web application. So my gamelet for the game save the player stats in session if they are better than the last data previously saved.
More, I also have to take care to save those data, and retrieve them when restarting the game.
All of that is booooring, and I delayed this work for nearly a week.
The good thing is that the delay was used to create some code template for eclipse to speed up code writing for my next game, including those data stat management. So I did not entirely loose my time.
Another good thing is that I came up with the idea to promote my other game on this screen too. So now I'm busy coding this screen, and I hope to finish this week.
But the bad thing is that I have to reschedule again, and there will be more change than previously done, in the hope to deliver my two versions of the game by the end of November.
On a side notes, I'm starting to think about some post-mortem analysis, and it becomes clear to me that :
- each gamelets should require at least 2 weeks to be done.
- I have underestimated the reusability of the code of my previous code, mainly because I could not help but rewrite code to get better quality code (to my mind), instead of only copy/paste/patch existing code. I don't regret that, because I prefer code quality to deadlines, and I have the luxury to abide to this preference because it is a personnal project. But the consequence is rescheduling, and I have to take care of that next time.
That's all for today, I will go to my Aikido lesson now.
Last week, I could fully implement the simple game, with some animation for showing the cards at the beginning. This week I implemented the display of the time of play and the number of trials.
And I had to implement again yet another "format time" to convert the total time of play in seconds into the "hour:minutes:seconds". I wanted to use Java date formatter, but the number of hour might go beyond 24. So I did the formatting the old way, and will leave it like that. I'm not so happy with that, but now I have no time to look for a better way : I'm slipping past my schedule for implementing the trophy screen.
Anyway I attached some screenshots in the album you should see in this entry.
This week, it turns out I got plenty of time to write code : sleeping problems (one night) and motivation on the evenings even after my daughter is finally sleeping, around 22:30 (before, it's not possible to do anything, and I just want to enjoy family time anyway).
So, working on my main menu, instead of re-using directly the ui code I wrote for my previous game, I rewrote it so that it is better designed (less specific, modularity, separation of concern). I also did unit testing on this API, and it helped me a lot to fix my code early (before using it in my main menu) and also after the fact.
Of course, this is not a full fledged GUI api like swing (my previous code was not either), I would also say that it is quite crude -you will not be able to get a dynamic GUI- but it allow to define how my component are positionned on the screen and it computes the actual position, and takes care of finding the component at a position and fire an event. And I could write some code with quality in mind, and that always give me satisfaction.
Anyway, I finished all my tasks of the week on Sunday midnight -and that give me satisfaction as well- and am ready for the todo list of Week 7...
Tonight my daughter went to bed early, and my wife want to do her stuff, so I have time for working on my project.
Now I rework how I generate my bitmap font. Generating the font sprite sheet is quite straightforward, but I was stuck at generating the sprite list description file : it's not easy to write a bash script that generate a bunch of lines computed using the same formula except for two lines shuffled in the middle.
So I was idly browsing the net, distracting myself, until it crossed my mind that I am not obligated to use bash for any scripting : in my case, python is more suited, as i can loop through a range of number and do a special processing if the value is in a list of special values. As it remains some basic scripting, I just add to find how to get arguments from the command line, and verify the syntax to use on the go. It is still very crude, but I am not writing an application here, so as for me it's ok like that.
I have now a working script, and more importantly, I used the right tool for the task (well, at least a tool that fits better than bash).
It's time to get some sleep now (=.=)
As I wrote in my previous entry, I had to rework a big part of my UI buttons, so I decided to redo them using inkscape. But then I cannot follow my initial schedule.
So I decided to reschedule to take into account this work, and spread some tasks that may be not so small after all. Basically, I gave to myself 4 more weeks, and I believe that will be fine, for now.
Anyway, every 4 weeks, I will reschedule if it is needed, that is to say if I'm too late or too ahead in my schedule.
Last week I could complete the main planned tasks :
So, I want to program a game. I choose a modest project (a simple game of memory) that will not require a lot of work. I have an already completed game, so I will take advantage of this by reusing some parts of it to have a working base. My ad-hoc framework for writing my game without worrying about the physical platform (android app or Java Swing program on computer) is stable enough for now.
- get a running version (swing and android), just displaying the game board. (android snapshot, hope it works)
I delayed the other task to this week (it has been done this early morning :
- Create the title picture (just a simple text using a fancy font)
Instead, I consolidated the scripts that I use to generate the graphic files and to copy them in each app project. So, I will give more details about that.
I use several tools to produce the source file : GIMP, Blender, and lately Inkscape. But then, I want to support several screen definition. For this game, I want to support Quarter HD (540x960), HD (720x1280), Full HD (1080x1920) and Quad HD (1440x2560) -orientation is portrait-.
For Blender and Gimp files, I first export from the tool a PNG file (or a set of PNG for an animation) at the highest definition. For a svg file created with Inkscape, I do a PNG export only if rsvg cannot render the file properly.
Then I write a shell script, using imagemagick to resize (convert), and assemble them if appliable (montage). These scripts produce a set of files for each supported screen definition. I also found how to use shell scripting to generate some description files I use to define my sprites. To save time, I now use make to process only updated source files.
Finally, each application (swing, android) must have the graphic and data files, so I wrote a script that copy the generated files.
So now, the schedule of this week will be tight, since I still have 2 tasks that are not so simple :
- Write the various screens of the game (main menu, about screen, promotionnal screen and player stats). I will base this work on what I did on my previous game. However, my previous game was displayed on a landscape oriented screen, so I will have to rework some button, and I didn't scheduled that.
- start coding the game mechanics. I guess this one will slip to next week.
Now, all I need is taking some times to complete this project.
I will take advantage of the fact that I often wake up early in the morning, usually one hour before my baby : that's 20 minutes up to one hour of work before dealing with diapers and milk bottles =) . It will not be every day though, as I become exhausted through the week and wake up later and later. And I have other matters to take care of in the morning. Anyway, I can work on my project at least one-two hours a week.
I don't always need a computer : brainstorming and some research can be done with a pencil and a notebook, while commuting and from time to time at work. Occasionnaly, i can write a few lines and send a mail to myself.
In the end, in order to be able to complete the project, I should plan my work (roadmap). I believe that to succeed, I should plan weeks by weeks, defining sets of tasks small enough to be completed in a week. According to my plan, I should finish near the end of October, if all goes well. It is quite tight though, so I will have to avoid slacking too much !
To keep motivation, I printed my schedule, and play with some stamps as soon as I completed a task. I have a stamp for finishing a task in time, one for finishing late (after the planned week for the task), and one for finishing early (before the planned week).
If I could work full time on this, I estimate that it would have taken between 5 and 10 days of work.
Anyway, last week I could complete all the planned tasks :
Hello world =)
- Initializing the maven project (parent project, game code, android app, swing app). I could duplicate the previous game, edit the pom files, and check in Eclipse. The java packages are created, but there is no code yet : that will start on week 2-3.
- Drafting the cards graphics assets and application icons. I use svg, convert and assemble to png sprite sheets for different screen sizes using shell scripts and a makefile to generate my assets.
So, I decided to write a game and to log my progress here, but I should first introduce myself.
I will start with the "busy life" part : my regular job is NOT game programming (more on that later). I'm a father since last summer, which takes nearly all my free time at home. Obviously I try to spend some of the remaining time with my wife. So, I have basically a very limited free time to spend writing game.
Now about programming, it has been my work since I graduated with an engineering diploma of computer science and mathematics (oh by the way I'm French =) ), and one of my hobbies for more than 25 years. At work I'm using java (JEE apps), at home I have used java/swing, php, c/c++.
So I'm quite used to Java, and naturally, I will write an android game to take advantage of this. This will be my second game and my third app on this platform, so, obviously, I will not have the problem of discovering a new platform : I have an up and running toolchain (eclipse + ADT, maven) and a working codebase. (If you are curious, here is my previous game : Space Zig-Zag)