Saturday, January 21, 2012

New home, new start

The past half year has been really enjoyable personally, but bad for my side project. My wife (as of August) and I left our home in Boston and travelled for four months through Europe. Then we were in Ontario for Christmas, and now finally we have settled in our new jobs here in Minden Nevada. For those who need a brushing up on American geography, Minden is an hour south of Reno, just across the border from South Lake Tahoe California.

I won't lie, my odometer project stalled. The Freescale kit got packed before the trip and is currently sitting somewhere in storage here in Carson City, waiting for us to take possession of our new home. I do have some positive news regarding my exploration project. During the trip I made an effort to put some time in to it and did get a python project to about the same level as I had with java. The fruits of my labour can be seen below:

Yes, those who are a little more astute will notice that I am now developing on a Mac. My wife is an avid Mac user and we got a macbook air for our trip. Python has the beauty of being cross platform so I could easily take the same source code and bring it to my PC (which is also sitting in the same mysterious storage locker as my kwikstick kit).

I did not do any bound checking on my project so if the boat goes too far north or south it just floats off the map. This program DOES load a map from a text file and draws land vs water which is a step further ahead than my last Java attempt. I am moving towards an MCV (model controller view) model of programming. However, the project currently uses an event manager which I am having second thoughts about. On an airplane ride with my wife I talked over my problem and collectively we came to the conclusion that rather than having a 'dumb' controller I should have it do the bulk of the model manipulation. This would fit more cleanly into the MCV paradigm and allow me to change the interface without affecting game mechanics. I should also be able to easily jack in AIs for the computer players. Fun stuff.

Stripping out the event manager and adding smarts to the controller are my next steps. It will no doubt take my progress back a little. But let's call a spade a spade, my project is not off the ground yet.

Until we meet again...

Wednesday, June 1, 2011

Epic Fail

The decision to stop developing with Java was likely best for long term usefulness but it was immensely painful on the immediate schedule. As you might have guessed, I have not been doing any development on my game in the past few months. That is not to say I haven't been programming, just not high level programming.

The new project I've picked up and have slowly started putting hours into is using the Freescale Kwikstik to act as an odometer for my bike trainer. I am hoping that by using the onboard IR diode and receiver I can detect a piece of black electrical tape spinning around the inertial mass. In my mind I should be able to pull this off quite simply and then once I'm counting revolutions the project can really take off, USB data uploads, speed profiles, etc.

If I do get data up to the PC it would be in the realm of my fiancé Jackie to decide how to layout and display information on the screen, I imagine I'd write the interface though I'd be hacking my way through it. That slice of software remains the missing piece between our skill sets. I know that we both talk about wanting to learn it, we would be quite a team if we could meet in the middle. Me from the drivers up, and her from the screen down.

Currently I have the LCD screen driver, and the IR diode on, my immediate plan is to get the IR receiver working. I've discovered how difficult it is to work with embedded systems without the aid of meters and scopes. If I get serious about this hobby I should look into getting some tools.

Thursday, February 24, 2011

Competitive Analysis

I recently purchased Commander: Conquest of the Americas, through Steam, as it looked like it fit into the genre I'm hoping to enter.  My intentions were to evaluate this game and hopefully incorporate the best aspects of it.


Let me begin by saying that this game was not well reviewed.  It wasn't poorly reviewed, just deemed mediocre.  After my first couple hours in it I can see why.  It lacks the intuitive simplicity that Sid Meier's games are famous for.  Though that is a hard standard to compare against.  The team at Firaxis always amaze me with their balance of simplicity and strategy. 

Commander seems to be a trading simulation at its heart and in that respect I compare it to the Patrician III.  In fact, I would say that it is a step closer to my intended game than Patrician is.  You found colonies, bring colonists over from the Old World, and compete with fellow European Nations.  The focus though is on developing the colonies production trees, and setting up automatic trade routes that maximize profits.

I haven't played through a whole game yet so my summary may be premature, but my first impression take aways from this game are as follows:

GOOD
  • Resources distributed around map, semi-realistically
  • Not based on a grid, ships can move around in any direction similar to Pirates!
  • Resource development, you can improve colonies to turn local sugar cane, into sugar, and then rum
  • Ships can easily form squadrons and fleets to make protection and resource pooling simpler
  • Four advisers that give suggestions and missions to complete
  • Very pretty to look at
  • Steam achievement system
BAD
  • No exploration, the whole map is known from the start
  • No randomization, you always play the map of the Caribbean
  • Too many resources and colony improvements
  • You must keep the advisers happy or the game will end
  • UI is bad
  • No homeport screen, colony screen hard to access and provides little information
  • No good statistics or summary screens, information is hard to find
  • Tutorials are just videos with someone speaking about what they are doing
  • No end game, the goal is to amass a fortune
 I'd say the game has been worth the $15.  It provides another reference point for me, and there are some aspects I did enjoy and will try to build in.  I don't know if I'll go straight for the 3D rendered ships and oceans, but the original Exploration could do with a more advanced economic model.

Sunday, February 13, 2011

Was Java the right choice?

As I started to expand from a single ship navigating a 7x7 map to any number of ships navigating a nxm map I started to add more and more Java classes.  While this in and of itself isn't so scary, the thought occurred to me that in order to eventually do the port to the iPhone, all of these java commands and classes will disappear, leaving me with gaping holes all over my program. 

The past couple months of working in Java has given me a better feel for the strengths and weaknesses of this language.  It is strong because of the documentation and huge community.  It also has implemented a lot of functionality that is simple to import and use but therein lies my discomfort.  Java is meant to be a big black box.  You write code to make one black box work with another and I don't like that. 

The decision I have to make now is do I continue to use these boxes, or do I transition to C++ and leave java behind.  That is the way I'm leaning.  I might start a parallel project to see how long it takes me to recreate the functionality I have now but without all the black boxes as my foundation.

Tuesday, February 8, 2011

Approaching 0.1

Since my last post I've made good progress.  I found a better ship image, drew an ocean tile that looks better than straight dark blue, and I can move the ship around discretely by squares.  Currently the ship can move around a 7x7 grid.  When he hits one of the poles he can't go any further, and when he goes off the end of the screen, he appears on the other side.

To get to where I hoped to be at 0.1 I need to implement the following:
  • Expand the map to a size greater than what I can display in a 7x7 window
  • Keep the screen centred on the ship unless he approaches a pole
  • Add greyed out unexplored squares that are revealed when the ship is next to them
So that should keep me busy for the next week or two, hopefully I'll also layout the project development milestones so I can break up the project into manageable chunks.  Currently I find myself wanting to work on every feature at once and as a result spend a lot of time finishing very little.

Wednesday, January 26, 2011

Ship ahoy!

In light of yesterday's realization that I need to spend less time paralyzed by indecision over how to structure my code I went home last night with one goal in mind.  "I will draw a ship on the ocean, dammit".  I was fairly close already, having adapted a lot of the window opening and image loading from the Space Invaders tutorial.  I found a ship image online and focused on displaying it.

It took me a little more than an hour during which my fiancee correctly identified that I was paying less than full attention to any attempts at conversation.  (Sorry!)  But before I went to bed I did indeed prevail.

The following is a screenshot of a ship on the ocean-ish. 

Tuesday, January 25, 2011

One small step...

Found another great tutorial.  Rather than copying it verbatim I'm using it as an example.  It is a recreation of space invaders and can be found here.  They do some interesting things with resource management and I've learned about learned a fair bit about loading images into Java. 

Also, I found an interesting article about game loops and screen refreshing.  That article is here.  The original exploration had very little animation, and a very blocky refresh rate.  It will be simple enough to recreate, and not much harder to smooth out.

As with most ventures I find I keep hesitating during startup.  I keep falling back to doing more research into Java game programming instead of moving forward with my best guess.  I need to remind myself there is no cost associated with failure and I can always go back and optimize later. 

Currently I'm opening up a window, but not putting anything on the screen.

Wednesday, January 19, 2011

Taking off the training wheels

This past week I have worked my way though the online Java tutorial and reached a point of diminishing returns reading through Java in a nutshell.  The further into Java I get, the more I've come to second guess my decision.  The embedded programmer in me is appalled by the JVM which is a total black box.  Talking to other engineers in the office it sounds like most software development is just taking a collection of black boxes and stitching them together.  I plan on continuing with Java for the time being, mostly as a learning exercise.  I think that I will likely want to restructure the project at some point and the lessons learned before then will be valuable.  Besides, half of the challenge was to learn object oriented programming, and I should make an honest attempt before I return to the safety of C.  Hardened software developers are probably shaking their heads at that.
In the upcoming week I look forward to getting my teeth into the real project, not just a tutorial example.  I installed the original exploration game to have it for a reference.  It is impressive that software exists to get a DOS based game to run on a 64bit Windows 7 platform.  I tip my hat to the people behind the DOSBOX project. 
 This is a screenshot from the original game 'Exploration'.  It shows the map, currently the ship is in port, the castle looking building, and it's info is listed off to the bottom left.  A screenshot roughly looking like this is what I hope build 0.2 will look like though with much rougher looking graphics for the shape of the land and sea.

Monday, January 10, 2011

Java Crash Course

I am sad to say not much has been developed in the past week though not to say I have not given the project any attention.  I'm still wrapping my head around the object oriented platform, method overloading, inheritance, and other ins and outs of java.  Java in a nutshell has proved to be a handy reference.  I've also found a great tutorial online that supplements it quite nicely.  For anyone curious, it is here

This tutorial sets up a GUI, which I'll then morph into build 0.1 of the game.  My goal for 0.1 is to have a ship that the user can move around the ocean.  Should be simple enough.  Looking forward to 0.2, I'd like to incorporate the land and the ice where ships can't sail, discrete turns, expeditions, home port, and the inventory system. 

To put a timeline to my goal, I'd like to draw a blue ocean by next week.  Wish me luck!

Monday, January 3, 2011

Back from the holidays

This post will read more like an 'owning up to little accomplishment' rather than a triumphant achievement.  I have spent close to two weeks back in Ontario visiting with family and celebrating Christmas.  Initially I pictured quiet afternoons where I could dig through my texts, instead it was a series of rushing from one family members house to another and visiting.  I do not wish to make this sound like a complaint.  I thoroughly enjoyed the past two weeks, however I was unable to get more than a few hours deeper into Java in a nutshell.

I have had some time to think on the end goal of the project though.  The more I think of the game exploration, the more I see it's short comings.  The game begins with 5 or less cities on the map (depending on the number of human and computer players), the rest of the map is undeveloped with the exception of a series of indian and incan villages dotted around randomly.  This leads a player to found a colony in the heart of India, China, or even the Middle East and fill the surrounding areas with plantations and mines.  There are no other civilizations or cities to trade with or otherwise occupy these places.  I think this may be why other games such as Colonization limited the play map to just be North America. 

The more I though about this the more I want the game I write to be a hybrid of the exploration, trade, and strategy games I played growing up. 
  • I greatly admired Colonization for its replayability, ease of learning, and having an ultimate end goal. 
  • The Merchant Prince had a supply and demand model for trade married to a historic exploration model. 
  • Railroad Tycoon 3 had resources moving across the map automatically between raw material mills, production facilities, and consumers. 
  • Sid Meier's Pirates put the player in a first person role as a captain giving the world a more dynamic feel since world events would play out without your influence or knowing (until you sailed back to your favorite Dutch Port only to find it occupied by England). 
  • Europa Universallis had a complete political world map with all Far East, Middle East, and New World civilizations present (even playable) as well as an unparalleled historical accuracy and detail.
  • The Patrician had a rags to riches story of the player starting with one ship and building a flourishing trade empire while competing with other ships and merchants profiting off of supply and demand of goods.
  • Finally, Exploration gave the feeling that you were really achieving something once you had enough ports and ships that you could set up trade routes, and I always found the graphics and sound track to be endearing. 
Each game had its own strengths but no single one seems to combine all of what I was ever looking for.  I am excited by the thought of taking some of the first person individualism of 'The Patrician' and 'Pirates' and integrating it into 'Colonization' while still trying to capture the feel of 'Exploration'.  That is what I ultimately want to port to the iPhone.  I'll still plan on recreating Exploration as a stepping stone and learning tool, so that is what will occupy me in the meantime.

Happy New Year!

Monday, December 20, 2010

Count > 0

Installed and configured the Java JDK this evening and wrote the first few lines of code.  Right now there is simply a println statement that prints hello world to the console, but it is a start and my java compiler seems to be configured correctly. 


Hopefully before leaving for the holidays I'll look into setting up a Subversion 'server' on my computer so I can keep the project better documented and tagged.

Sunday, December 19, 2010

New Direction

After much deliberation, I think I've settled on a direction; Java.  I feel that this will prove to be a more immediately transferable skill to have than Objective C.  Though I haven't given up on the iPhone app entirely, I hope to eventually port whatever I end up with to it eventually.  I am hoping that in the next year or so more people will write iPhone apps in Java and I can ride those coat tails.  In the mean time I will focus on wrapping my head around object oriented programming and do my best not to treat my computer like an 8-bit processor. 

There are two main factors in addition to the perceived usefulness of knowing Java that prompted my decision.  First, of all the University texts I have lying around I no longer have my C++ book, but do have two Java texts including Java in a nutshell.  Second, the open source project, FreeCol, made the switch very early from C++ to Java and I've been studying their project as a model for my own remake. 

FreeCol is a remake of Sid Meier's Colonization.  I've admired how they structured the project, with a series of dot releases leading up to 1.0.  Each release brings the project an incremental step closer to the final product.  For example, 0.1 was just a ship on a map that could be explored.  0.2 added a bit better graphics and the ability to send the ship back to the 'home port' in Europe.  Further releases improved graphics/added multiplayer and eventually added an AI.

The other thing they have on their site is a track of the number of lines of code programmed over time.  The project right now is something close to 130,000 if I remember what I read.  I like the idea of having the count and will need to look at some way of including a line count into the blog.  I will also need to plan out the project into reasonable blocks (my own dot releases) that I can target and feel a sense of achievement when I hit them. 

Over the next two weeks I'll dig into Java, and hopefully plan out the project.  I will start towards a similar simple first release of an explorable map.  My current lines of code count is at 0.

Tuesday, December 14, 2010

First Status Update

Greetings,

I have spent the past couple evenings configuring/installing Airplay.  It piggybacks Microsoft's visual studio C++, and builds for any phone/processor I imagine I'd need.  It will also build a deployable file that you can upload to your phone.  So far so good.

I began by loading their sample 'Hello, World!' application into Visual C++ express, and glancing over the code.  Simple enough, at a high level only a couple functions, screen changes colour after a timer expires.  Did a debug build for the ARM processor, and a window pops up that displays the screen, along with a panel of menus that lets me rotate the phone, and add other inputs that are hard to control with just a mouse.

Now the discouraging part.  I wanted to deploy to my iPhone, so I began the deploy process and encounter a substantial error.  I am missing my iPhone developer's license.  To be entirely fair, I knew this would be a problem if I developed in Xcode, that you can use the simulator only until you pay apple to become a developer.  I had hoped that AirPlay would be a work-around, and alas it is not.

Currently I feel as though I'm at a crossroads.  I see three options:
  1. I continue developing with Airplay.  This has the advantage of  letting me develop on my PC.  This has the disadvantage that I'll be developing with C++.  Not a huge disadvantage, however I was excited to use ObjectiveC, and hoped that it would leverage more of my embedded C experience.  I am also concerned about writing code for a Mac product without using a Mac IDE.
  2. I switch to Xcode, and 'borrow' my fiancee's older macbook.  This has the converse advantages and disadvantages of the above with the added disadvantage that the macbook's battery is EOL and only holds half an hour of charge.  I would need to share time on the power supply or go out and buy one I can dedicate.
  3. The third option is that I lose the iPhone as a destination and just try writing the game for the PC.  Then the language options open up a little I could try it in Java or C++, and try using OpenGL for graphics, something else I'd been curious to play with. 
I am torn.  Two paths keep the iPhone as the end goal, which would ultimately be a cool deliverable.  I'd just need to loosen up and pay Mac for the privilege to write code for them.  On the other hand, I could extend my programming skills into something that may be more immediately useful for my career. On the other hand, my goal (2 days ago) was to write the iPhone app and I'd hate to so hastily abandon it.  On the other hand, keeping the project in the PC might bring down the scope and increase the odds of successful completion.  On the other hand...

Sunday, December 12, 2010

Inaugural Post and Background

Hello and welcome,

This is my first attempt at web logging.  I have always considered bloggers to be self centred self important yuppie snobs.  Now I know better ;)

The purpose of this blog is to act as a motivator for me to achieve goals I set for myself by providing a weekly status update.  Hopefully these updates will encourage me to put time and effort into my projects each week.

The two projects I'm actively working on now are refreshing my control theory knowledge from university, and writing an app for my iPhone.  In regards to the iPhone I plan to write a version of one of my favourite computer games Exploration.  This game was never well received or reviewed.  Many critics found the end game to be rather anticlimactic, the UI was clunky, and overall the game was deemed a little dull.  For me it sparked an interest in the era, particularly for the Dutch who left most of their exploration and colonization to private merchants rather than 'federally' funded voyages. 

I realize that this is an overly ambitious project for a single software developer, since I'll be starting from 'Hello World'.  My background lies in a firm understanding of embedded C.  The thought of going to an object oriented language on a processor that can handle huge stacks of memory an inefficiencies is totally foreign, however I think it will be a great transferrable skill.

The timing of this project is good for three main reasons.  First, my fiancee and I are sick of paying for cable television so after Dexter tonight we'll be without all but the most basic of channels.  Second, I've been putting so much time into Civ5 lately that I feel ready for a break from PC gaming.  And finally the hollidays are coming up and I'll be out of the house and away from work for a little over a week and can really crack down with a little effort.

For the upcoming week I have found Airplay, which claims to be an iPhone SDK capable of programming iPhone apps from my PC.  Hopefully I'll be able to play around with it a bit and verify that I won't need to fight for time on my fiancee's macbook. 

So with all the enthusiasim of starting a project I hope to have exciting news for next week.

Daryl