Category Archives: production line

This is a round-up blog post covering lots of things:

Firstly some meta-stuff. I haven’t been super-frequent in updating this blog recently, and I also have been tweeting a lot less (in fact the wonder of analytics allows me to say my tweets are down 36% in the last month). I also un-followed a lot of accounts, I removed a lot of facebook friends, and I’ve quit some other online stuff. I’m trying to avoid the harsher, more serious, depressing net.

Frankly social media, and much of the internet in general is making me unhappy, and I’m reducing how involved I am with it. I have never been one of the ‘hip’ indies that knows everyone else, and I’m moving more towards being an ‘offline’ kind of person, for my own happiness.

Obviously that doesn’t affect tech support, PR, or blogging/tweeting about what I’m working on, so here we go…

NEW DLC! is coming to Production Line. I have not settled on a final name for it, but its likely ‘Design Variety Pack’ or something like that. Basically every car design in the game gets a duplicate, purely for cosmetic reasons. This is so you can have more variety in the game, and also so that you can more immediately tell which cars are the ‘expensive’ SUVs etc, without having to always resort to selecting a color for each design (Which I tend to do, but it feels a bit of a hack…).

Here is a tiny tiny short video clip of the new sedan.

And here is another tiny one showing we toggling between two designs of the same type.

All the code for this is now DONE, and I am thus just awaiting final artwork before I add this as a new piece of DLC. It has to be DLC because actually the art costs are PRETTY HIGH for this sort of thing, because it basically involves redoing a*all* of the car art for the game, as every new design variant may need a different position for each wheel variant, each seat, and so-on, and thats a LOT of art layers, modeled in 3D and rendered in 2 different directions.

In unrelated news, I’ve been working on some tweaks to the UI for the game, and the latest thing I added is this ability to toggle the showroom view to a ‘summary’ view that shows you how many of each car you have, rather than an endless stream of them. This is togglable with a button, but it auto-guesses which view to show you based on how full the showroom is when you first open that window:

I need to have that toggle in there to support both views because there is some functionality ‘lost’ in the summary view, as you then cannot select an individual car to see its views from customers, its applicable discounts, any defects or missing (uninstalled) features etc. Hopefully its all pretty intuitive and I don’t need any extra tutorial stuff for that? (I do worry about needing an extra tutorial window for that new toggle button for the DLC designs…not sure if its obvious or not…).

Anyway…thats Production Line stuff. I am also starting to help out full-time Democracy 4 programmer Jeff, who is doing great stuff on making the crispest, sharpest GUI for a positech game so far. (Its vector based, so smooth scaling and pixel-perfect UI is here!) I know Democracy 4 seems to be taking a long time, but it will be worth it, and we will have screenshots to show the world pretty soon :D

In a recent conversation with fellow indies about how I can make production line look better, someone effectively said ‘why are you not using mip maps’, and at first I laughed because, LOL, I use mip maps, and then I remembered that the geniuses at Microsoft decided that D3DXSaveSurfaceToFile should not generate mipmaps so actually…the game didn’t use them for many of its props (the stuff in texture atlases, basically).

So obviously I immediately thought what a dork, generated mip maps and…

it kinda looked way worse. Or did I? I have stared at the pixels so much now I am starting to see things. Here is the game as it currently looks (mip maps enabled in engine, but most of the car graphics and prop graphics not generated with any). (click to enlarge)

And here is it with mip maps enabled. (click to enlarge)

From a distance does it look any BETTER to you? I’m not sure I can really tell much of a difference until I zoom in. Here is evidence of how blocky the current one looks when zoomed in…

versus the mip-mapped one.

Which obviously looks better, but its not *that* simple, because the mip-mapping also creates some artifacts. here is a montage of the current, and lots of mip-mapped styles, with different settings from mip map creation filters, sharpening and softening etc. I just can get those door lines to vanish…

Which possibly means that I need to adjust how those cars are being drawn, or means I have not yet found the perfect set of render options for generating dds mip maps. There is also the possibility that the way I render out my car-component atlases (with a black background) is bleeding onto the mip maps at lower levels, and that this is where the problem is.

Of course all of this is absolutely *a matter of opinion* and thus really annoying, as I am a data-driven guy and like hard facts,. so stuff like this is where I fall down a bit. I don’t like pixellated graphics ( I despise the look of minecraft) but on the other hand I also REALLY hate over-blurred images, which make me think my eyesight is failing or I need new glasses. Its also very tempting to give in to the mistake of zooming in to a static image and declaring the best one to be the one where a zoomed in screenshot looks best, which is WRONG because obviously when zoomed right in, the mip maps are irrelevant anyway. here is the current (non mip mapped) car zoomed in.

Which leaves me in a bit of a quandary. Is it even worth continuing to fuss over this stuff…does anybody really notice/care? Or should that time be better spent on adding new features to the game?

How long does your indie game take to start up? from clicking the icon to actually being able to take input at the main menu? Just for fun, I decided to analyze whats involved in doing so for mine.

Because the aim here is to actually analyze the REAL impact, not the best case, I need to ensure that the game (Production Line) is not just happily sat there all in RAM from a recent run-through, so it seems best to oh…maybe launch battlefield V beforehand (and quit it) just to populate disk/RAM with a load of other stuff and do my best to evict all my games code.

Then…its time to fire-up aqtime and take a look. I decided to do line-level, rather than just function-level analysis, which slows the game massively, taking 17 seconds to start (the reality is dramatically faster), but I can still do relative comparisons.

First thing to notice is that pretty much the entire time is inside Game::InitApp() which makes sense.

Rather worryingly though, the vast majority appears to be inside SIM_Threadmanager::Initialise. That *may* be an artifact of aqtimes approach to thread profiling, but worth taking a look inside anyway… And it turns out that 100% of that time is inside SetThreadName() (which i only need for debugging anyway). This is a rare bit of code that I don’t understand well, and was from the evil interwebs:

#pragma pack(push,8)
typedef struct tagTHREADNAME_INFO
{
	DWORD dwType; // Must be 0x1000.
	LPCSTR szName; // Pointer to name (in user addr space).
	DWORD dwThreadID; // Thread ID (-1=caller thread).
	DWORD dwFlags; // Reserved for future use, must be zero.
} THREADNAME_INFO;
#pragma pack(pop)

void SetThreadName(DWORD dwThreadID, char* threadName)
{
	THREADNAME_INFO info;
	info.dwType = 0x1000;
	info.szName = threadName;
	info.dwThreadID = dwThreadID;
	info.dwFlags = 0;

	__try
	{
		RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), 
(ULONG_PTR*)&info);
	}
	__except (EXCEPTION_EXECUTE_HANDLER)
	{
		volatile int foo = 9;
	}
}

The exception is basically ALL of the time. WTF? Apparently there is a less hacky way outlined here: https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code?view=vs-2019 Which I will try later. I suspect the waiting for visual studios debugger is the cause of the problem.

Anyway…onwards and upwards, so whats next? It basically all Init3D() (click to enlarge)

So basically my DirectX initialisation and the shadermanager stuff is most of the problem. I suspect the DirectX initialisdation may be too black-boxed for me to influence further. The first big chunk is this line:

PD3D9 = Direct3DCreate9(D3D_SDK_VERSION);    

Which takes up 34.74% of the start time. The next slow bit is the largest at 41% which is:

hr = PD3D9->CreateDevice( AdapterToUse, DeviceType, WindowHandle,
 D3DCREATE_SOFTWARE_VERTEXPROCESSING, &PresentParameters, &PDevice);    

So…holy crap. how can that line of code even be run? This can only happen if my checkcaps() code suggest the video card does not support hardware transform and lighting. I suspect some of the reporting here must be nonsense? Especially as my own debug logs suggest that the hardware TNL version is the one than ran… FFS :( lets look outside that code then…

Most of the slowdown is in shader manager, which loads 11 shaders:

so it looks like about half the loading time here is actually spent writing out debug data! This is hard to avoid though, as I do find this data invaluable for detecting errors. And because an app can crash and lose all its data, I flush each line of my debug logs to disk with a hard drive flush on each line…

…so interestingly all the time seems to be inside OutputDebugString, which is only of any real use when the debugger is running. However! I *do* want to see that data in both release builds, and debug builds. Maybe I need a flag to tell if a debugger is present when the debug engine starts up? As a first pass I should at least build up a char* with the newline in to avoid twice the OutputDebugString calls. Here is the new code and timings.

Ooooh. I’ve halved the time of it. I’ve done the same with my non-directx debug code too. Now I’ll try changing that thread stuff… It turns out that SetThreadDescription is windows 10 only, so I need a different system (and apparently would need to update my platform SDK…urrrgh), so maybe best to just skip calling that code when no debugger is detected?

This works (using isDebuggerPresent) but the profiler actually trips that flag too, so to set it work I needed to compare time stamps on debug files. Without the debugger, it looks like time from app start to menu ready is 0.395 seconds. With the debugger its… 0.532 seconds.

That sounds pretty small, but actually I’m quite happy as I lost ZERO functionality, and the changes to the debug data will affect any time that data is written, not just during startup. 9Its not a lot, but there is *some*, and I’m an efficiency obsessive.

I think I’ll put a clause around the debugengines OutputDebugString and nuke that unless IsDebuggerPresent() too :D

There are no comments yet

Today is the day! At last someone has taken the time to think of the billionaires… We release an expansion for ‘Production Line’ today, which adds the following features…

Support for Gull wing doors like these:

And for Scissor-wing doors like these:

And also Butterfly-wing doors like these…

And not least a brand new body type called ‘supercar’. It looks like this:

This is the first DLC for Production Line, and it will be available direct from us at www.positech.co.uk/productionline/dlc.html as well as the humble store, GoG and Steam. its $4.99. I did get in touch with a bunch of youtubers and streamers and sent out some keys, but if you want to see exactly how it all works with my smiling face involved, you can check out this blog video I made about the expansion here:

I honestly have no idea if this DLC will be of interest to just a few super-car geeks or to everyone playing the game, so its a bit of a gamble, but I do like having a stupidly expensive car to build myself, and I definitely think it adds to the late game, and adds to the experience for people who want to build super-sprawling factories with some incredibly high-end options.

The DLC actually launches at 9.00AM PDT which is apparently 5.00PM where I am in the UK. here is the link to grab it or wishlist it:

There are no comments yet

So unless you have not heard, i’m making an expansion pack for my car factory game ‘Production Line‘ which adds a new car type (supercar) and also some new door options as features for various car models, and those door types are Scissor-wing doors, Gull-wing doors and butterfly doors. I’ve done a video that shows these off (below) and also we have a web page for the dlc that you can find here.

I thought I’d put down in writing how this came about and why this was the DLC I decided to do. Personally I’m a fan of DLC, but only if its actually ‘adding’ to the game, or giving the player options, rather than just tweaking some numbers and selling a few text files for $5.99. That seems a bit exploitative, so I always focus on doing DLC where we have new art content at the very least. There is a LOT of art that goes into a single car body design in Production Line, because every car is completely different in terms of where the wheels are, what the headlights look like, even what the axles and drive shaft looks like and where they go. Nothing currently gets simply re-used between body styles.

Adding a super-high end car to the game makes sense from a design and balance point of view, because it means we can leave the balance of the existing game in place, and effectively just add a new style option for the luxury cars, and add a tiny section of the public who only want to buy a super-car shaped vehicle. In the real world, most sales at that price point already are accounted for by people buying sedan and sports style bodies, but there are some people who would want to spend the same budget on a car with a crazy shape.

Plus crazy designed cars are cool right?

Once I knew we wanted a supercar, having crazy doors is pretty much a no-brainer. people love cars with mad doors, and some research showed that butterfly, gull and scissor were the most common options on modern real world supercars. In theory putting all this in the game was going to be mostly artwork, and then some balancing by me. pretty easy huh?

It turns out..NO! This was extremely tricky because of the way the design of those doors overlaps other parts of the car when they are open (which involved a lot of re-ordering of existing components), and the nightmarish fact that gull wing doors actually require a different ‘roof’, to allow for the cutouts n the side for the door hinges. This means I had to redefine these door ‘styles’ as roof types, which also ensures you cant have gull-wing doors and a panoramic sunroof…

As a result, door styles have to be like drive-trains: set in stone when the car chassis is first created and unchanged for the lifetime of that existing chunk of metal. In game-terms, this means that switching your luxury sedan to use gull wing doors will not have any visible effect for a while, as the cars right at the start of the line are then set to be gull-wing, but they have to get all the way to the door panel slot for you to notice.

This also involved a huge amount of special case code-spaghetti, because if you have gull wing doors, then certain other things change. You cannot stick normal windows or wing mirrors on a gull-wing door, and so-on. There was quite a bit of complexity involved in swapping some components for others to accommodate the new system.

I like to give my artists total freedom to create cool stuff and tell them I will worry about making it work. I get better art that way, but more work for me… It turns out that yes…its very cool that the supercar’s engine is behind the driver, but that caused me some hassle to ensure that when the engine gets fitted, its the back part of the car (trunk) that opens up to have it fitted, and not the front… (99% of players wont notice, but I like to surprise the 1% who do). As we were doing this anyway, it made sense to support the same capability for the sports cars, which also look like they have the engine in the back.

So all of that stuff is now DONE and tested and working in the game. The installer is done, and I’m working on the steam build, and mod-panel integration. All I need to do before release is keep testing the balance of this stuff to ensure that the doors are expensive and awkward to fit (but not unprofitable or too annoying) and that demand for these features and for the supercar makes sense.

Right now, the game is being tested with supercar sales only taking place in the luxury price band (well yeah…) and with a market size of 4.76%. I think thats maybe a bit high, and obviously in the real world its <1% but this is a game and needs to be fun :D

In terms of balancing the doors, they are currently just ordinary door panels..BUT the slot-upgrades are pretty expensive ($195,000 for a slot upgrade for scissor doors compared with just $3,480 for central locking) and they require sensors and servos, which lead to a bit of a bottleneck (intentionally). Plus the actual fitting time to add those doors is considerable, more than doubling the max-optimized time to fit ordinary door panels.

The final piece in the puzzle is the design cost. All door types need to be researched separately and also you need to research the new supercar body style. These are quite lengthy research items, but there is nothing stopping you skipping all the other car bodies and making supercars or gull wing doors your early game priority!

If you like the sound of all this stuff you can wishlist the DLC using the widget below.

If you are a youtuber looking to cover the game and want to make a key request you can get in touch through keymailer (below) or email me your steam curator name.

There are no comments yet