home about the studio about the team luxe game engine join the discord

You've successfully subscribed to Studio Any Percent!

Subscribe to Studio Any Percent

Stay up to date! Get all the latest & greatest posts delivered straight to your inbox

mossfield origins - dev #1 & 2

#1 - status and tasks

Current state

- Buildings + Upgrades system and content pipeline
- Basic Resources, spending, gaining, and displaying
- Foundations tech tree implemented

Next steps

- Switch to stockpiles for resources, including as building in/outs
- Use pathfinding to navigate the space
- Implement power grid
- Block in initial tech tree
- Implement custom building behaviours

#2 - stock piles

Research Centre

One building I hadn't added yet is one of the most important... the research centre.

This is effectively your starting point, your base of operations, and holds your initial stockpiles and emergency rations.
And as you can tell by the name, is also where you'll conduct research. This is also the conduit for people to join your efforts, or, if you're not managing things all that well... their way out and back home.

The visuals aren't final of course, but they're representative.

Stock piles

In the first dev log I mentioned some of the upcoming tasks including switching to stock piles.

Previously (since I'm working quickly) I stored resources in a map, like this:

resources["wood"] = 5

That works well for quick testing, but the actual system should be based more on resources existing in the world, and them being isolated storages essentially, with their own inventory. The other factor is the hud, the values displayed ask the stock system the amounts for each type, which it tracks trivially.

This has been converted, so now when you're creating a producer, you have to specify which stock pile it will produce to, and likewise a consumer needs to state which stock it will draw from. This is typically defined by the building prototype (prefab), which decides where those are in relation to the visuals, the rates at which things happen, and so on.

Below you can see how the system works. You can see the existing stock at the research center, and you can see when I build a producer (currently hacked onto the Resource Foundation...) it starts to stack up. Note the hud values change too.


Here's how it looks in the editor when creating a consumer. In the engine, an entity is the 'unit of work' so we create an entity for the consumer, and we attach a Consumer modifier to it. We also create an entity for the stock to draw from, and attach a Stock modifier. There's no reason in the singular case you couldn't have these on the same entity, but I like seeing the in/out separately. You then tell the consumer which entity to draw from.

Note that the stock has an "amount per visual" where you can display e.g one chunk for every 10 units, or whatever fits best. Producers and consumers also specify a rate (in game hours) and an amount to generate.  None of the values I've used here are meaningful yet.

And here's how that quickly made consumer looks in game.


Currently the spending doesn't use the stock yet, and the people don't physically move the stock around.
That'll be the next step, that they walk over, grab some stock and move it around.

Either that or power grid, we'll see.
That's all for today!