Wednesday, March 30, 2016

Visual Studio gotchas

Every time that I try to develop for windows (with Visual Studio), I have a hard time. And I do this so infrequently, that I tend to forget stuff too. I now try to make a windows version of Imhotep, Pyramid Builder. Here I will document some gotchas when developing under windows.

  • It turns out that for 64bit builds that use libSDL2, you need to add some inputs to the linker, being: winmm.lib, Imm32.lib, version.lib libraries.
  • What's up with the '32' suffix for 64 bit builds? Somehow you still need to link Imm32 and OpenGL32 and not Imm64 or OpenGL64?
  • The best way to generate new project files is to copy them from an old project, and edit the XML contents.
  • Don't use a full screen app and a full screen debugger at the same time. If you hit a breakpoint, the apps fight over the screen, and you cannot control the debugger any more.
  • Win32 builds cannot handle functions that take four __m256 arguments. Three is fine, but for the fourth, the compiler craps out with the message "formal parameter with requested alignment of 32 won't be aligned."
  • If my code were to be C++ I could replace with const references to __m256, but this is C code. So I have decided to not build 32bit versions of my game at all.
  • To get rid of the generated .iobj and .ipdb files, change the Linker/Optimization/Link Time Code Generation option to something other than /LTCG:Incremental.
  • Before creating my .exe file, Visual Studio creates a .lib and .exp by the same name. I don't know why. Configuration is set to Application(.exe) so why create the lib?

Friday, March 25, 2016

Imhotep Progress - WEEK 03

I'm working towards the release of my new game Imhotep, Pyramid Builder on Steam. As I did for my previous game, I will report on the progress each and every week. Even if there is no progress, the report will be made. This is the best way to keep on track, and fight procrastination.

Good progress was made this week, again.

I added ixes for the serialization of game state.

I improved the huts, which are now replaced by larger tents that house 10 workers, instead of the 6 in the old huts. These tents have better collision characteristics too, as the workers have less issues path planning around them.

Hooked up Remotery to find out the cause for a slow down. I have not been able to catch the issue yet, though.

Added steam leader board for the fastest pyramid build.

And the biggest new feature: player-designed pyramids! The player now directs the building of the pyramid by marking out the spots on the terrain where blocks need to be deposited. You can also use this feature to build new roadways, and ramps up steep cliffs to create short-cuts for your workers.

Tuned the path planning. The workers are now less averse to climbing slopes. Steep paths are still avoided, but less so. This fixed an issue where the workers could get stuck in a vortex of the path planning flow.

Friday, March 18, 2016

Imhotep Progress - WEEK 02

I'm working towards the release of my new game Imhotep, Pyramid Builder on Steam. As I did for my previous game, I will report on the progress each and every week. Even if there is no progress, the report will be made. This is the best way to keep on track, and fight procrastination.

Lots and lots of progress this week. I added the capability for the player to pick up and drop individual members of the crowd, which at the moment also comes handy when a worker gets stuck during navigation. Added spawning from multiple tax offices. Implemented win/lose conditions: you lose when half your population is dead. You win when the pyramid is finished.

I added steam stats and steam achievements. Currently I have these:

I also added two great music tracks, one for menu music, one for in-game music. Both pieces have a distinct North African vibe to it. So it helps you get into the mood of the Egyptian lands. I must say that adding music to a game prototype does add some legitimacy to the game, and makes it feel more like a complete product.

I've added save/load game functionality. This was a hard one, as I need to track down each little piece of game state, and make sure it stores and restores correctly. It is implemented now, but I'm not sure it's without bugs yet.

And to conclude: I also added sound effects. They are pretty neat. You can hear the workers pickup water, drop water, harvest, drop grain, pickup and drop food, pickup and drop stones. With proper 3D audio using OpenAL. If you zoom out, you hear all the action in the distance. And zoomed in, you hear specific actions.

Saturday, March 12, 2016

Imhotep Progress - WEEK 01

I'm working towards the release of my new game Imhotep, Pyramid Builder on Steam. As I did for my previous game, I will report on the progress each and every week. Even if there is no progress, the report will be made. This is the best way to keep on track, and fight procrastination.

This week has been spent on getting actual game play in. I hooked up the spending of silver on buildings. Here's the hieroglyph that spells silver.

I added scrolling by moving the mouse to the edge of the window. I fixed the OSX build of the game. It looks really nice and sharp on a retina screen. I added emoticons. If a builder is tired and hungry, a sleepy face is used to denote that state.

I created a hiring menu. Once hired, the new workers are spawned sequentially from the tax office. I improved the gradient visualization.

The buildings all compete with each other for deliveries of goods. They also compete with each other in providing goods for pickup. This competition needs to be regulated, as we do not want to swamp or starve one building over the others. To do this, I am using the notion of 'urgency'. I've spent a lot of time this week tuning these urgency levels, so that if a building goes too long without service, it will increase the desirability to the workers.

All these efforts mean that the game has slowly gotten to a playable state. Placing buildings, hiring workers, earning silver are all in, so there already is a game challenge in there. It just needs a lot of finishing up. Win/lose conditions, leader boards, achievements, load and save games, game settings and Steam integration are all still on the todo list. Hopefully I can take some of these on next week.

Friday, March 4, 2016

Imhotep Progress - WEEK 00

I'm working towards the release of my new game Imhotep, Pyramid Builder on Steam. As I did for my previous game, I will report on the progress each and every week. Even if there is no progress, the report will be made. This is the best way to keep on track, and fight procrastination.

This week, the green light was given for publication, and in this week I made the following progress:

I've introduced the concept of both 'Silver' and 'Tax Collector' to the game. So far, silver only has a hieroglyph statistics title. For the Tax Collector, I made a hieroglyph, I designed a 3D model of a building with a guard using Wings3D. I generated a lightmap for this building using Blender.

The idea of the tax collector is that the food that is produced is either delivered to huts for consumption by the workers, or it is delivered to the tax collectors. When the latter happens, silver money is generated and added to the player's purse. I want to use this silver to finance new buildings, and hire new workers. The idea is that the player starts with one hut, one field, one bakery and one tax collector's office. In addition to this, the player starts with a few workers as well. To build up the work force, taxes need to be collected and spent.

I have also added panning with cursor keys (in addition to panning with mouse drag which had already implemented.) I intend to add panning by moving the mouse cursor to the edge of the screen as well, like Cities: Skylines does.

I've also added basic tooltips on the mouse that translates the hieroglyphs into English. I want to switch these off by default, to add to the mystique of the game. Figuring out the hieroglyphs should be part of the challenge, I think. I will add a cheater mode for the lazy people.

Wednesday, March 2, 2016

htr sr

So these hieroglyphs (in this case, read from right to left) spells htr sr. We only know the consonants of the Ancient Egyptians, and the scholars do not know what vowels were in their words. This 'htr sr' translates to Tax Official in English.

The twisted wick is the 'h' sound, the bread loaf is the 't' sound, the mouth is the 'r' sound and the folded cloth is the 's' sound. The man with staff at the end is a determinative, clarifying that it pertains to a person.

Why do I know this? Because my game Imhotep, Pyramid Builder uses a hieroglyphic UI, and I needed to add taxes to my game.

There are some great resources available online to translate into hieroglyphics. There is the book by Charles E. Nichols. And there is this online dictionary. Wikipedia's Gardiner's sign list is of big help too. There are plenty of ancient samples available too. And a quick introduction to transliteration as well.

To create the artwork for my UI, I study a few samples from the antiquities for each symbol. Then I create my own version of it in Inkscape, the SVG editor. I export them to PNG, and convert them to raw images for use in my game.

I am seriously considering not showing the English translation of the UI, by default. So that figuring out the UI becomes part of the challenge. I would add a cheater-mode for lazy people, which enables tooltips with mouse-over so that they know the English meaning immediately.

So yeah, however the game turns out, it is bound to be unique. I don't think there are any other games with a hieroglyphic UI. The game would also stand out on the massive crowd simulator that I implemented for it. Thousands of little workers, each going about their own business. This is courtesy of the Continuum Crowds algorithm, that enables path planing for massive crowds. I partition my crowds in many flow-fields, depending on their current needs (fetch water, deliver food, pick up sandstone, etc.) And the little workers will plan their journeys, based on congestion, preferring to walk with the dominant flow of traffic, not against it, and such. It is quite pleasing to the eye when large crowds are moving. This game is coming to steam in 2016.