The blog is being migrated and merged with multiple Imphenzia blogs so the format and content will be inconsistent for a while.

Astrofighter.Net - low poly spaceships

Low Polygon Spaceships for Astrofighter.Net

Today I took a break from programming and decided to make some low polygon spaceships for the game. I don't have a lot of modelling experience but it's a lot of fun to let the imagination take over.  Here are the 7 ship models I've come up with so far:

When I create these models, I just start with a normal box, about 4x2x1 meters. Then I just extrude, extrude, extrude the faces in different directions to create the wings, the engines, the cockpit, and so forth. In addition to extruding I also move the vertices to create angles, but that's pretty much it. I use the "Symmetry" modifier in 3DS Max so I only have to model one side of the ship.

These models are very primitive, as you see, but for my top down view I think they will be quite sufficient. They will need texture mapping, normal mapping, and specular mapping as well which should make them quite decent.

I did 5 of these models tonight, the other 2 I created previously. A model of this low detail takes me around 15 minutes or so to create.

Off to bed now... I'll have to do some thinking as I'm considering two paths ahead for the game:

Should all the ships be quite similar in character but have small variations in terms of speed, armor, energy, weapon capabilities...

... or ...

Should the ships be very different in character making a defender ship slow and heavily armored with loads of weapons where as a scout is on the other end of the range being really light, fast, with low armor and weaker weapons...

Comments please - what do you think? =)

Astrofighter.Net - Update 13 October 2011

I'm tired now. It's 1:53AM and I only sleep about 4 hours per night. Too excited to go a sleep =)

It's now been roughly five weeks since I started with Astrofighter.Net and I estimate that I may have put in 150-200 hours during the five weeks. I've been off on paternity leave but that still requires a lot of work with a 1.5-year-old and a 2 month old, so it's mainly been when the kids have gone a sleep that I can work on the project, between 8pm and 2-3am.

I realize that I haven't made it easy for myself since I am, with this project, learning Unity, learning C#, learning network game development, and learning object oriented development all at once. The only object oriented development I have played around with before is BlitzMax, but I never really created anything with it.

Since my last update I've got a lot of development done. It's not so much game-play wise because I decided to ensure that I got a menu system and game state machine running so I don't bump into any troubles further down the line. To be more specific, this is what I've done the past 2 weeks:

  • Design a custom GUI for Unity to suit my space-look

  • Developed a menu system which scales to any screen resolution
    (still a lot of menu items to put in, but the menu framework is all there)

  • Developed Pilot account management with a PHP/MySQL backend so you can create and login to accounts seamlessly from within Astrofighter.Net

  • Account creation and session validation for Pilot accounts so a server can verify a token for the pilot in order to secure the integrity of statistics for pilots

  • Developed a Game State Manager that takes care of transitioning between scenes and game states, such as Menu --> Host Game --> Start Server --> Load Level --> Prepare For Match --> Play Match --> Show Results.
    The Server issues all the state changes and the clients follow.

  • Redesigned the class structures separating out a GameStateManager class (state management), GameManager class (player management), MatchManager (match management), etc.

  • Developed a flexible Settings class so game settings can be loaded / saved / accessed in the game and in the menu system

Today I also had a look at UnityPark uLink that are offering a nice scalable solution for networking in Unity. Ironically enough it does much of what I've put a lot of effort into developing in terms of account management and backend server communication. I may, or may not, decide to switch to uLink depending on findings down the road... but I may have to pre-purchase the uLink indie license because they have a limited deal on it until end of October.

Here's a video from today showing some of the menu GUI, player account management (with PHP/MySQL backend), and game state handler switching from menu, to "prepare", to "match":

Unity menu GUI in multiple resolutions

Today I've spent a lot of time trying to get a nice resizable menu for Astrofighter.Net and it's been a bit of a struggle so far.

My first approach was to use Matrix4x4.TRS to create a scalable 4:3 ratio menu GUI based on a coordinate system of 1600 x 1200. For wide screen resolutions I would simply add an offset to make sure the 4:3 menu system is always centered. It worked quite good in higher resolutions but as soon as a fairly mid-range to low resolution was used smaller fonts became pixelated and unreadable. How unfortunate because the matrix scaling was a one line solution.

I'm now working on my own approach. It basically still uses the 4:3 ratio menu with padding being added to the sides for widescreen resolutions. The difference is now that I recalculate the Rect positioning and width/height using my own function basically doing the same as the Matrix4x4.TRS scaling. The difference is that I now also manually set the font size using the same scale, but with an integer, so the font always looks crisp.

The status now is that I've got a nice resizable GUI with crisp fonts in any resolution. It's quite a bit of extra work but I think it's worth it.

If you are interested in the code - please let me know. I'll probably make it available in the Unity wiki or forums once I'm finished.

Ränneslättsloppet 2011

Yesterday I participated in an enduro race called "Ränneslättsloppet". It's a competition with thousands of participants in different classes. I raced the recreational class for men aged between 30-39.

The weather was great and the trail was dry but not dusty. I got a decent start but my lack of experience in competitions such as these lead me to ride defensively in the beginning so I more or less just joined the flow. During the first lap we saw some traffic jams and no less than two bikes catching fire =)

Note: The thumbnail is linked, not copied, and it leads to the photographer's site (www.bildeffekt.se) which contains many great photos from the event.
One lap was 20 km in length and the goal is to do as many laps as possible during 155 minutes. The winner of my class did 5 laps and I am very satisfied with the 3 laps I completed being so novice at this.

My only other previous experience was when I participated in Stångebroslaget earlier this year and that was a truly painful experience trying to get my motocross bike (KX450F) to take me through extremely muddy forest terrain and it kept stalling and draining my energy having to kick start it all the time. For this race I had bought a WR250F enduro bike instead and that made all the difference in the world. I didn't stall it once while riding, only 3-4 times when I crashed.

Pre-race activities

05:30 - Alarm clock goes off. Time to get some stuff out of the fridge and pack it into the cooling bags to meet up with my race mate.
06:30 - Trailer with bike hooked up to the car and we head off on the 320km journey down to Eksjö where the competitions is being held.
10:00 - Arrival at Eksjö. Registration and carried all the stuff to the pit area for the service stops. We brought 2 spare wheels in case of flat tires, petrol, water, power drinks, tools, extra gloves, extra goggles, environmental mats, and some other bits and pieces.
11:30 - Rode our bikes to the inspection area where they were approved for the race. Then headed off to the start area where we lined our bikes up along side another 1000 bikes.
12:15 - Got dressed and packed our camel backs. I skipped my motocross top and just had a t-shirt and body armor. I overheated big-time at Stångebro so I needed to to all I could to keep the temp down. I also packed an extreme amount of fluids. More than anyone else with a small backpack filled with 2 x 2L water and 2 x 0.5L Powerade. I wasn't going to dehydrate this time!
12:30 Arrived back at our bikes at the starting line. 15 minutes to go.

The Race

I was placed in the last line of the 30-39 year-olds, and then we had the 40-49 and 50-65 year old riders starting 5 minutes after us. As the start went I got a clean launch and settled into the tempo fairly well. It was quite a few traffic jams and pileups the first half lap so I got to eat some mud, watch a bike on fire, and pushing and shoving my way past every here and there.

The terrain was quite dry but also quite rocky. Sometimes the front wheel would catch a rock nearly sending me off the bike but I completed the first lap without any crashes. I also found out that my new bike, a WR250F, was extremely kind to me and I didn't have to work nearly as hard as at Stångebro which also meant that I didn't have to drink any water during the first lap... Great, 5L fluids on my back for nothing =)

I skipped the service stop on the first lap. I had all the water I needed and the bike didn't need any petrol yet so I decided to press on and save myself from pushing the bike through the service area in the blazing sun. Better to stop somewhere in the shade later on to drink saving me energy and time. So I did, about half way into lap 2 I found a nice shaded area just off the trail so I stopped there, drank water and a Powerade, then continued.

There is a section of the track called "Berget" (Mountain) which is a steep and very slippery section which is definitely the most challenging part of the track. The first lap I chose to take the "easy" way around it because it was heaps of traffic and I didn't want to get stuck in it, or cause additional jams for that matter. Now, on the other hand, I decided to go for it on the second lap and I cleared the hard path quite easily.

Not long after "Berget" my front wheel caught a rock on a descent which sent me and the bike flying. I tried to stay on the bike but failed and my knee got twisted to a point where it hurt a bit, but not excessively much. When I picked the bike up and carried on I tried to lift my leg back to the foot pegs and it felt really really strange... I couldn't make out if the bike had been damaged or if my leg was totally messed up. Maybe adrenaline was keeping me from feeling that the leg is wrecked I thought...

The awkward feeling remained and something just didn't feel right. I managed to turn my foot back and forth, wiggle my toes, and lift my leg despite the strange feeling and as I rid another few km I came to the conclusion that it must just be a combination of the bike having had a slight deformation by the foot peg and me being tired that caused the awkward feeling.

I reached the service area after lap two and as I got off the bike I contemplated whether to call it a day and be satisfied with completing two laps or go into the service area and fuel up me and the bike for a third lap. I chose to the latter. I didn't come all this way to give up with time to spare.

I stayed in the pit area for about 15 minutes. Dropped my backpack and replaced it with a single camel back with 2L of water. Ate a snickers bar and some "Dextrosol". Poured half a bottle of water over my head and took off again.

On the third and final lap I was starting to get really exhausted. My arms weren't strong and my legs started to cramp up when I was standing so I had to sit down a lot more which meant my ass took a beating on the rocky sections. I can feel that today (the day after.) I kept quite a slow tempo but managed to speed up every now and then. A lot of riders completing their 4th and 5th lap were lapping me at this stage and I always knew when they came as they shouted from behind to make their presence known.

I reached "Berget" for the last time and I had already decided to take the easy route - but for some reason I didn't. I launched myself up the hard section of slippery rocks and about half way up the bike slid to the side and I had to jump off. No harm done to me but the previously awkward feeling foot peg was standing straight up and I though, great all this way to mess up the bike so close to the finish... turned out it was just stuck a bit so after giving it a good kick it was back to just being awkward again.

Not long to go now... I can hear the speaker making announcements in the background. I come to a long whoop section along a concrete barricade where I had done some wheelies over the whoops the previous laps. Shifted up to fourth and gave the throttle a good twist. I saw two spectators standing by the concrete barricades about 100m ahead of me and just as I approach them I jump off a whoop just to see my front wheel hitting the next one sideways... I wobble big time and nearly go over the handlebars. In the corner of my eyes I see the two spectators jumping back to avoid potentially being hit by a bike and an exhausted rider. Somehow I regain control over the bike and I managed to glance over at the spectators and give them a nervous smile just as I pass them. That's it now - no heroics from now on.

I rolled over the final whoop sections and I enter the last windy section on the big grass field that leads up to the checkered flag. I did it... and despite being very far from the top of my class I am happy with my result. The winner did 5 laps in 2 hours 58 minutes and I did 3 laps in 3 hours and 18 minutes. I finished in 232 place.
Here is a helmet camera that someone wore during the first lap in my class. The rider wearing the camera finished in 250th place but I can't spot myself anywhere in the footage. "Berget" can be seen at around 24 minutes in to the video. And it always looks easy on video - try it before you decide whether it really is easy or not =)

Unity 3.5 and Menu Flow

I've been occupied with fixing up my Yamaha WR250F for the upcoming race, Ränneslättsloppet, on Saturday:

  • New oil and oil filter

  • New air filter with NoToil air filter oil

  • Changed to the enduro tires I also used on Stångebroloppet in July (with new inner tubes)

  • Fitted the coolant reservoir again (engine it runs hot in races like these ones, three hours of slow movement isn't great for the engine that relies on fast flowing air through the radiator)

  • Fitted new hand guards

  • Removed the indicators and number license plate

  • Fitted the race numbers

Here's are some clips from the 2008 year edition of Ränneslättsloppet... Let's hope it isn't too wet this year =)

What about Astrofighter.Net then?

I've also been working on Astrofighter.Net during the past couple of days but most of my work has been shuffling around boxes in Visio to try to get the menu flow and GUI design in order. Even thought this is a fairly small game I want to make sure that the lobby screen, ship selection, hosting options, etc. is very easy to understand. I hope it's worth the time spent on getting it right =)

I'm also looking forward to Unity 3.5 which is scheduled to be released in late 2011. The conference "Unite 11" which is currently being held demonstrated some of the new features and I found quite a lot of useful information in this blog post.

Even though there are some really visually impressive features coming in Unity 3.5, I am looking forward to the new GUI / UI very much. I don't particularly like the limitations of the GUI in the current version of Unity and it would really make things easier if the new GUI Editor is available before I have to have a go at making the final menu system for Astrofighter.Net.

Apparently there is Subspace

Today I was also contacted through my ImphenziaGames YouTube-account by a couple of guys who play a game called Subspace.

I wasn't aware of this game although I now understand 1) it's been around for a long time, and 2) it's a 2D multiplayer space shooting game.

Both guys asked me whether Astrofighter.Net is influenced by Subspace and at the moment it isn't. In fact, there is no influence from any particular space shooting game and I have deliberately not researched any "competition" as I didn't want it to cloud my ideas for Astrofighter.Net.

Due to the nature of my game, and in comparison to Subspace, there will probably be less players on a server in Astrofighter.Net. I will, however, based on how much I can optimize the networking code allow for as many players as possible. My current goal is 16-32 players and since I use rigidbody physics (instead of simply moving objects using velocity and direction) the game uses a fair amount of bandwidth.

I now have most aspects of Astrofighter.Net sorted out in my mind so it's mainly a matter of making it happen. This is a one man show and I do the development, 2D graphics, 3D objects, textures, music, sound effects, and web development by my self so it'll take some time.

Feel free to contact me if you think there are "must-have" features in a game like this. I will consider any input I get, but be aware that I may not necessarily be able to (or want to) implement them =)