Sharing Saturday #75

· ☕ 4 min read

Black Future

As usual, my github can be found here:

It’s been a pretty productive week, and it’s starting to feel like more of a game and less of a tech-demo. On the back-end,
I implemented a message-bus system to complement the ECS. It uses a similar system (templated, so you instantiate it with
a list of message-types to support, and it makes one contiguous vector per message-type), and has tombstoning (mark a message
as deleted, and it will be culled on the next mark/sweep tick) and time-to-live (so you can indicate how long a message should
stick around before being read - or being read and not marked as deleted). I really like working with the templated systems that
provide their own tuple of vectors; it makes it easy to provide an interface to systems such as
ecs->get_components_of_type<renderable_component>() and receive a pointer directly to the vector, no copying involved.

On the game side of things:

  • The user-interface is much cleaner, now. Instead of panels with a console and options, almost all of the screen is dedicated to the
    game view. I think it looks a lot cleaner, and (along with the other improvements) conveys the same amount of information. New UI Screenshot

  • Cordex (the AI you play) requires power. At the start, with your trashed escape pod, you have some functional solar panels and batteries - but
    barely enough to get through some nights. This is now tracked, and displayed. Solar generation takes into account time-of-day.

  • Settlers require sleep, food, and water. I haven’t implemented beds, yet - so the settlers will fall asleep wherever they happen to be
    standing when their sleep-timer goes off. The escape pod includes a water purifier, and a small food replicator (it produces NutraGunk, a perfectly
    nutritional but really quite revolting super-food). Both systems require power to use, so hungry/thirsty settlers are your initial major source of
    power drain. I ended up spending quite a bit of time tweaking values to ensure that you make it through the night!

  • In order to support pathing to food/drink, I found myself with a choice: I could do a search for food sources, followed by an A* navigation run (which
    needs to be supported anyway, and A* isn’t too hard to write), or I could use __flow maps__. I opted for the latter, because eventually I want there to
    be a LOT of settlers running around, and many sources of food and water. It’s really nice to work with - it simply recursively floods out from each
    source of food or water, marking distance (which simply goes up by 1 each time) and the entity ID # of the source (and skipping tiles that haven’t
    been revealed yet). This makes the settler’s path-finding a simple “compare the distances of the available exit tiles, follow the lowest” calculation,
    and still guarantees an optimal path to the source.

  • Emotes/unimportant speech can be emitted by any component with a position_component, and can be color coded. These appear in a little pop-up
    pointing to the location from which they originated, and gradually fade out. Right now, they are used to announce some settler state changes. For
    example, when a settler wakes up they give a yawn, and there’s announcements when they eat/drink.

  • In order to better interact with the world, I setup tooltips. Right now, they are mouse triggered only - but a “look at” key is coming very
    soon. When you hover the mouse over a tile, a tool-tip shows you all about it: what entities are there, terrain and climate. This will serve as
    a basis for a contextual options menu (things like “build here” with a list of buildings, “view” for creatures, etc.). A Tooltip Screenshot

  • I’d like stealth to be part of the game (which lead to some of the lighting work I did early on), so I added a facing-direction and field-of-view
    to each settler. It looks a bit silly when they are in random movement mode, but works well when they have a destination. A field of view in action

  • I’ve started implementing items, but it’ll be next week before there’s anything to show for it.

I’m pretty happy with how the result looks. Here’s a screenshot, showing lighting, tool-tips, emote pop-ups and randomly wandering settlers


Share this post
Support the author with