“By helping our future modders we also helped ourselves”: Developing TROY with Modding in Mind

Saga

Ella McConnell
October 30 2020

Those of you who have been chomping at the bit when it comes to modding will be pleased to know that A Total War Saga: TROY is one of our most easily moddable games yet – but why, and what made the team decide to develop the game with modding so firmly in mind?

We chatted with Creative Assembly Sofia team members Anton Cholakov, Mihail Balabanov, and Radoslav Borisov about their personal views on modding, the ways in which TROY has been made more accessible to modders, and top tips for modders old and new – check out what they had to say below!

Click to enlarge

CA: Hi there! First of all, could you please introduce yourselves?

Anton Cholakov: Hello to everyone! My name is Anton Cholakov and I am a gameplay and AI programmer on Total War from the Creative Assembly Sofia studio.

Mihail Balabanov: Hi, my name is Mihail Balabanov, and I am a principal gameplay programmer at Creative Assembly Sofia.

Radoslav Borisov: Hello, my name is Radoslav Borisov, and I work as a game designer on Total War in the Sofia studio.

 

CA: Tell us about some of your personal experiences with modding other games.

Anton Cholakov: I haven’t modded games myself but I have tweaked the configuration files of a game or two, which might count as “modding”, I guess.

Mihail Balabanov: I am not a modder myself. I have tinkered with the editors of a few strategy games, like StarCraft and Battle of Wesnoth, which later helped me on the developers’ side.

Radoslav Borisov: My personal experience with modding is mostly around doing script work in Blizzard games. I started out helping with custom maps in Warcraft III, and moved on to writing addons for World of Warcraft after that.

 

CA: What are your thoughts on modding games generally? Do you think it’s an integral part of the player experience in the case of some games?

Anton Cholakov: I am very much in favour of modding games – it provides variety and allows the player to tailor the experience to their own tastes. I really enjoyed mutators in the Unreal Tournament series and the Second Wave options in XCOM: Enemy Within. These are mods that come prebuilt into the game, and I think more games should have these kinds of options. From there you get to fan-made mods. These could provide the player with just the right amount of changes to make the game more enjoyable to them – for example, making it easier, harder, or simply a bit different. Mods can even totally change the game. I’ve played a lot of Counter-Strike and DotA which, in the beginning, were just mods for Half-Life and Warcraft III respectively. Those two are a great example of mods that prolonged the life of a game – everyone wanted to have the base games so they could play the famous mods for them.

Mihail Balabanov: Definitely! Mods can enhance and lend variety to your playthroughs or multiplayer matches and make you experience a familiar game in an entirely new way. In some cases, modding communities have prolonged the life of a game or widened its audience far beyond the expectations of its creators. Some new games and even genres started out as mods.

Radoslav Borisov: I am very much in favour of games supporting mods. While I understand that certain games are not suited for modding, user-created content should be encouraged. Several great games we have today started as mods: DayZ, DotA, Counter-Strike, etc.

Click to enlarge

CA: Modding has been an important aspect of previous Total War games for some time now – what have you learned from the presence of modding in previous titles?

Anton Cholakov: Mods are very important for the Total War games as a lot of our players use them. Total War mods have been created for everything from tweaking the game difficulty and the AI to creating entirely new campaigns, factions, and units – and even total conversions that turn our historical or Warhammer titles into games set in the worlds of Lord of the Rings or A Song of Ice and Fire (the source of the Game of Thrones TV series). This is a lot of new content for our games that we, the developers, have not created but is readily available to our players. And I think that the modders themselves enjoy creating these, including the pride of showing off their creations and other mod users expressing appreciation for their ideas and work.

Mihail Balabanov: We learned that some people enjoy creating mods and many others like playing with them! Jokes aside, we already knew that creating and using mods is a big part of the Total War experience – and we needed to support that. We saw that in some cases just a little effort on the developers’ part, like making certain gameplay or UI functionality accessible via Lua scripts, can resolve a long-standing problem for the modding community, so we tried to identify and resolve such issues.

Radoslav Borisov: The biggest takeaway for us has been how much the modding community has grown and improved over the years. Mods for Total War have been around for a long time, which has allowed the community to grow and improve – there are so many talented individuals and groups producing extremely high-quality Total War content.

 

CA: You’ve stated previously that you want to make sure TROY has as many mod-friendly features as possible – how did you go about doing this during the development process?

Anton Cholakov: From the very first moment we started the implementation of the game, we tried to make it in a way that’s easier for people outside the studio to change it. Because players are unable to change the compiled source code, as many things as possible need to be loaded from external sources. Of course, this is quite common in the industry for game assets and sound files. Sometimes the same applies to varying degrees for the games’ configuration through things such as .ini files – which specify values, such as a unit’s health and damage – or, as is the case with Total War games, the database.

What we tried to do for TROY is to make the game much more data driven. Many values that were previously set in stone in the source code are now loaded from the database. One example is the way the agent actions cost is calculated. The same applies to features that are completely new to the Total War series, such as the multiple resources that form the economy in TROY. All of those are specified in the database (and we created five of them), but a mod could just as easily remove all but one and effectively turn our multiple resources economy into the good old “coins to rule them all” style or, on the contrary, change and add even more types of resources and create a game with a ton of resources that the player must navigate.

The other key aspect of our mod-friendly approach is that we use Lua scripts for a lot of things in the game, such as the divine favour gains and losses, the motivational trait triggers, and the Odysseus ruse and earthquake interpretations of the Trojan horse. Even 11 of our 15 unique faction mechanics are mostly implemented through script. What makes Lua code different from the C++ code that the rest of the game is written in is that the Lua scripts are held as plain text files. That means that a modder can open them with any text editor, change them, and then see those changes in the game – no disassembling and reassembling of the code needed. Those changes could range from tweaks to the game configuration (as, again, many variables are specified in those Lua files), big or small changes to the existing mechanics in the game, or completely new mechanics written from scratch.

Writing from scratch is somewhat difficult, but modders can figure things out by looking at the code written by us, the developers, for clues as to how to do many things in the game. For example: do you want to check that the player won a battle against a certain faction? Simply look at one of the many battle participant checks that we’ve used. Do you want to monitor when a player reaches a certain threshold of a given resource? We’ve written that too, in many different forms. We have more than 30,000 lines of Lua code specific to the TROY campaign – and add to that battle scripts, the whole interface those scripts use, and our own generic Lua library. You can also look at our code for inspiration for structuring your own Lua code. Again, as with the data-driven approach to the C++ code and database, the scripts are often written with easy extensibility in mind. By following that example, you can even make your own mods easily moddable by other modders!

Mihail Balabanov: When we decided on the implementation approach for each new feature, we tried to make it as configurable as possible using scripts and the database. It is impossible to remember and mention everything, but here are some highlights!

We implemented many of the new mechanics in Lua to make them more easily accessible for changes. This led to the addition of new scriptable functions and trigger events which now can now also be used in mods. The resources for the new multi-resource economy can be configured in the database to create campaigns with different sets of custom resources or even to use custom resources for entirely new mechanics (we use them for the mechanics of Sarpedon and the Amazons, for example). We also added new campaign events, payloads, and event options, which enhance what can be done via the scripts and the database.

Radoslav Borisov: The first and most important step was to aim at being as mod-friendly as possible. We made sure the various teams working on the game were all on the same page and working towards said goal. This decision was made early during the game’s production and has been something we’ve consciously tried to stick to.

Click to enlarge

CA: What do you think are some of the biggest challenges you faced when developing modding for TROY?

Anton Cholakov: The main challenge was getting all the team members to understand and adopt the “data-driven and easy to extend” mindset – what does that mean and how do we achieve it? Not everyone understood from the get-go how they should be doing things and why, but I think we managed to achieve this to a great extent in the end.

The second biggest challenge was to truly stay away from the “quick and dirty” solutions for the various problems our team encountered throughout the development of TROY. Take the agent actions cost calculation example mentioned previously: we had to adapt the cost to our new multiple resource economy. As the calculations were previously hardcoded, the simplest approach would have been to just take the base cost in coins and change it to multiple resources. What we did instead was expose the three different components in the database that make up the said cost – while also allowing for the actions of the different agent types to have individually set costs. As you can see from this example, the way we did it cost us extra time and effort, but the end result was a more agile system that is easier to configure and change.

I truly believe that the effort the team put in was worth it – the evidence for this being that the first people to use these new systems were our own designers! As a result of the team’s work, it was easier for them to tweak the game and test their changes. It was also often easier for us to redesign and rework something because it was implemented in a more flexible way in the first place. All these efforts ostensibly for people outside our team soon paid for themselves, and before the game even left our studio. In a way, by helping our future modders we also helped ourselves.

Mihail Balabanov: For me, it was the balance between flexibility, performance, and development efforts when designing the implementation of each feature. If the implementation is too rigid, it is easier to write the code for it but it won’t be moddable and the design team won’t be able to iterate on it easily. If it is too data-driven, it may become awkward to use and require overly complex code or too much database work from the game designers, etc.

Radoslav Borisov: The first big hurdle we encountered was around making certain legacy systems more accessible to modders. An example of one such system was the events system (incidents, dilemmas, missions), which has been around for a very long time but was insufficiently exposed to modders. Our aim to expand the existing support for custom events resulted in the current event chain system that TROY uses for tutorial and epic missions. We are also constantly adding new features to the event chains system with post-release updates.

Another challenge we faced was making sure we understood the needs and wants of the community. With help from various colleagues with modding backgrounds and members of the community, we made a list of problems and potential improvements. Some of the notable improvements we’ve made are centred around the Assembly Kit: more documentation, more functionality for Terry, more varied examples for character and building creation, etc.

 

CA: What advice would you give existing modders who want to get into modding TROY for themselves?

Anton Cholakov: Generally: get the game and our modding tool, the Assembly Kit, and take a look at what you can do with it, how you can change it, and so on. Look at what’s in the database, look at the configuration of the Lua scripts (we have tried to always put those at the beginning of the files before the actual code implementation). You might get inspiration for a mod just by looking around and thinking about what you can change. Then try it out! Tweak a variable here and there, check how this is reflected in the game, go back and make another change, check it in the game and so on. This is called iteration, and is the same process that we use to develop our games.

The next step, at least according to me as a programmer, is to try and learn a bit about how to write Lua code. It’s really easy and fun, in fact (not to mention the whole world is going in a direction that seems to suggest at least some programming knowledge is becoming a must). As I said previously, writing from scratch can be a bit challenging in the beginning – but the first step is learning to understand the code you’re reading, even if you’re not yet ready to write it yourself. Just by copying and editing existing code you can achieve a great deal. In fact, if I’m to be honest, a lot of the code a professional programmer produces is in fact copied (and edited) from somewhere else – we do it all the time!

Finally, don’t forget that we are very open to helping modders, so don’t hesitate to get in contact with us if you have a question to ask or a problem to solve. I don’t promise that we’ll always be able to help (usually due to time constraints and not a lack of desire to help), but we’ll do our best!

Mihail Balabanov: There are no fundamental differences from modding any other Total War game. Get the Assembly Kit, check out the main database tables to see what has changed, look in the script folders for inspiration. Don’t forget the documentation!

Radoslav Borisov: For starters, I’d recommend downloading the Assembly Kit, which contains the various tools and utilities for the relevant game. It’s worth checking out the documentation inside too.

Other than that, reach out and get in touch with other people interested in modding. There are numerous modding communities, both large and small, that can provide you with guides and materials.

Click to enlarge

CA: And what about total modding beginners (i.e. those who have never modded anything before)?

Anton Cholakov: The best thing for a beginner to do is get into a modding team. Nowadays games are rarely created by a single person – our own creative team consists of designers, graphical and sound artists, programmers, and so on. We also have management people, whose duties could be taken up by one of the former roles in a smaller team, and the quality assurance team – commonly known as testers. For a mod the last group is usually the players who try out a mod, but a bigger modding team could even have their own dedicated QA. What I’m trying to convey here is that a modding team needs people with expertise in many different areas, and you don’t have to have all those skills yourself to be able to create an interesting mod. Get in contact with a modding team, find out how you can contribute, and soon you’ll start learning. Nexus Mods and its forums are great places to start.

Mihail Balabanov: The easiest way to start modding might be by getting into an existing mod team so you can initially work on smaller tasks and gradually build up knowledge. Learn the basics of writing Lua code (functions, key-value tables, variables, loops, branches) and working with databases (DB tables, fields, keys, field relationships, look-up columns) – you will most probably need both. Try to examine and alter existing mods or the original scripts and databases shipped with the game. Think of a goal: what would you like to change in the game? Ask more experienced modders for advice on how to approach your goal. Find parts of existing scripts that do something like what you’re trying to achieve and try to combine them. Learning by doing is fun, and the feeling when you create something that makes other people happy is wonderful, so don’t give up!

Radoslav Borisov: Find something you’re passionate about! Modding is a creative process that turns your ideas into reality.

 

CA: Thank you for your time! Any final words on modding in A Total War Saga: TROY?

Anton Cholakov: Modding an existing game is practically creating a new game based on the original – and creating video games is a really fun way to learn things. You need to learn to draw, animate, program, design cool game mechanics, and so on, but it also opens your eyes to how games work and what it takes to create them – something that is often missed when you have only the perspective of a player. You begin to understand why certain things are the way they are, and it makes you appreciate the effort that the people behind your favourite game put into it much more.

And by the way, the above statement applies not just to video games but all games – physically active games, roleplaying games, board games, and so on. Don’t limit yourself in your creativity!

Mihail Balabanov: We’re looking forward to your creations!

Radoslav Borisov: I’m looking forward to all the great content our community produces. I’d like to end on a reminder for modders both old and new: if you need help or would like to request a feature, do let us know!

While I can’t promise we’ll make all your wishes come true, it helps us understand the needs and wants of the community.

I’m also looking forward to Brad Pitt and Orlando Bloom character models.

Ready, steady, mod!

Ready to get stuck into modding A Total War Saga: TROY?

You can find our TROY mod installation guide here, and our TROY mod uploading guide here.

Additionally, if you have any questions about modding, be sure to head over to the Total War Modding Den Discord server!