I am making a turn-based hex strategy wargame.
I have the following code.
#Working in progress.
#Working in progress.
#Working in progress.
#These are normally integers but can be modified so float they are.
mutable struct Unit
health::Float64 #Only mutate this.
movement::Int #Status effect might alter this.
action::Int #Status effect might alter this.
mutable struct Tile
function calculate_damage(weapon::Weapon, unit::Unit)
#Calculation of feature working in progress.
return min(weapon.attack*unit.health_per_unit, weapon.attack*weapon.damage*weapon.accuracy/16)
I want people to be able to add their new factions with new units or new maps into the game.
The problem is… what kind of effects should I support? For example, at range 1, double attack, and so on. Each implementation choice has its trade-off, for example, should damage calculation involve just a bunch of attributes, terrain modifiers, and effects with certain triggers multiplied, or should it involve functions that can call arbitrary code? What information should be available when calculating damage? For example, would you like a damage modifier based on nearby units? Or should the damage calculation be strictly based on the attacking unit and the defending unit and their tiles? Mind you, flexibility can come with performance and program complexity trade-offs as well as potential issues for those wanting to make game AI and so on. If you want a tile to grant units the ability to teleport, but the game doesn’t support it, well, this could become an issue.
So, I’m engaging with you, potential modders of the games. What do you want?
Okay… tagging @Siddharth_Bhatia @TheCedarPrince @indymnv @Kyjor
For they might be interested in this game.
Thank you for sharing this @Tarny_GG_Channie. Looking forward to seeing the development of the game! Do you have a public code repository for the game?
I do not have any suggestions on the kinds of special effects at this point. Are you just starting out or do you have something implemented already? If you are just starting out, I would recommend constraining the design so that it is easier to implement, and then adding complexity over time.
I have never modded a game before, so I have a few basic questions. Is it done by directly modifying the source code of the game? Are you going to allow different mods to be composable? If so, how are you thinking about implementing such a system?
I have a repository but I forgot to push it onto the github. The mods are going to be little bits of data that define unit, map, etc… The core game mechanics aren’t the problem, it’s the unit special effects, which can literally be anything, but I want the game mods to also be composable, so I need to figure out a mod API. I also have to have an interfacing standard, for example, if a unit is immune to fire attacks, there could be an option for all the fire attacks to check if the target units have immunity, or I could implement it on the side of the defender, checking if the attack has a fire element attribute, or I could implement the element system into the game fully where each enemy would have different resistance to each element. Each option would not be too difficult to implement on its own, but I’m afraid of the shear amount of interacting mechanics between these special effects. The mods certainly won’t be modifying the source code fully. That would ruin mod composability.
Thank you very much for the explanation. Although, to be honest, I am still finding it difficult to fully wrap my head around it.
Looking forward to seeing the source code. Hopefully, I will get a better picture after taking a look at it. Also, it would be great if you could upload a screenshot at some point.
Thank you for the tag. I have to admit I don’t know anything related to game development, so I am not sure if I can be helpful, but If you have a basic project, It would be nice if you could share something like “How to build a game with Julia” in Forem or any other platform. Believe me, there is very little content about this topic in the community, and any article you post could add a lot of value to the community.
Hehe… I’m not even done with the game logic. The game GUI will take a while. I think I’ve settled with “unit A attempting action B on tile C” as a function that can do arbitrary logic. Other effects will be a flag.
Once I see some initial gameplay I think I’ll be able to give some suggestions. Good luck!
Here is the repository.
Anyway, I am changing the approach. The first product would be hard-coded. Then, if there needs to be more status effects and so on, I would manually fix it until I could find a way to generate code that encodes the mod features as if they were hard-coded. It’s in Julia’s philosophy that you don’t pay what you don’t use. Also, this should mean quicker initial development as I don’t have to care too much about mods early on.
Update… it looks like the new plan is to simplify the game even further.
Terrain features add lots of depths to the game, but hardcoding it in the core game is a precious drain on the core game. It can be modded in anyway. OUT!
A complex equation for damage calculation, same logic, OUT!
Unit abilities, OUT!
Unit status effect OUT!
So, now, the thing an unmodified version of this game can do would be slimes fighting on a flat plain.
I’m a bit disappointed, but hopefully, with more mods, the game can turn into something I envisioned.
In my greedy vision, I have factions that build cities. Diplomacy is absent for a reason, only one player wins anyway. You have strategic resources and build cities like in civ games. You design your units with attributes and abilities depending on the components you choose, for example, fire crystals might grant you an ability to make units with jet packs.
I am disappointed. I wanted a place where you write how unit damage calculations work and it works, where I write how cities work and they work, how neutral factions and bosses work and they work, how strategic resources work and they work. I thought it was not gonna be hard implementing a game that could be played manually with a board, a rulebook, and a large spreadsheet. I was wrong.
Maybe one day.