XaiJu
fantasytowngenerator
fantasytowngenerator

patreon


Development Update - March 2024

January

Hey everyone, hope you're all well. After my last post (at the start of January), I went straight to work optimising the generation and storage to enable larger settlements. This continued a lot of other work leading up to this (I've first mentined larger settlements in my August 2023 post) - so I'm very happy to announce settlements of up to 50,000 people (5x more than previously) are now enabled!

These are fully populated, just like the smaller settlement sizes. Only premium users can create these metropolises - free users can create settlements of up to 25000. I also updated the size selection to allow for custom sizes:

Overall I'm happy with the way the larger settlements look, but there are plenty of things I want to do in the future to improve the general look of settlements. These include things like more interesting road junctions, landmarks, and placing buildings on the outer edge (so roads don't surround the settlement). 

February

Theres a story here, but it's technical, and I'm not sure how interesting it will be, so TL;DR: I did a big refactor, which will make it easier for me to make changes going forward.

I enabled larger settlements at the end of January, and when I did so I noticed that the version running on the website was much slower than the version I run on my computer for local development. This had always been a thing, it was just exacerbated by the larger settlement size. While I was investigating this (I eventually discovered it was due to some of the browsers I was targeting), I found out that the tool I used to build the website (create-react-app) is no longer recommended. So, at the start of February, I set out to find a new solution. 

I looked at two alternatives, next.js and vite. Next.js is a framework for creating react apps, with lots of cool in built features like image optimisation, while vite is purely a build system to build web applications. I played around with both, and I found that next.js wasn't a good fit for town gen as it really pushes server side rendering (SSR) (where you have a server that serves the website), which as the name suggests, needs a server. That's not how I deploy the website, it's just statically deployed as files (so no server). Technically you should be able to use next.js without SSR, but I wasn't able to make it work (and it added a lot of noise to the code, having to annotate everything with 'use client'). 

Vite worked much better


Comments

Looking forward to trying it out, thanks for the hard work!

Evindale


More Creators