Game in 7 Days, Day 5: Game?play
programming unity3d 7days1game fun worms artillery gameplay refactoring
Another day down! That again took bit longer than I thought it would, mostly because I had to split time between programming, spending time with my family, and my other hobby - photography. I don't recall if I mentioned it already, but I want to take pictures in the wild (ZOO doesn't count) of animals from the list I created, which, in my opinion, consists of most cool or characteristic animal from around the world. It has animals like Elephant, Tiger, but it also has Deer or Hedgehog (full list here. Yeah, there's 151 animals there. What can I say, I'm a pokemon fan ;) ). It's a project I'll be doing most of, if not all of my life, so whenever I have the time and weather allows I go to the forest in wee morning hours in hope of spotting something. Which means I have to go to bed early, and it still cuts time from my daily routine. So far I haven't done even ONE picture that I'm proud of and consider something that I'd want on my final list. But I'll get there one day.
So, anyways, back to the game. First of all, I decided on the theme/fluff. The game will be about tiny mages chucking fireballs at each other, and it will be called Beardlings. As I said, I did find some time to code, and progressed with gameplay. At first I looked at my prototype and did a list of what was lacking:
CLICK FOR FULL LIST
Yeah, that is a lot. Seemed that doing all of this in one day would be bit too much. Aware of that I nevertheless started.
First off I have done the menu system. For now used only standard Unity skin, to speed up the development, and didn't really care about how it looks. This has a selectable list of all teams created, and some tweakable parameters. Since game screen and main menu are separate Unity scenes, I needed to somehow transfer the data between them. I didn't want to push everything to PlayerPrefs, so I created couple Serializable classes (for level settings, game settings, and team data), and serialized them with a .NET (or rather MONO) BinaryFormatter.
Once that was done, I started working on level generation. When I write prototypes, due to my origins as a BASIC programmer, I tend to fall back to procedural programming (fun fact: did you knew that whole code of original Settlers was just one file? Yeah, that's just crazy). So, for final level generation I had to put my fugly code with global variables into neat classes. Once I did that, enhancing the level size was simple. What I needed to work on however was island/flat land, and water level (with presentation).
Here's a comparison:
So, basically, one blob in the middle with water to the sides vs semi-levelled terrain across whole map. The difference in code was how I added values to generated levels (see Day 1). In flat levels they were added equally based on Y position of the pixel in the map, in island levels they were added depending on distance from Lower Center point of the map. After tweaking some other stats, I'm getting quite nice levels, if I do say so myself. Water was just a simple height check + texture at that position that waves in sin(time).
From there it was work on collision. Re-worked the physics/collision system again into something more robust, with some optimisations thrown in. Wrote a simple gravity physics object for testing purposes, and went on to implementing the teams.
First approach was to throw all characters into one List<> and assign nicknames based on their position. First four would be named and given colour based on first team name, then next, etc. Soon I ran into limits of this system and reworked it into creation of list of four Team objects, each of which controlled four Beardling entries, each of which had his own HP, nick, and position in team (important for switching turns).
Next on the list I have created turn system. On most basic level the turn is controlled by timer (which I added for both turn and whole match here). When turn ends, you set the starting beardling in current team as next, and move to next team. I've added the basic weapon GUI back, character movement, and - since it was already 11:45pm, closed for the day and went to celebrate New Year with my girlfriend and son.
I didn't manage to put the new weapons or win conditions in, so that moves to day 6, and from then on it's GFX/Audio/polishing.
So, see you around (maybe tomorrow even?). Have fun in the new year!
PS: If you want to see how I'm progressing with my photography skills (I started as total noob not so long ago), you can check out my 500px page. I usually upload my best pictures there.
Story so far: