Tarnasa
Programmer, hacker, homestuck
News
Projects
Gallery
About

Starbound Diggles Mod

World-generated tunnels with wooden posts and barrels

This was implemented by utilizing Starbound's microdungeon spawning algorithm, you create a whole bunch of .png files with pixel colors corresponding to "brushes" and with some colors acting as "connectors" so that tunnels can link to each other.

One interesting thing that came up was that, nowhere in the existing Starbound codebase, nor in any mod I could find, did anyone have dungeons which "carved out" terrain by removing the foreground but keeping the background, I eventually figured it out, with the following brush fragment:

{
  "value" : [200, 200, 200, 255],
  "comment" : "Remove foreground tile",
  "rules" : [ [ "allowOverdrawing" ] ],
  "brush" : [ [ "front", "metamaterial:empty" ] ]
},
                

Another problem I ran into was that Starbound would not spawn barrels/plants/torches in the tunnel microdungeons, (I guess dungeons are applied after "placeables"). Therefore I had to create multiple varients of each piece, some containing barrels, torches, etc. I didn't do this manually, but instead created a python script which would enumerate these possibilities given a base template.

Clansman can be given weapons and armor

I modeled the clansman off of the existing "crew" NPCs. These NPCs follow you around and fight alongside you, they can also be told to stay put by right-clicking on them. I needed to add A LOT of funcitonality to make these NPCs act more like the self-sufficient Diggles. My first change was creating a rick-click GUI which allowed you to swap out the NPCs weapon slots.

This went fairly well, except for one thing, the current implementation of "swappable" weapon slots was very unintuitive, even a little broken. The Starbound API provides the following methods for NPC's items:

npc.setItemSlot(slotName, item)
npc.getItemSlot(slotName) -> item
				
Unfortunately getItemSlot is broken in that it does not return the correct items when provided "sheathed" slots. This took quite a while for me to figure out >:( but thankfully didn't prevent any features.

Clansman fight, and automatically sleep to heal themselves

Thankfully the combat logic could be mostly copied from the existing crew and guard behavior, and sleeping could be mostly copied from villager "play" behavior. Unfortunately, the default combat is quite poor, so I will have to improve it at some point.

Clansman automatically dig painted blocks

I was so happy when I figured out a way to make the digging user interface similar to the diggles! Starbound provides a feature where players can "paint" blocks one of eight different colors. I didn't much care for this ability, but it allowed an intuitive way to tell NPCs which blocks to dig.

In the end I had to make my own paint-tool because the built-in one was not moddable, this took quite a while, but allows for the "glowing tile" effect you see in the picture.

Another problem with implementing NPC digging was that NPC pathing is not the best, so calculating a good spot for NPCs to stand when digging turned out to be more difficult than I expected.

Clansman get hungry over time, and automatically eat from nearby barrels

Once again another feature which Starbound ought to just have already, I created health bars using custom status effects. I also added a bar for hunger. These bars show up when the stat is below some percentage.

NPCs look for nearby barrels containing edible items when they are hungry. And will move to them and consume the items until they are full. Hunger is an extremely important part of Diggle's gameplay, it forces constant upkeep of your clan and makes it difficult to move them long distances. This makes the game play center around "housekeeping", for better or worse.

Clansman breed with each other, producing babies which grow up into new clansman

I didn't want to spend the time creating "baby" sprites, so I just borrowed the nutmidgeling until I can find someone else interested in creating the sprites.

I plan on implementing a "familiarity" system whereby NPCs which spend time near each other for extended periods of time gain "familiarity", once this reaches a certain point, NPCs of opposite genders will breed with each other, and parts of their stats will be passed on to the baby.

You can download the mod source here.





To run Diggles: The Myth of Fenris on newer computers, run Diggles.exe with the -console flag, then start playing normally, open the console with tilde or scroll lock, and type

savegame [savename]
Now exit the game. Open up regedit, and modify keys in
Computer\HKEY_USERS\S-1-5-21-2830539138-2617553142-3844660609-1003\Software\SekOst\Diggles
Such as Performance\MaxFramerate and Performance\Particles. Now open the game again with -console, open the console, and type
loadgame [savename]
Now the game should be actually playable!.