• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Dev Diary 8: Modding! By Ivan-Assen Ivanov from Haemimont Games

The new frontier... The perils of the unknown... The great difficulties and the great hope for the next generation? No, I'm not talking about colonizing Mars. I'm talking about the greatest technical risk we took on with Surviving Mars: building the game for modding support.
Haemimont Games has shipped a cool 15 games on various platforms, but not one of them has had official modding support. And modding was something Paradox wanted from the very beginning of the project. Games that welcome the players to join in the creation are loved more, played more, and live more, they said. What's the point of partnering with a well-respected experienced publisher if you don't heed what they say?


The bad news was that over the previous several games, the data loading process of our engine had been optimized in the opposite direction, to be as monolithic and economical as possible, to allow for minimal loading times. This had to be reversed, and many types of data can now be loaded in pieces, or late after the game has started, to allow for asset authoring and tested.


The good and much more important news was that our games are written in a mixture of two programming languages: C++ to handle the low-level stuff like graphics, audio and talking to the underlying hardware; Lua. Which allowed us to implement virtually everything you think of as "game", from the simulation logic of the colonists on Mars to the user interface that allows the player to control them. And Lua is not only much easier for modders to learn - it's also easy to be loaded from different places, even when the game is running. We knew that we needed to give modders this ultimate power, to modify and add new Lua code to the game.


The overarching goal of the mod support is, in the words of Alan Kay, simple things should be simple, and complex things should be possible. For the simple part, we identified a handful of small but impactful changes to the game that can be implemented by anyone who's not afraid of their computer. Mission Logos, for example, let you leave your imprint on every building of your colony. You only need to supply a simple, transparent PNG file


bvyJpsqe6OKwULaUJHYILm4T1Sydovmc259ega9-mUrxq-mwFi09KOkSycsZUZuHmIle89NJjRkp64eA0iqGBjm6cMwPaU4G0K1vclroZ00GP2fDXAZza_FFvtpNihf7_LqmyYvD



Mods are a popular way to allow user-provided translations of the game to new languages, and we're glad to see only days after release several community-sourced localization efforts.


Ve41VHS2tMpMlrSDrBiXQmp_H0xsAYy1g9FhlJvj1T3OmaQP8WH2RJ6SuGukr1LbyEFKrbr9tVfywvV3h6Ew9O7Z-0g3HppeR0Vvp236F190PRrOzxlv0vMdJTpbj8QKUZCN0fUf



Radio Stations let you bring your favorite music on Mars - and also your annoying DJ alter ego if you want. 


Ktdprbm3WMLeq0UlndzHkE7mf2Aguxl5aLlMwt2TD8nor3DiKVTnBobyGNKTY44PvQDGxzODiAzHwrHF40G39NA9YtDp3ZS1MK2b2W2qcQEXlsTd5GRz1UTw7J89KMyhPriZ-PRr



Once you've struggled through your first few colonies, you may want to guide other players into your playstyle. Your own Mission Sponsor or Commander profile is an excellent choice for that. You have at your disposal the same tools our designers had - and unlike them, you don't need to concern yourself with silly notions like "realism" or "balance".


683jQlss4TlCSwjPAH-CUr4LOAX97q8M-rXdVNkfa7wgzLEMUewHOBM8rMDY1Dwz46cE7fBr1fwM3NZrQ-VzyHSw_XY1T2X3qofjDPW1fqfb4Z1ucRBfh83_U19BffGtTrdwJvVZ



More complex mods can include 3D art assets to be used as buildings or decorations in the game. We chose the popular (and free!) Blender authoring tool and wrote our exporter for it - it is shipped with our modding tools. You can then add it to the game as a new variation of an existing building, inheriting the original building's logic but modifying some parameters. Or you can implement an entirely new logic, such as the Cemetery provided as one of our sample mods, which serves as an eternal resting place for your deceased colonists and provides comfort and continuity to the living.


14bujVmbjAPH0apLKhzHnEecNpWRNz-B3RzLVOi4N2KuhB86hGib7_mXGx4aXm8awvp-0Rac0G1_h6hlgcNBDvy_N2hG9mKn2s4iTLXZ5B81h5GPUNeXlhGKJOixFQ-nXAD2F47w



Finally, for the ultimate power with the ultimate potential for head-scratching, long hours of debugging, and potential for greatness, we allow you to plug any Lua code into the game, modify its systems or even replace some of them. For example, normally a Surviving Mars playthrough starts with your rocket landing on a pristine corner of Mars; what about if you could encounter the remains of previous colonies that tried and failed on that very spot? Our sample mod Time Capsule changes the rules of the game to allow just that.


w6j3rwABSZevHIcPr9rtHA88FEW0LBNlYjW8esIatknTeKpU_bs7kiaRvX3Er2Ik1Dtma_1DSXSAuLYW2xet_W3NpZmGvrb8rDvnh8-C-MzF5_yqa0RUGzU9SFHeljzLpW5dpxr1



We prepared extensive documentation to help you get started with modding the game, but as any programmer knows all too well, sometimes there's no replacement for taking a look under the hood. This is why we will ship a significant chunk of Lua - virtually all the game code - as a reference to adventurous Lua modders.


The modding tools in Surviving Mars are just a starting point in our effort to support the modding community. From now on we'll listen to feedback, improve things, write more documentation, provide more sample mods, and anxiously check your latest creations. Tell us what you want! Surprise us!
 
Cool, I usually don't play with mods because most games don't allow achievements with them, but it seems that Surviving Mars doesn't disable them, I'll give a look latter at what we have in the steam workshop.

BTW: Any plans to add the missing achievemens?
 
Excellent. Does that mean you will unpack the .hpk files for us? It's not very friendly to require modders to "crack open" the .hpk files. If you want to encourage modding you need to make the game data available to be studied, altered and used as a reference.
 
This game needs a Tropico mod, with El Presidente and Penultimo on a space mission to save mankind.

And music, music, music. I can't decide which radio channel I like less so I turn them all off. Get Azis or Toni Storaro to do a soundtrack for you.

In space, no one can hear you listening to chalga.
 
This is the first game ever (last 25 years playing games) that decided to make a mod for, even if the majority have/had mode support. (and I am software dev for more than 21 years now, so technically wasn't an issue stopping me).

But made the mode for no other reason other than I thought why not enhance the wind turbine adding to it work shifts without consuming mech parts while is not working. And I have ideas for more automation when back from my holidays. :)
 
its a great first stab at allowing your games to support modding. Well done and I hope to see more of your games support it in the future. What I would like to know though is when will an update to the mod engine and documentation be released? its currently lacking ALOT! but Im excited to see whats to come!
 
Last edited:
I think one of the best examples for modding tools is Skyrim. One of the important factors in modding is being able to see, and over-ride, the existing items in the game. For example, I want to make a new sponsor that gives you periodic funding, or lets you pay for more applicants. It's already implemented in code, as the USA and Blue Sun corp. sponsors. But I want to make one that gives both. Since I can't unpack the *.hpk files, I can't look at how it was done in the first place.
 
Thank you so much for taking the leap and making such a worthwhile investment! Can you believe that there are already over 500 mods available?

With each new aspect that you open up to us, that number will continue to grow exponentially! Can't wait to see what's to come, yet (and create a few of my own mods, to boot!)

Since I can't unpack the *.hpk files, I can't look at how it was done in the first place.

You should come join us on the Surviving Mars Modders Community discord server: https://discord.gg/zEtQwn (link good for 24 hrs from this post). You'd be surprised at just how much of the code is available. :)
 
Thank you so much for taking the leap and making such a worthwhile investment! Can you believe that there are already over 500 mods available?

With each new aspect that you open up to us, that number will continue to grow exponentially! Can't wait to see what's to come, yet (and create a few of my own mods, to boot!)



You should come join us on the Surviving Mars Modders Community discord server: https://discord.gg/zEtQwn (link good for 24 hrs from this post). You'd be surprised at just how much of the code is available. :)
Where do we find the available code on discord?? I only see chat rooms...
 
C++ to handle the low-level stuff like graphics

I guess I'm dating myself if I consider C++ to be one of the higher level languages huh? Sorry, but that phrase made these tired old eyes do a double-take! I don't dispute the accuracy of it... today :) Stop this poor old grandpa before he starts on that same old boring story about punching the opcodes into the punch cards by hand AGAIN...
 
I guess I'm dating myself if I consider C++ to be one of the higher level languages huh? Sorry, but that phrase made these tired old eyes do a double-take! I don't dispute the accuracy of it... today :) Stop this poor old grandpa before he starts on that same old boring story about punching the opcodes into the punch cards by hand AGAIN...

We can reminisce together. Why, I knew Johan when he was knee-high to a grasshopper and had to take breaks from patching the game because his mother made him do his chores. Now Paradox is "well respected and established". :)
 
I think I miss some flexibility with the modding editor. It allows you to do a bunch of very specific things, but only in the ways the devs thought of. What if I want to add a trait that has two effects? What if I want to add a nation, or edit name lists of existing nations?
Still, you have done an amazing job for your first time in the modding business :) I am looking forward to what will be opened up in the future!
 
Is there a good reason to only allow online mods? With other Paradox titles I would subscribe to the mods in the workshop (or before that search and download from the forums) and steam would download them for me and they are available even when steam is in offline mode. Now it doesn't seem like steam downloads them and they dissapear once I switch to offline mode. Does this work as intended, or is it just a bug at the moment?