Is it Possible? Resolve Stack vs Stack combat on a Tactical Battle Map

peppe1

Warlord
Joined
Nov 16, 2008
Messages
222
I have been a Civ 4 mod user for years. I have modded other games and have an idea I think is worth exploring, but i have never looked at what Civ 4 has exposed to modders.

After watching some Civ V playthroughs the combat is pretty interesting and seems to be a bright spot, but the micro required on the world map bogs the game down.

Wondering if enough is exposed to modding to allow a mod to take over combat completely in Civ IV.

If on the world map your stack attacks another stack:
Instead of resolving on the world map could you take both sides into like a temporary battle map? Separate each stack into one unit per tile and Drop them in columns on each side of a battle map of like 30 x 30 tiles? Each side then moves and attacks with their units Civ 5 style until the battle is resolved?

The example I have in my head of this is Master of Orion 2's combat system. You have fleets going around the galaxy map, and when they attack each side is loaded onto a tile based battle map for turn based combat. Each unit has an initiative value and goes in their order (ties alternate between players).
 
The logic is doable with editing the C++ sources and compiling your own DLL, but I'm not sure about the UI.

What you describe is essentially creating and displaying a new map when stack combat begins, which is a regular Civ4 map, only without cities, resources and with a 1 unit per tile limit.
After combat ends - returning to the original map.

Civ4 allows you to mod most of the game logic (by modifying the C++ sources), the UI of the game (by editing the Python files) and almost every item in the game (both graphics and data) and even introduce new item types. But it doesn't expose the actual 3D graphics functionality, and it sounds like this is what you're asking for.

But maybe I'm wrong and someone more experienced than I am can suggest a solution.

If you can settle for a simpler representation of this combat (2D?) then it might be doable.

Either way, it'll take a LOT of work.
 
I would play it :) I always thought about that myself. It was implemented into ALOT of games from as early as North&South and Heroes of Might and Magic (HOMAM???).

The feature should also have an AutoResolve function and Civ should be implemented with a UPT of around 10-20, otherwise it would get a huge mess with SoD of 50+ units.

Then comes the hard part : AI
 
Unfortunately, I think in this case, the AI would be one of the most doable aspects. What could be very difficult, if not impossible, would be creating a "second map" for the tactical aspects to be played on.

Although... I suppose you could store all Civ4 map information somewhere, erase it, do the tactical setup in it, and then play the tactical battle. After the battle is finished, take the Civ4 map information from the temporary storage and reapply it.

Even then, I suppose it would take a lot of work :p
 
Although... I suppose you could store all Civ4 map information somewhere, erase it, do the tactical setup in it, and then play the tactical battle. After the battle is finished, take the Civ4 map information from the temporary storage and reapply it.

I was thinking of something similar today...

Of course it's not only the map (and everything on it):

It's also the game turns which should be counted differently (it's still turn-based, only within the same game turn), the civs which are not part of the battle (and even those which are - they have no cities, for example), random events should be stopped, all accumulated things (healing units? treasury? research?) should not be counted, victory conditions are not tested, etc. etc. :crazyeye:

But still, might be doable.
 
I was thinking of something similar today...

Of course it's not only the map (and everything on it):

It's also the game turns which should be counted differently (it's still turn-based, only within the same game turn), the civs which are not part of the battle (and even those which are - they have no cities, for example), random events should be stopped, all accumulated things (healing units? treasury? research?) should not be counted, victory conditions are not tested, etc. etc. :crazyeye:

But still, might be doable.

I think not performing those actions would be easy; it should just be a matter of adding a "!GC.getGameINLINE().isTactical()" condition for the normal things to be done when a turn ends.

About the turn number... that could be stored somewhere temporarily, reset, and after the battle ends, reapplied.
 
I think not performing those actions would be easy; it should just be a matter of adding a "!GC.getGameINLINE().isTactical()" condition for the normal things to be done when a turn ends.

About the turn number... that could be stored somewhere temporarily, reset, and after the battle ends, reapplied.

True, true.

And as for the map - you don't have to actually store the information and erase it. Hold 2 map objects in CvGlobals, and switch between the two.
 
Glad to see some interest in this.

Sounds like this will be difficult but feasible within the engine and functions exposed by the modifiable files.

I started taking a quick look at the CvGameCoreDLL files and playing the game with a more critical eye what the game engine was doing. Wondering if there might be some functions in the city view screen that could lead to a tactical battle view.

I was thinking ideally the map would be generated on the fly or a set of custom maps used to reflect various attack vs defense scenarios. So the defender can be given an advantage on the map if the attacker is coming across a river or attacking into a forest etc...

I have a few hundred hours into another mod that I am working to make a final release on and be done with the mod and the game for a while. I don't know how long it will be before i can take a serious look at this and learn where and how to mod civ IV. Looks like it uses real programming languages, which will make it easier to pickup.
 
Glad to see some interest in this.

Well, it's an interesting idea.

We can switch between them?! :D
That would greatly facilitate it...

Oh, I just realized that in addition to the map which is held by CvGlobals, the game object itself is held by it, and can probably be switched during the game...

I'm thinking Parallel Worlds Mod !

And I think I might actually try playing with this idea sometime soon :D
 
Well, it's an interesting idea.



Oh, I just realized that in addition to the map which is held by CvGlobals, the game object itself is held by it, and can probably be switched during the game...

I'm thinking Parallel Worlds Mod !

And I think I might actually try playing with this idea sometime soon :D

And we can, for instance, for space mods, have separate space and planet maps! Oh god! :D

If we can switch. Are you sure we can do that?
 
If we can switch. Are you sure we can do that?

Not sure at all. We need to try.
I have a few things to finish, but I might have time to do some testing sometime next week.
 
I do like where this is going... :D
 
Wow... this was only just now brought up? I would've figured we'd have been all over this a looooong time ago! This has been something I really liked about some of those older games mentioned and would LOVE to see this here... but it would need to be done right.

It would require that we create a library of tactical maps that represent the terrain basis on which the battle is taking place. Being able to switch to another map is a trick, of course, one which I shall allow the programming minded to tackle, but we must also consider some of the functionality of this concept.

This is especially true where we have battles taking place IN a city! Shouldn't we then consider assigning each building to a space? Allowing the buildings themselves some statistical data such as simple 'hit points' that can be attacked and destroyed along the way by viscious intruders, or to be accidentally destroyed by careless attacks?

Each terrain combination should have a generic map file. When setting up the battle, the placement of the incoming and defensive troops should not be considered random, but should be placed in a 'first phase'. The defender should be given the center zone, while the attacker should be given the zone from the direction in which the attack was launched. Obviously, a unit exiting the map should be placed on the side which it exited, allowing the tactical use of this battle system to also represent the ability of some fast units to 'sneak' past the fortified defenses.

Really, this thought is spinning off into a whole rework of the strategic design of this game and I think it could go in a really wonderful direction! Units would have to be reworked, but largely, many of the promos would really not need much changing. Largely, distance attacking would be one of the biggest necessary adjustments.

Fortifications would need some thorough thinking through. As a city is building, as a space is worked, those modifications would need to be added not only to the 'Overland' main game map, but also to the 'Tactical' map, somehow logged into the game's data base under new directories, requiring a lot of memory, true, for a saved game, but from the program's perspective, it shouldn't need to have it all loaded at once, only what's necessary to the immediate need, so perhaps its yet managable. It might be nice to have the player switch to the strategic map whenever a city builds a building so as to place that building on the map, which may allow for more intense city design elements as in such a scenario, many buildings may be rebuilt multiple times for maximum effect, particularly defensive ones. Each population may also be reflected in a square of 'housing zones' on the strategic map, which could be randomly placed I suppose. Roads and nearby rivers could be made a generic overlay based on city size and terrain type, around which the buildings could be placed-something the game will need to remember when regenerating the tactical map before battle.

Anyhow, those are some thoughts on the subject... any reflections on these thoughts?
 
Spoiler :
Wow... this was only just now brought up? I would've figured we'd have been all over this a looooong time ago! This has been something I really liked about some of those older games mentioned and would LOVE to see this here... but it would need to be done right.

It would require that we create a library of tactical maps that represent the terrain basis on which the battle is taking place. Being able to switch to another map is a trick, of course, one which I shall allow the programming minded to tackle, but we must also consider some of the functionality of this concept.

This is especially true where we have battles taking place IN a city! Shouldn't we then consider assigning each building to a space? Allowing the buildings themselves some statistical data such as simple 'hit points' that can be attacked and destroyed along the way by viscious intruders, or to be accidentally destroyed by careless attacks?

Each terrain combination should have a generic map file. When setting up the battle, the placement of the incoming and defensive troops should not be considered random, but should be placed in a 'first phase'. The defender should be given the center zone, while the attacker should be given the zone from the direction in which the attack was launched. Obviously, a unit exiting the map should be placed on the side which it exited, allowing the tactical use of this battle system to also represent the ability of some fast units to 'sneak' past the fortified defenses.

Really, this thought is spinning off into a whole rework of the strategic design of this game and I think it could go in a really wonderful direction! Units would have to be reworked, but largely, many of the promos would really not need much changing. Largely, distance attacking would be one of the biggest necessary adjustments.

Fortifications would need some thorough thinking through. As a city is building, as a space is worked, those modifications would need to be added not only to the 'Overland' main game map, but also to the 'Tactical' map, somehow logged into the game's data base under new directories, requiring a lot of memory, true, for a saved game, but from the program's perspective, it shouldn't need to have it all loaded at once, only what's necessary to the immediate need, so perhaps its yet managable. It might be nice to have the player switch to the strategic map whenever a city builds a building so as to place that building on the map, which may allow for more intense city design elements as in such a scenario, many buildings may be rebuilt multiple times for maximum effect, particularly defensive ones. Each population may also be reflected in a square of 'housing zones' on the strategic map, which could be randomly placed I suppose. Roads and nearby rivers could be made a generic overlay based on city size and terrain type, around which the buildings could be placed-something the game will need to remember when regenerating the tactical map before battle.

Anyhow, those are some thoughts on the subject... any reflections on these thoughts?
Wow! :cool:
I wished I said that... :mischief:
 
This is not a new idea. ;)

The primary problem with map switching is the cost in speed.

Lutefisk Mafia's Dungeon Adventure scenario for FFH 2 used the principle of multiple maps- he used Python and hardcoded the map information in a script. Each map was 20 by 20. The map switching was instantaneous, but changes in one map weren't reflected the next time you visited it. (Since the data was hardcoded in Python).

Last year I modified the DA scenario with a hack of Worldbuilder. Each map was stored as a WBS, and when transitioning the current map was saved and a new one was loaded. For 20x20, it was pretty fast. Except I wasn't rebuilding the terrain graphics. My hack to do this made it take longer- a couple of seconds.

It worked, though (well, I ran into a Python exception when rebuilding the interface on one of the maps, that I could never figure out, but otherwise it worked).

In C++ it would be faster of course- probably instantaneous for small maps. But with larger maps, you'll probably run into problems.

In fact, I think Kael and the FFH team were originally planning a feature like this, but decided not to implement it cause of the speed cost.

It'd be great if this would work, though- good luck working on it!
 
Last year I modified the DA scenario with a hack of Worldbuilder. Each map was stored as a WBS, and when transitioning the current map was saved and a new one was loaded. For 20x20, it was pretty fast. Except I wasn't rebuilding the terrain graphics. My hack to do this made it take longer- a couple of seconds.

TC01, do you still have that code? It would be an excellent base.
 
This is not a new idea. ;)
The primary problem with map switching is the cost in speed.

In C++ it would be faster of course- probably instantaneous for small maps. But with larger maps, you'll probably run into problems.

The point is that the maps (especially large ones) are still pre-made, and you only switch the pointer to the map (and the game), so I don't see any speed problem here.
Might be if you load them from disk, but we can keep them in memory.

Lutefisk Mafia's Dungeon Adventure scenario for FFH 2 used the principle of multiple maps- he used Python and hardcoded the map information in a script. Each map was 20 by 20. The map switching was instantaneous, but changes in one map weren't reflected the next time you visited it. (Since the data was hardcoded in Python).

Last year I modified the DA scenario with a hack of Worldbuilder. Each map was stored as a WBS, and when transitioning the current map was saved and a new one was loaded. For 20x20, it was pretty fast. Except I wasn't rebuilding the terrain graphics. My hack to do this made it take longer- a couple of seconds.

It worked, though (well, I ran into a Python exception when rebuilding the interface on one of the maps, that I could never figure out, but otherwise it worked).

Did any of these solutions also include switching the game object?
I'll explain - when you're in a tactical map, or a parallel world map, or whatever other map - the turns do not necessarily pass the same way (all turns in combat mode will be part of a single turn in the global mode), and the civilizations are not the same (in a tactical map there only 2 of the civs, in a parallel world there are other civs altogether) etc.

The game object can theoretically be replaced the same way a the map (switch a pointer).

Since I didn't have any time last week to work on this, I still don't know if it'll work, but my fingers are still crossed.

It'd be great if this would work, though- good luck working on it!

Thanks :)
 
So, in theory, similar mod components could be used to create a mod where we have moon/mars/other planets being colonized and developed in the late stage of the game as extra maps where things are taking place? I like where this is going.
 
Back
Top Bottom