April's Fool
Hi there welcome back, it's been a while.
Intro
First of all, the eagle eyed among you will have noticed that this Post about April and the previous about March both appeared on the same day May 4th (May it be with you).
Once again, I'd written a draft post for March, but didn't get another chance to edit it before I found myself in April, and then it was May before I realised the time.
Unlike the last time this happened ( December / January ), I thought I'd put them up as two posts, I could have edited the database to say I uploaded it at the correct time but I felt that wouldn't be reflective of myself and my site. While I try ti remain professional in all my endeavours, sometimes the human element slips up and we get small mistakes like that.
Better late than never I guess.
Anyway, back to the usual content.
With my IRL job creeping up to 50 hours a week, I've struggled to find the energy to work on the game, it's a physically demanding job so when I get home I usual have 4 hours to shower, clean and spend time with my other half so it's become a real juggling act.
GUI
With that said, I managed to find the time to finally finish the GUI system, only a few extra tweaks after the last post but it's really finally all done.
With the changes made to the GUI pipeline, I can draw as many windows as I wan't technically, but due to some other rendering work, I'm limited to 100 being on screen at any one time, more than enough in my opinion.
After playing some OpenTTD and OpenRCT2 over the last couple of months I found that I would never have more than 10/15 open so being able to have 10X that is a nice buffer.
While I haven't been able to hook up as many internal systems to the new GUI as I would have wanted it's in a far better state than it was, and I've managed to recreate some of the old GUI systems relatively quickly.
The picture above is from a few weeks ago when I go the system working well for the first time, the only thing missing if the escaped character in the text, it's meant to be an Icon of a hammer but wasn't caught by the text parser after changing some things around.
But the style of the window is much more what I had in mind and all of the interactions are managed in a way that makes sense, to me at least. The down side of the refactor is that there is currently no LUA support, which I intent to add back in sometime after the demo is out.
Peons
So maybe it isn't the smartest idea to waste time on the Peon rendering system but after my experience with the GUI refactoring it dawned on me that I could improve the Peon Rendering pipeline by caching certain elements, mainly the outfits the Peons wear.
Before hand drawing Peons was a 2 pass process, we draw all the "body" elements, head, hair, hands, body.
Then that another shader pipeline draws the outfit with the appropriate colours on top of the peon with the correct depth value to make it appear between the body and the hands (like a body - shirt - hand sandwich).
The first pass would also alter a stencil buffer so that the shirt's would be clipped to the Peons body shape.
Sounds expensive right.
Well this system ran fine with ~150 peons walking around on screen, we cull them if they are off screen, and the stencilling technique started to fail if a couple of peons were overlapping, not the ideal results.
The new solution, is to now "pre-stencil" the outfits into a giant spritesheet, so when a Peon is drawn we check to see if we have it's body and outfit combo are already cached, if not we render it out to the spritesheet and return the index to which it was placed.
Now the Peon Rendering pipeline does everything in a single pass, allowing me to have ~200 Peons on screen before we start see real FPS drops, but by 300 Peons we get around 4 FPS on my dev machine and only 14 FPS on my desktop test environment (GTX 1030, 8GB RAM, AMD A10 7850K).
I think the next step is to pre-cache heads and hairstyles as that's the largest section of the Peon Frag shader at this point.
Using the image above we draw 2 quads, the first only draws the red channel of the texture and the second draws the blue section but to achieve this I have to send extra info about which channel each texture should be filtering for.
That's 3 floats for 6 quads or 18 floats or 8 bytes X 18 or 164 Bytes, when I could get away with using 1 uint for 8 bytes.
Food for thought I guess, It'll be something I need to do once you have more than one shop and a play session lasts for more than 30 minutes so not a priority for now. But I enjoy thing about these types of scaling problems and trying to find ways to optimise my game.
For making it this far, enjoy a picture of some Peons.
The elephant in the blog
Some of you might recall that I set a deadline to stop working on the game or at least to work on something different if after 6/8 weeks I didn't have a demo out.
I think sticking to deadlines is a great way to motivate me to make constant progress towards my goals but I also recognise then I've taken on more than I can manage.
I'd written that plan out when working at a different workplace with different hours and now I'm up at 5am and return home at 6pm. Maybe I can get 12 hours in a week of dev time if I'm lucky, maybe more if I use my weekends more efficiently but family events and personal commitments find their way into those few free days off a week.
At this point, I'm happy plodding along make small but meaningful progress, especially now than I'm out of GUI refactoring hell.
It's been fun to work on some peon rendering, tying systems together and the whole "making the game" part of game dev. I've had some great discussions with my other half about features to add or ways to start marketing the game once it's ready.
So that's been refreshing and was very much over due.
This month I hope to finish:
- The remaining GUI systems for world interaction
- Full shop build flow (since the GUI change it needs buttons and things but also the underlying build logic was broken if I remember correctly, it's been a while)
- Peon arrivals and departures (Another feature I commented out just so I could focus on as few elements as possible)
After all that's done, I think it's about there.
Just a placeholder menu and some sounds / music and the MVP is done (for the 2nd time)
Outro
That'll be it from me this time, more pictures for you to enjoy and a blog post of my drafts pile, let's see if I get one out on time at the end of the month.
Enjoy yourselves and stay safe, h2n0.