One of the key benefits of my recent refactoring is that it is now much easier to support modding. I think modding is essential for a game like this.
What you are seeing here are the results of a simple “hello world” mod that I created as a proof of concept. In this mod, I’ve added a new type of garden to the game, one that grows a new type of plant, the “Toilet Plant”. After that, I took a save file and stripped it down to just a single garden, and changed that garden’s template to the new garden type that I added, then loaded up that save file using the in-game console.
Right now, the modding support is limited to the XML definition files that make up the game. That in itself is some extreme power, though. Someone could theoretically write their own dehoarding story using Dehoarder 2 as the engine, using the assets already provided.
I really want to support modding of assets as well. I think textures are pretty easy, but Unity makes it very difficult to import most types of assets arbitrarily at runtime, including 3D models. Some solutions exist, though it’s going to take some doing, and I don’t relish being the future owner of yet-another-obj-file-parser. Creating new prefab types just is not likely to happen.
Another planned feature for mod support will be in-game building and placing of objects. Already, I have the ability to switch to “build mode”, which disables game logic and will allow tweaking of game parameters.
Taking time to clean house and refactor stuff has really paid off. Not only can I do cool things like mod support, but also I will be able to move much faster implementing remaining features and building out the game world. The design sins of my frenzied expo preparation have now been paid for.
My next goal is to get the game ready for the Steam Greenlight process. Modding was part of that; I wanted it available in some capacity on day zero. I need to flesh out the daily cycle a bit more, by adding a few more tasks and providing some type of bedtime/transition to the next day. Some rooms are still devoid of any furnishings or junk. There are some other things I was thinking of that needed to be done, but it is late and I am tired.
I’ll leave you with the code for my sample mod, so you can get an idea of how the system will work, and to show how simple it can be to completely replace content in Dehoarder 2 through modding.
Gardens.xml
<GameData> <gardenTemplates> <GardenTemplate id="ToiletGarden" controllerId="Prefabs/Controllers/MasterGarden" spawnRange="(10, 0, 10)" updateInterval="10" minSpawnCooldown="240" maxSpawnCooldown="480" density="1" > <appearance> <AvatarAppearance avatarId="Prefabs/Avatars/Gardens/FlowerGardenSmall" /> </appearance> <spawnedPlants> <SpawnedPlant plantTemplateId="ToiletPlant" weight="1" /> </spawnedPlants> </GardenTemplate> </gardenTemplates> </GameData>
Plants.xml
<GameData> <plantTemplates> <PlantTemplate id="ToiletPlant" controllerId="Prefabs/Controllers/MasterPlant" minScale="0.2" maxScale="2" maxSize="10000" maxHealth="10000" naturalGrowthRate="2" wateredGrowthBonus="1" fertilizedGrowthBonus="1" naturalDamageRate="0" unwateredDamageRate="2" weedKillerDamageRate="2" fertilizerRecoveryRate="4" > <appearance> <AvatarAppearance avatarId="Prefabs/Avatars/Furnishings/American Substandard Toilet" /> </appearance> </PlantTemplate> </plantTemplates> </GameData>
Toilets.xml
<DehoarderGame currentTime="180" eventToRun="" > <rooms> <Room name="OutdoorsSouth"> <gardens> <Garden templateId="ToiletGarden" position="(-8, 6.8, -13)" rotationEuler="(344, 0, 0)" /> </gardens> </Room> </rooms> </DehoarderGame>