Game Design, Programming and running a one-man games business…

Kudos 2 is now on steam! omg.

So here is a bit of a random thing but… I just put a game on steam that I made a LONG time ago, and was never actually released on steam….drumroll… on steam.

Its called Kudos 2, so obviously its a sequel. Back in the early days of indie gaming, before steam was a thing, I was already making games. I’d already made a bunch before this one, namely Asteroid Miner (Star Miner), Starlines INC (Starship Tycoon), Rocky Racers, Kombat Kars and Kudos. Then eventually came Kudos 2. Kudos 2 was the first game that was a proper success for me. I remember when it was on all the casual game portals, like iwin and yahoo games etc, getting a check for $20,000 one month, which was insane for a ‘shareware’ game developer. These days thats 10minutes royalties for Rimworld :D.

Kudos 2 is a pretty interesting game. It was one of my actual good ideas. The sims was a great game, but it was mostly a game of urgent problem solving and time management. It was a life-simulation game, but it was only ONE way to do the idea of a life simulation game. Nothing is set in stone that lifesims have to have 3d worlds and an animated character. The way I saw it, a life sim was about decisions.

If you think about your life, its not really a time-management or arcade game that comes into mind, but a series of decisions made throughout your life that impact how things turn out. The decisions might be huge (who to marry) or minor (do I eat healthily tonight?). The point is, that life can be seen as merely a series of decisions.

Weirdly the concept for this game came from the movie Donnie Darko. A great movie, that I can never rewatch because it really freaked me out. This is before the term ‘triggered’ became a thing. For me, Donnie Darko is a film about the struggles of mental health. I wanted to make a game that took the struggles inside a person’s mind, and made them a strategy game.

Many years after releasing Kudos 1, a teacher emailed me to tell me she used the game in a school for students with autism to teach them how to maintain friendships and relationships. I thought this was amazing. It still didn’t occur to me that I may be autistic, and wouldn’t do for another 15+ years. Madness. I literally made a game where friendships are represented by progress bars and stats, and didn’t realize what that said about me :D

Anyway… I think its a cool game. Its very different, and its obviously something you can just play on a laptop. I have NOT updated the game at all, but it runs on my windows 10 and 11 PCs ok. The screen resolution might be a tad annoying, but its playable. I don’t expect the game to rush to the top of the bestseller lists, but some people who like life sims are going to really enjoy it.

Also, I’m really not going to go through all the process of getting steam keys for old customers etc. Its just a huge admin nightmare, because the game was sold through so many different services and sites, and I’d just be spending all day doing that. Its only $5.99 on steam, so I guess anyone who actually genuinely wants to play it again will happily pay that.

So there you go, another new game release from positech games haha. Maybe I’ll release my space shooty game this year as well. Anything to keep busy when I’m grinding my teeth about solar farm delays :D

A longer perspective on the unity pricing fiasco

So everyone in the games industry by now is aware that unity, the company that makes a very popular game engine, announced a new pricing scheme, whereby as well as charging you monthly for everyone who you wanted to employ to use their software, they also felt that you should pay them every time anyone, anywhere installed any software that had been made using their engine.

LOL

There is a lot of online outrage, and justifiably so, and to be honest, there is not nearly enough outrage enough. My perspective on this is different, because I’ve never used unity (I tried once and despised it), and have nothing at stake here. Every game I have made has had its engine coded by me, and I pay nobody anything for the privilege. I thought it might be worth blogging my view, because I think its a different one to everybody else. I’ve been thinking it over, and reckon the best way to articulate my thoughts is a series of separate points

Point #1: You probably don’t even need a commercial engine

A lot of people who read this will be indie game developers like me. A lot of you probably make 2D games. 2D games are great, they sell well, they can be very commercially successful, and there is little to no stigma making a 2D game. Some of the most popular games you can buy are 2D. 3D games are harder to make, from an engine POV, but if you don’t want to pay for a commercial engine, then there is a lot of mileage in 2D gaming. I’ve had a 25 year indie gaming career doing entirely 2D games, sold millions of copies, made millions of dollars. Production Line was isometric, but still just a bunch of sprites. None of the games I have shipped needed a commercial engine. Prison architect was a smash hit without needing a commercial engine. If you are wondering how successful you can be before needing to license an engine, the answer is: Hugely fucking rich and successful.

Point #2: If you need an engine, lots of free ones exist

Unity costs money, but many other engines do not. A good friend of mine paid $80 for a simple 2D game making program and has shipped 10 games with it, and made a living doing so. He is not the only one. There are more game engines than would possibly fit in a normal blog post, and no shortage of reviews from developers to guide you in making a choice. Free engines also have the bonus of coming with source code, so if you don’t like something, you can just change it.

Point #3: Lock-in is always a nightmare for consumers. Why are you surprised?

Every time a company talks about walled gardens, what they mean is they want to screw their customers. Starbucks will blatantly open a dozen unprofitable coffee shops in one town to force every competitor out of business, then shut the excess ones down and milk that profitable local coffee monopoly. Its a known business strategy, and its evil as fuck. Apple HATE the idea of shipping a USB connector with their phone (a supra-national government had to force them to do it), because they want to keep their customers locked into their ‘ecosystem’. The same was true of itunes, which they deliberately made crash, and buggy and slow on anything that wasn’t apple hardware. Its all about the ‘ecosystem’. Let me help you recontextualize this. When someone in a suit (or a black turtleneck) talks about their ‘ecosystem’, they actually mean a different word: Prison.

The ideal for these predatory businesses is to make it impossible for you to leave. Governments always have to intervene to prevent big business acting this way. Unity was VERY keen to force you to be reliant on them for everything. You buy your art assets in the UNITY store. You use the UNITY engine and the UNITY editor, and sell ad space using the UNITY ad system. Steam is similar. Steamworks is not a charitable gift. They want you to lock your achievements, your stats, your community, your interactions with your players all within steam. This way you will never leave. You can’t, they have you. Unity owns all your tech, steam owns your community, youtube owns your video channel. What do you own? Your office chair maybe? Expect to see Herman Miller asking for a share of your game revenue soon.

The actual walled garden apple execs enjoy thanks to us.

Point #4: Engine coding isn’t that hard

I knew we were heading for an apocalypse the minute we started seeing job adverts for ‘Unity programmer’. Thats not a language, it a proprietary product by a single, private company. If you really want to be 100% dependent on the whims of a private company for your future employability, go work there! Do not pretend that you can ‘exist independently within the ecosystem’. Unity LOVED the idea that people would stop being AI programmers or C++ programmers. Unity programmers have no place else to go..

..but actually, when you look at game engines, especially 2D ones for indie games, they are really *not that hard*. Its not 1990 any more. We are not having to worry about makes of mouse or video card. Directx makes things very simple for you. Its just a few hundred lines of code, at most, to have access to the graphics card, to be able to load in textures, play sounds, and respond to user input. This stuff is super-well-documented and TONS of sample code exists. Reading user input is really, really easy. Creating a sprite, loading a texture from a folder, and drawing it onscreen is actually pretty simple stuff. Particle systems and multithreading are NOT simple, but also not rocket science. Do not underestimate how much FREE stuff there is out there explaining how it all works…

Point #5: Software subscriptions were the line we shouldn’t have crossed

I remember back when adobe started trying to get people to subscribe to photoshop, thinking that this must be an April fools joke, or the rambling of a delusional coke-fueled imbecile who staggered into the board room. The idea that SOFTWARE was something that had to be rented instead of purchased was a joke to me.

Heres the thing: Microsoft are actually pretty fucking good at their job. Windows 11 will still play a game I made in 1998, without errors, or compatibility screwups or grumbling. If there ARE any issues, there are tons of compatibility options to make it work. Why mention this? Because its evidence that its pretty clear that you can write software that just keeps working, and working and working.

Software subscriptions are a joke. This is a way to force you to continually pay, without limit, for a package of software that should have been an affordable on-time purchase. Photoshop is an image editor, its not doing protein folding. Microsoft word is a word processor, thats it. This is stuff that we, as a technological society, kinda worked out how to do 20 years ago. The overwhelming majority of ‘new features’ added to Microsoft office in the last TWENTY years are useless, and go completely ignored by everyone. Photoshop was done, finished. So was Excel, and Word. But they wanted to find a way to make you keep paying…

I have no problem with unity, or any game-development engine/IDE saying ‘Hey guys! We just finished a BRAND NEW version of our popular and much loved engine. If you want to upgrade from your current version to this one, its $500!’. Thats a perfectly viable, perfectly understandable business. But I guess if you are TERRIBLE at running your business, stupidly think you need 8,000 staff at unity, blow a bunch of money on an ad-monetization company, buy a movie SFX company, then suddenly realize you are losing money like crazy, then you have no choice but to try and squeeze more money from existing customers on a regular basis. Don’t expect Unity’s CEO to understand game dev BTW. He is a pure-management type with a background at pepsi and Hagen Daz ice-cream, A golf company and sara-lee, the donuts people. He neither gives a fuck about, or understands the games industry.

Final point #6: Unity’s dysfunctional management and terrible business is their problem not yours.

Its pretty clear that the top management at unity do not code, do not make games, never have, never will, don’t care, and here is the very worst bit: are absolutely fucking clueless at running a business. Its laughable. My company is way, way more profitable than unity, and I manage that with just me. The important point is: THIS IS THEIR FAULT. Its not yours. People saying ‘to be fair, unity do lose money’ are implying that somehow game devs made them lose money. Nope. Game devs have been paying these people through-the-nose for years for an engine that is so bad that even unity could not make a game with it.

I really, really hope that this is a turning point and people tell unity to get stuffed. This is a company that cannot be trusted, should not be relied on, that you should not deal with. Now I know that they have ‘tech we wont explain’ to ‘track installs’ which no doubt phones home to unity, I am not even going to have any unity games installed on any hardware I own. This is a casino and F2P ad-tech company LARPing as a game dev tech firm. I do not trust them one bit. Asking for a subscription fee should have had them laughed out of the industry. This latest madness is just proof they will never change, only get way, way worse.

Solar farm mini-update: Waiting for rego

I haven’t mentioned my solar farm for a bit, because frankly nothing has happened. This is extremely frustrating, to put it mildly. Anyway, we have been beset by the evils of bureaucracy and delays again. The REGO stuff is taking ages, and we have been waiting on agreement on earthing…

Solar farms need earthing, in case of lightning strikes etc, and earthing 3,024 solar panels, inverters and a lot of metal framework is a big task. Because the soil at each site is different, the amount of earthing you need differs, and also the topography of each site differs, its not a standard thing that applies everywhere. We have CCTV masts, a surrounding fence (which will be mostly wooden posts IIRC, but definitely has metal components), a metal gate, a substation, and switchgear. The earthing for all of this has to be designed so its safe.

What causes mayhem is that the earthing has to be approved by the DNO (who will have their own substation), but they only design ‘their bit’ and then we have to use external consultants to design our bit, and then both sides have to agree that the other sides design doesn’t interfere with them, and then you can proceed. This involves at least 5 companies (mine, the HV consultant, the farm developer, the DNO and the earthing specialist), and everyone seems to take it in turns to have summer holidays, which has stretched things out enormously :(

The trouble is you cant do digging for foundations for the substation until you know what earthing grid you need. Without the earthworks you cant have the substation, without the substation you cant move the HV line. Without moving the HV line, we cant finish the panels…

So anyway, we finally have agreement (I think) on what the earthing design is, which means we can now start implementing it, which means we can do the substation foundations, and then the actual substation and switchgear install, and also then the meter install, the final panels & frames, and the moving of the HV line. We also need to do CCTV and perimeter fencing…and then its done!

At the same time (because I like to keep SOME progress happening) I have been trying to get certified for REGOs, to prove I am a renewable generator, and thus earn a higher rate for selling my power. This involves a hugely confusing process to fill out a form on a website from 1970, whereupon your application just sits in a pile and is totally ignored. Welcome to the UK government, and its 0.001% level of efficiency. Quite why there is a delay of more than 24 hours for a REGO application is beyond me, but I strongly suspect its something that I can do nothing about, that no politician will ever fix, and that just acts as yet another irritating drag on productivity because this is seemingly a country in terminal decline :(.

I have already chased my application by email twice, but obviously they get ignored too. I’m away for a week, and planning on starting with daily phone calls to chase it once I get back. I make no excuse for being annoying with stuff like this. If the system was well managed nobody would ever have to chase anything, but here we are…

Anyway, thats the update. No pictures to show, nothing to report except waiting, and waiting and waiting :(. The latest guess I have for energisation is early November, which frankly I would be content with.

Its gloriously sunny here today.

Code Breakdown for Gratuitous Space Shooty Game

I code my games in C++ using visual studio 2015, and some help from visual assist from whole tomato (basically improved intellisense). I coded my own engine, but as GSSG is a simple 2D space shooter, thats easily good enough. I thought just in case anyone who reads my blog is learning C++, it might be interesting to describe some of the code.

The core part of the game is a function called GameProc, which is what gets called from the WinMain function in a loop, assuming the game is running, and its super simple:

void Game::GameProc()
{
GetInput()->Process();
GUI_GetSounds()->Process();
GGame::GameProc();
}

Thats the whole game loop! But obviously most of the relevant stuff happens in other classes. The basic principle is important though. My games reads all asynch user input (basically its checking the keystates for the keyboard), then it processes the sound engine, then the core game does its thing in a separate class. User input from mouseclicks and key hits is handled differently. I go through the windows messages for my app, and handle them as they happen outside this loop.

The fun stuff happens in that second GameProc function, which looks like this:

void GGame::GameProc()
{
	HRESULT result = GetD3DEngine()->GetDevice()->TestCooperativeLevel();
	if (FAILED(result))
	{
		if (result == D3DERR_DEVICELOST)
		{
			Sleep(50);
			return;
		}
		else
		{
			RecoverGraphicsEngine();
		}
	}
	if(PCurrentGameMode)
	{
		PCurrentGameMode->ProcessInput();
	}
	if (BActive)
	{
		GetD3DEngine()->BeginRender();

		if(PCurrentGameMode)
		{
			PCurrentGameMode->Draw();
		}

 		GetD3DEngine()->EndRender();
		GetD3DEngine()->Flip();
	}
	else
	{
		ReleaseResources();
	}
}

This is more interesting! Lets go through it. This code first checks to see if we somehow have lost the focus of the graphics driver, and if we have, it just pauses for 50ms and checks back later. Ideally everything then recovers from losing directx, and gets rebuilt. This sort of stuff isn’t really a problem now, as everyone is using non-exclusive borderless windowed mode, so its kinda legacy. The main game stuff comes next. The current game mode reacts to input, then assuming the game is still running, we begin the scene, draw everything and then end the scene, copying the backbuffer to the screen with flip.

So where is all the actual game code I hear you ask?

The trick is that PCurrentGameMode pointer. This is a pointer to an object thast represents the current game mode, and which one is selected and current is based on what we are doing. Right now my game has one object for the main menu, one for the (debug only) level editor, and one for the main game class. To make it interesting, lets check out the code for the main game objects call to Draw():

void GUI_Game::Draw()
{
	SIM_GetGameplay()->Process(); 
	GetD3DEngine()->ClearScreen(RGBA_MAKE(0, 0, 0, 255));
	GetD3DEngine()->ClipViewport(GetGame()->ScreenArea);
	if (GetGame()->GetGameModeName() == "game")
	{
		SetRT("rt_offscreen");

		GUI_GetBackground()->Draw();

		if (SIM_GetGameplay()->GetGameMode() != SIM_Gameplay::PREGAME)
		{
			SIM_GetShipManager()->Draw();
			GUI_GetAsteroids()->Draw();
			SIM_GetBulletManager()->Draw();
			SIM_GetPowerupManager()->Draw();

			GUI_GetParticleManager()->Update();
			GUI_GetParticleManager()->Draw();
			GUI_GetFloaterManager()->Draw();
			GUI_GetShieldStrengths()->Draw();
			GUI_GetDropLabels()->DrawAll();
		}

		PostProcess();

		GUI_GetInterface()->Draw();
		switch (SIM_GetGameplay()->GetGameMode())
		{
		case SIM_Gameplay::GAMEOVER:
			PGameOver->Draw();
			break;
		case SIM_Gameplay::POST_LEVEL:
			break;
		case SIM_Gameplay::PREGAME:
			DrawPreGame();
			break;
		}


		GUI_GetWindowManager()->Draw();

		if (BPaused)
		{
			DrawPaused();
		}
	}

	GetD3DEngine()->RestoreViewport();
	DrawBorders();
}

There is a lot of hacky nonsense happening here, but this is just a little hobby game, so I’m not too ashamed :D. So what does this do? Well the very first line of code does all of the actual gameplay stuff. I have an object of class type SIM_Gameplay, and I call that here and do all of the game simulation stuff. This moves the alien ships, handles scores, collision detection, and anything like that. All of the game mechanics are processed here, neatly separate from the graphics code.

Then I clear the screen to black, and clip the viewport (where we render) to an area I defined to be the gameplay screen. This is not the full screen, because I’m fixing the aspect ratio for this game to be some multiple of 1920×1080. This is the ‘ScreenArea’ which is just a RECT structure.

Then I get a bit clever. I set the render target to be an offscreen copy of the backbuffer I called rt-Offscreen. This is where I do 90% of the drawing in the game. I then go through a bunch of various singletons which access different visuals objects that get drawn, from back to front in painter-algorithm style, no Z buffer needed.

Finally I call PostProcess(). This is where I handle some fancy shockwave effects. I fill up yet another offscreen buffer with special images to donate any visual distortions I want to have, for when ships have shockwave explosions. I then copy the whole of that rt_offscreen to the backbuffer, using a shader which combines it with the contents of the distortion buffer to give me a nice distorted shimmer effect. Then finally I set the new render target to be the backbuffer, and draw the UI overlay stuff normally, so its NOT distorted by my shimmer effect.

Then I have some hacky places where I draw certain UI elements if the game is over, or not started yet, and then any windowed stuff, and finally some hacky code to draw GAME PAUSED if relevant.

Finally I restore the viewport so that I can fill in any surrounding borders for unusual aspect ratios and not have anything ‘leak’ out onto the edges.

This code is all a bit messy, because I haven’t nicely settled on a naming convention for a lot of those functions. Am I calling Draw() or Update() or DrawAll() its kinda random! Plus that UI stuff thats on the end of that function is a mess. I’m handling things THREE different ways here! An enum (GameMode) to call different functions, a complete window manager UI PLUS a special case there for if the game is paused. What a mess!

It all works and feels bug free, but its not clearly software engineered at all. I will definitely go back and re-arrange stuff and re-factor it so everything is laid out nicely. The reason I do NOT code like that at the start of the project is because I often throw things in quickly to see if they are a good idea, and I don’t want to type out a whole bunch of complex engineering layout baggage just to discover that this is a bad game mechanic or that this thing looks awful :D.

This is just the way I code, it doesn’t make it officially good, or fast, or better, its just what works for me!