What about in-game unit customisation?

Crossbowman

Warlord
Joined
Sep 24, 2005
Messages
141
Location
Quebec, Canada
In civ 4, the units are already made. When I find new techs, I can make new ones. But it would be really good to have a modular unit creation. This would be usefull for modern or futuristic mods. What do you think of that?
 
I knew it would be unclear. :mischief: What i want to say is when I want to make a tank, there is only one tank model. What I propose is that the game allows to choose the gun power, the engine speed, the armor, etc. That can apply to any type of unit (for example, instead of having premade foot soldiers, we could choose a weapon, an armor...). This would be really hard but very interesting.
 
I think hes looking for something a little more akin to Alpha centauri style unit creation. Even though my knowledge of the XML is limited in Civ4. I'm guessing, at least for the time being, this is a big impossibility. I'm pretty sure you would have to re wire the hard code I believe.
 
Maybe it's like "alpha century" (I didn't play it). The games that I know that have this are "space empire 4" and "Earth 2160".
For the code i think it will be possible with the SDK, but what I don't know is the difficulty. I hope someone will do this...
 
Whew, that does sound like something that will be impossible. I am no programmer, but it seems that would require some serious reworking of the core code to enable that. I think you're stuck with the way it is I'm afraid. Would be neat if I was wrong.
 
Fabius said:
Whew, that does sound like something that will be impossible. I am no programmer, but it seems that would require some serious reworking of the core code to enable that. I think you're stuck with the way it is I'm afraid. Would be neat if I was wrong.
I think you are wrong! I've been working on something similar for quite a while now, and there are several ways to get it to work just using .xml. While at the moment there are some flaws with these methods, I think these can be fixed with a bit of python coding.

Basically, you have to use the upgrade system.

When you build a unit, it comes with nothing, but right from the start it is possable to upgrade it. The first upgrade would be a selection of different types of engine, the second different types of armour, the third, different types of gun... etc. You have to do a bit of messing around to make the upgrade paths work (so you don't get 2 guns, for example), but it's easy to do.

Here is where the flaws come in. To make a unit with say, 4 different bits, and each bit having 4 different choises for it, you end up with A LOT of different, but very similar units in your .xml file (342 I believe), which gets a tiny bit messy. Lukily, there is a way around this!

Instead of having the stat changes listed individually for each different possable combonation (of which there are alot), you can use the promotion system! Basically, when you build (and I'm pretty sure when you upgrade to) a unit, there is an option of giving it certain selected free promotions (marines have amphibious, for example). You can use this system to cut the number of different unit entries down to just 17 - the basic one, and all the different individual changes.

Unfortunetely, this also comes with a flaw. When you wish to upgrade your customised unit using the second method, it will keep all the free promotions that it got when it was the last unit. At the moment I'm pondering on a way to fix this, but I think it might have to be done with some clever code in python. As far as I can see there is no way of removing promotions, once given. If anybody can figure out a way to do this, I'd be quite happy.

EDIT: The other thing I'm trying to figure out is how you can vary the graphics for different customisations. With method 1 (the 342 unit method), it wouldn't be too hard (though so amazingly boring to be worthless). With method 2, you'd have to somehow tie the graphics change to the promotion. I've had a few goes at this, but to no avail (so far).
 
TGA, that is simply genious. It gave me an even more revolutionary idea: promotions with tech prereqs! I don't know what it would take, but it would probably be possible with XML and Python. If it works, you don't have to mess with upgrades, and only need a few different units in the game! Once you discover iron working, you just give yout axeman the Iron Weapons promotion, and you have a swordsman. It might take SDK work to make promotions require gold instead of XP.
 
Yes!
It cannot be a coincidence that both this thread and the Civ4 BattleTech Mod thread both appeared on the same night. We desperately need such a system.
Keep us posted.
 
These are good ideas, but there would be one main problem: these would not increase the build time. Except for that (and that we would need to recreate the unit each time we build one), it is a good alternative to heavy scripts.
 
I like this idea but this would greatly complicate things from the graphic perspective. I feel that this would limit the mod ability of the game by the average person. At least at first. The complications of bit melding multiple images together on the screen to produce various images is a nice idea but then we would have people posting parts and not units. It would be upto you to make them function properly in relation to each other as well what they can work with. Nice idea but I don't see Civ ever going there in a mod able version. That's not to say the units couldn't be set and we could still play with scenario's and maps.

Tbear2520
 
A possible workaround for the graphics issue, would be if we could have the unit's entire apperance change once they are updated. Using the axeman to swordsman example earlier...when you upgrade to swordsman, they don't just visually get a new weapon, they'd get new uniforms as well. So that's rather easy to accomplish in the grand scheme of things. I agree that the AI would be the tricky part.
 
I've been trying to work out ways of allowing customisation as well.

Until the sdk comes out and I see what that allows, the idea I'm working on is that when you have researched a tech then it allows you to research new designs for units (design research is handled seperately to normal research). And then later when you research even more techs it again allows new designs for old units. I also plan for it to allow all your old units to be refitted to the new design.

In some ways it is similar to The Great Apple's method one, except I wasn't really thinking of there being say the 4 parts with 4 options. I was thinking of less options with each new design being a general improvement other the last ones, or one say in a ship, one design allowing for more cargo to be carried while another has more movement or combat power.

In general my idea is really to change the research so that the standard research is used for more general science research while development and design and further refinement of techs is done seperately. One reason I have seperated them is because I don't like only being able to research one thing at a time, and if the new designs where only able to be researched through the standard method then it would be easy for another civilization to jump ahead by not bothering with designs but going straight to more advanced tech.

I don't think the AI is much of a problem as there are a number of ways to handle it in python.

I have posted a simple proof of concept of my idea here: http://forums.civfanatics.com/showthread.php?t=140408
 
Weasel Op said:
It gave me an even more revolutionary idea: promotions with tech prereqs! I don't know what it would take, but it would probably be possible with XML and Python.
If you take a peek at the promotions XML file, you'll see that it's already possable. For example, the ambush promotion requires the tech steel.
Weasel Op said:
If it works, you don't have to mess with upgrades, and only need a few different units in the game! Once you discover iron working, you just give yout axeman the Iron Weapons promotion, and you have a swordsman. It might take SDK work to make promotions require gold instead of XP.
Hmmm, I'm a bit baffled by this idea. Isn't this how the upgrade system works at the moment? You would just be able to upgrade anywhere, instead of just in your own terriatory? It seems to me that this method has all the flaws of the way I'm suggesting, with none of the good bits - though I may just be missing the point of it.

EDIT: About the AI. I think it would have to be tested. The AI could be very versitile to ideas like this, and upgrade it's units properly... or it could not be. As I said - needs testing.
 
When Firaxis was asked about the possibility of a Civ4-based sequel to Alpha Centauri, they did explain that you could reproduce the Unit Workshop through the promotion system. So, the C4:AC people over at Apolyton have already thought through a lot of this.

As Crossbowman said, one issue would be unit production time. But that's actually not too bad. Try this (I'll use the SMAC setup as the example):

Promotions would come in two main series: Attack and Defense, plus a bunch of non-chain promotions corresponding to SMAC's special abilties.
Every unit starts as a strength 1 unit with movement based on its unit type, and a number of extra promotions. The cost of the unit depends on its unit type, reactor type, and the number of "equipment" promotions it starts with. For instance, an infantry unit might cost 2*(5-reactor)*(1+promotions), while a Rover might cost 2*(6-reactor)*(2+promotions). The better the reactor, the cheaper the units; the more promotions, the more expensive.

Taking the Alpha Centauri names, this means the attack promotions (Laser, Impact, Gatling Laser, Missile, Chaos) would multiply your unit's attack. So, Laser is +100% on offense, Impact is +200%, Gatling is +100%, Missile is +100%, Chaos is +200%. These are all cumulative, so Chaos ends up being x8 on attack, just like in SMAC, assuming you use five promotions for offense. Each promotion unlocks at its specific tech.
Likewise, the defense (Synthmetal, Plasma, Silksteel, Photon, etc.) each add +100% to defense. So, Silksteel is x4 defense, assuming you use three promotions for defense.
Specials are separate promotions.

So let's say you want to build an 8/1 Fusion Chaos Rover with the Amphibious (+1) ability. Assuming you had the techs for each of these pieces, you'd build a "6-bonus Fusion Rover" in your city. It would enter the game with enough XP for six promotions. You'd use five of those to raise the weapon to Chaos, and one to give it Amphibious. With the cost I gave earlier, a Fusion (reactor 2) 6-promotion Rover would cost 2x4x8=64. Now, you could use those promotions to mix offense and defense (8/1 costs the same as 6/2, 5/3, 4/4, 2/5, or 1/6), although you're still limted by tech levels.

The only real headaches:
> Specials that cost more than 1, which would require sequences of promotions. For instance, to make a unit Clean (+2 cost), you'd have to first select "Clean I" and then "Clean II", with the latter having all the benefits. The AI probably wouldn't handle this well, so maybe the solution is to give Clean I some sort of bonus.
> Specials that cost 0 under certain circumstances. For instance, Deep Radar for air units was free.
> You wouldn't be able to have units gain XP through combat any more, because you'd be overriding the XP logic to handle tech upgrades. I suppose you could keep the XP system if you made it flat (say, 5 XP per promotion) and retained some of the standard Civ4 promotions; to "upgrade" a unit all you'd need to do is have a script give the unit 5 XP. The problem is, you'd need to make sure that promotion was used for equipment upgrades, not other stuff.

Anyway, the point is, it's doable. You'd make a generic unit, and on the first turn you'd spend a handful of promotions to give it better weapons and armor. Unfortunately, I don't see how you could give it unique graphics this way.
 
Never played SMAC, so bear with me a bit here.

It seems to me that there are lots of different methods, each seeming to be better for specific purposes. The method decribed by you seems to be ideal for what you want to be doing with it, except of course the killing of the promotions system. You may be able to do some hardcore programming and make it so you can have two different types of promotions, which would make your job alot easier.

However, it seems to me that this idea falls short when you want a choice between two very similar promotions. For example, if I wanted to equip my guy with either a spear OR a sword, with no possablilty of both, then this method doesn't work - your guy could end up with both a spear and a sword.

If there was a way to disable other promotions, once a specific promotion had been chosen, then that would be nice... but there isn't (yet).
 
It's not an ideal solution, but you should be able to remove the spear upgrade if you get the sword upgrade using CyUnit.setHasPromotion(spearpromotionindex#, False)
 
Back
Top Bottom