Unify unit images between countries

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Unify unit images between countries

aaalafayette
Administrator
Some interesting problems have cropped up over time relating to how unit images are done. For context, today we have a "units" folder where we put a folder for each "country" and inside of that we have unit images. Two problems:
1. On some maps folks have not had accurate spelling, so for example there will be a "marine.png" and a "Marine.png". On windows this will work but it breaks on other operating systems.
2. Since each unit is required to be duplicated across countries, altering units is a huge PITA since the same change has to be multiplied by the number of countries
3. You may have to provide a copy of every unit for every country: https://github.com/triplea-game/triplea/issues/523. In that bug an AA unit is captured, but there is no AA unit image of the conquering country, so the game then crashes...

Okay, so as a solution, I'm suggesting we have just one set of unit images. Then in the XML we define a color hue for each country, and then when a country owns a unit, we use the one unit image and change the color on it depending on the owner. Production rules would then work as normal to make sure countries can only build their units.
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

crazy_german
I agree that the current system is rather dumb, I so many of copies of german infantry around all my maps folder. But that suggestion might not work. Many maps use different models for different images, like in revised each nation has different tank and infantry sculpts. Would we be able to keep this? It also requires just 1 hue for a country (no white factories) and no off-color details

To address number 3, I have suggested creating a question mark that can be used anytime an image isn't found to avoid crashing. This would be very convenient when trying to mod maps
Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

aaalafayette
Administrator
crazy_german wrote
Many maps use different models for different images, like in revised each nation has different tank and infantry sculpts. Would we be able to keep this?
Perhaps in the following manner, for example, let's say we want Russian and German tanks to be unique. We could have the following three units:
tank: 3/3/2
german_tank: 3/3/2
russian_tank 3/3/2

Then russia and germany would have special build rule to build german_tank and russian_tank. Then in the unit images, we have three for tanks: tank, german_tank, russian_tank.


crazy_german wrote
To address number 3, I have suggested creating a question mark that can be used anytime an image isn't found to avoid crashing. This would be very convenient when trying to mod maps
This is a good suggestion. We have a number of maps today that can not be played on Linux nor Mac because of case differences, for example: Americans/marine.png when the engine expected Americans/Marine.png (this works on windows, where files are not case sensitive, but does not on linux/mac)

Tracking this one with game engine ticket: https://github.com/triplea-game/triplea/issues/528
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

Cernel
In reply to this post by aaalafayette
I strongly believe this is a bad idea, since different players should be able to have fully different unit images without requiring different unit names.

And, in general, I don't like when units have different names for no actual reasons.

Also, changing only the units colours is a cheap and lame way of mapmaking, unless the map is abstract (like CotW); different units for different players should be different, one from the other, but similar enough to be easily recognizable as being the same.

Beside, this would oblige to redo many maps.

p.s.: If possible, best would be having the engine checking for case coherency also in Windows systems, and eventually giving an error in the console, so that the mapmakers can be sure about all cases being correct, without having to play the map on a case sensitive system.
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

crazy_german
In reply to this post by aaalafayette
TWW differentiates units as russianTank or germanTank, and it makes the XML document exponentially more difficult to create and edit, so I don't consider that a good solution. Just renaming files and editing XMLS to make all existing maps able to use their current art would be an enormous task

Here is an idea

First, the engine checks unitsfolder-->Germany, and uses a unit here if available (like it currently does)
Then, if no image found, the engine checks unitsfolder-->generic. This is where Lafayette's idea for a single base set of units is used. Generic would contain a group of white images, which the engine can edit the hue based on the value found in the map.properties file. We would ban using "generic" as a player name
If still no image, the engine checks tripleA's assets folder (it currently does this as well). Assets could also include a generic and nation specific folders
If still no image, the engine uses a question mark or blank square, just something to prevent a crash

Thoughts?
Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

aaalafayette
Administrator
In reply to this post by Cernel
It's a difficult check for coherency, and hard to enforce. The fact that the game is UNPLAYABLE on many maps because of this makes it a an important problem. I think Crazy German identified a decent way to implement this. Maps already have neutral units which can be color changed easily. That will then fix all maps, then we can look to adding back in exceptions for 'flair'. Plus, the duplication of unit images is another bad problem. It bloats maps sizes, and makes our lives really not fun. Update an infantry image? Have fun with updating it 12 times or more for some maps..

As is, I think Crazy G has the best idea of how to do this. Instead of Generic I think we would probably use the 'neutral' units if none other can be found.

@Cernel, I would be curious if you have another solution/proposal other than not liking the idea.
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

aaalafayette
Administrator
Let's be clear/focus on the problems:
- each unit image need to always be available for every country regardless of production capability.
- unit images are 95%+ of the time duplicated between countries and then their color slightly altered. Updating colors of countries becomes impossible, and we incur a large maintenance cost, as well as large barrier to entry. For example,  updating one unit image requires N updates
- case problems. Windows users can build a fully functional map with the wrong case for unit images, the game engine would have a *really* hard time figuring this out.. The no-image image is helpful since a map won't die, but it wont' alert a windows map maker that their map is broken
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

Cernel
In reply to this post by aaalafayette
Honestly, I'm sorry but I find difficult to articulate solutions cause I just don't see the problem and this issue feels so trivial to me (and the alleged solution so incredibly invasive) that I feel no need to find any solutions.

Relatively to the engine, my solution is to leave everything as it is now, as long as anything related to what mentioned in this topic is concerned.

Relatively to the maps, my solution is not caring at all about maps bugs, leaving all them broken (till the mapmakers or any new map owners correct them).

There will always be plenty of mapmakers that mess up their maps for silly reasons, filling them with bugs of various kind; this doesn't mean that anything must be changed or is bad.

Just leave the crap in the repository and forget about it; this is the main reason to have a third category for bugged maps.

If you want to go around correcting everyone's maps' bugs, that's commendable, but you don't have to. So, no problem having various subfolders to correct. For the single mapmaker is very little added work, relatively anyway.

Aside from this, I don't see any sensible problems in the duplication of unit images, amongst the various subfolders, either, for the single mapmaker handling his own maps. I would say irrelevant, all considered, both for map's weight and updating work.

With this said, if you really want bugged maps being playable, just do that thing of adding a "notFound" image.

Just be warned that this way, with the map not crashing or becoming unplayable, you will have even more maps hanging around for years and years with the "notFound" missing images, noone correcting them. Making bugged maps playable means less bugs getting actually reported and corrected.

A last thing: if there are no units in the map, then the game looks at the assets/units; so, be sure to use the "notFound" only after that.

Here it is a possible 48x48 notFound image, in the same style as the current "notFound" for the doc/images:



And no matter if most cases are just color changes; that's just cheap. The best quality, in most cases, is when different players have different units, not just color changes.

And I'm sure you already realize that there are several highest quality maps, like 270BC or Napoleonic Empires, that haven't those cheap monocrome colours.
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

Zim Xero
I respect your opinion Cernel, and see merits in it.  I question whether you see the full scope of other's interests, however.  To degrade engine capability by forcing specific map-making behavior will make more unified maps, but will also inhibit new creative designs.  While TripleA style WW2 maps have always been the meat and potatoes of TripleA... one of the best features of the engine here... is to see what other genres we can expand this too, how much we can stretch the possibilities, allow for different design and player tastes, and to explore new frontiers.  

I don't believe its a good idea to force 48x48 pixel unit sizes because a majority of players like them.  I dont think its a good idea to force a specific unit image to display with a specific unit name, with no way for map makers to over-ride this.  I don't think its a good idea to force an AI to play at a specific pace, because it fits well with many maps.  To me, these are all self-limiting behaviors.
'thats the way it is' makes it neither desireable nor inevitable
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

Cernel
In reply to this post by aaalafayette
aaalafayette wrote
Let's be clear/focus on the problems:
- each unit image need to always be available for every country regardless of production capability.
- unit images are 95%+ of the time duplicated between countries and then their color slightly altered. Updating colors of countries becomes impossible, and we incur a large maintenance cost, as well as large barrier to entry. For example,  updating one unit image requires N updates
I think both these issues are close to totally unimportant for map dimensions and for the single mapmaker, and may be relevant only if someone embarks in a project of correcting bugs of a great quantity of maps.

With this said, if you want to make an alternative subsidiary system, this is what I suggest:

- First the game looks at the player subfolder.
- If no image in player subfolder found, then the game looks at assets/units of TripleA.
- If no image in player subfolder found yet, then the game takes the same named units in "Neutral" in the folder, changing them by the ownership colour for that player.
- If no image in "Neutral" subfolder found either, then it uses the "Neutral" subfolder in assets/units/Neutral of TripleA, changing them by the ownership colour for that player.
- If still no image found, then it uses the "notFound" image.

This way mapmakers will be able to have maps having even only a single "Neutral" subfolder.

If you want to have a separate colour for units (not using the same of the ownership), such colour should be listed in map.properties, not in the xml. In this case, I would suggest that colour being preferably used for displaying the unit position it the minimap (currently, it uses the ownership colour, darkening it).

But, really, for the single mapmaker this issue is basically inexistent, compared to the time required to make the whole map...

Myself, I don't like the idea of having such a diverse system, and would stick just with the current ways, maybe just adding the "notFound" image, if you really want to (even tho I think it makes sense that bugged maps are just unplayable).
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

crazy_german
In reply to this post by Cernel
Adding that notFound image for missing units, its a good addition. There are situations where a non-bugged map can crash as a result of edit mode (TWW is an example), it makes getting a map running much easier (no reloading to see if my new idea works 10 times just cause of missing unit images).

It also might be useful to create more options than just "Neutral", most maps will have the opposing alliances facing opposite directions. We could also make some of those steps optional (map.properties is a good spot for them?)
Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

Cernel
In reply to this post by Zim Xero
Zim Xero wrote
I respect your opinion Cernel, and see merits in it.  I question whether you see the full scope of other's interests, however.  To degrade engine capability by forcing specific map-making behavior will make more unified maps, but will also inhibit new creative designs.  While TripleA style WW2 maps have always been the meat and potatoes of TripleA... one of the best features of the engine here... is to see what other genres we can expand this too, how much we can stretch the possibilities, allow for different design and player tastes, and to explore new frontiers.  

I don't believe its a good idea to force 48x48 pixel unit sizes because a majority of players like them.  I dont think its a good idea to force a specific unit image to display with a specific unit name, with no way for map makers to over-ride this.  I don't think its a good idea to force an AI to play at a specific pace, because it fits well with many maps.  To me, these are all self-limiting behaviors.
None of the points at this post are actually my opinions or I don't get what you mean.

Just wanted to point out that amongst the things above that I think to understand, noone of them is my opinion, and I just don't undestand the other ones.

For example "force 48x48 pixel unit sizes" is surely not my opinion. I made the notFound of that size just because it's currently the standard, not because I actually even like 48x48 at all.

Maybe if you detail each point, I can try to sort them out...
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

Cernel
In reply to this post by crazy_german
I think I'm neutral on the matter of having a bugged unit displayed as "notFound" or having just the game failing outright. If it would be a vote, I would abstain.

On a second thought, instead of "Neutral", maybe better having "Alliance_Name", where "Alliance_Name" would be <alliance player="Player_Name" alliance="Alliance_Name"/>, in the xml.

This way, in short, it would be:

1. First, look at a folder with "Player_Name" (like now).
2. Failing that, look at a folder with "Alliance_Name".
3. Failing that, kick in the "notFound" image.

This way, basically, for the regular 2 sides games, mapmakers could either choose to have 1 subfolder for each player or to have only 2 subfolders (one for each alliance).

And the colour change applies only when using the "Alliance_Name" subfolder, not when using the "Player_Name" one.

At any rate, I strongly believe that the current behaviour should be fully upkept as default, any changes being subsidiary (applying only if the "Player_Name" subfolder is missing for the map).
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

aaalafayette
Administrator
In reply to this post by Cernel
@Cernel, this is not a windows only game. The problem impacts many maps, some of them "high quality" like WaW and TWW. The suggestion to just leave it is a non-starter. If we go that route we may as well get rid of all the mac specific code, get rid of the mac and linux installers, and just make our lives simpler and have this be a windows only game.

The 3rd category of map is only useful for map makers. Players should not be exposed to broken maps, it's frankly embarrassing we have that as a download category. Throwing the majority of maps into that category is not an answer. Most maps are abandoned, so suggesting to just leave it means it'll just stay broken. I ran into the problem the hard way, if I hadn't done so much work on the game, I probably would have abandoned. Given the high download counts, yet few players, it seems like it's *very* common for people to just give up on the game for one reason or another.

I'm also happy you have no trouble creating one unit image per country per unit. Though that is a problem for anyone trying to update the unit images. How often do unit images get updated on a map, like brand new carrier images etc? Never - because it's too bloody painful to update them. You have to match color hue of existing unit, and then you have to repeat that work at least 5 times, on some maps there are 12 or more countries. It's a waste of time to set things up so that duplication is required. Furthermore, there are a lot of other benefits to reducing the duplication, fewer images means faster game load time, less memory, less lag, faster map downloads.

Plus, should mention, the fact that you have to maintain so many different images, it invites further problems, like making sure the casing/spelling of each one is identical.


95% of the time today we have cheap color change units. We should not mandate images be naively duplicated just so we can cater to that extra 5%. It's a naive, low tech solution. That is largely from the fact that a lot of TripleA was written quickly, and at times by people that were just learning how to program. 15 years later.. we can identify these shortcomings and fix them, it's insane to just want to live with it because that's just how it is.

Also consider the effort to make a new map. 8 units is typical, 5 countries is pretty low, but already we have 40 unique unit images that need to be made. What happens when you make them all, then you want to tweak how the infantry look? Have fun...   This is just another reason why map making is so difficult and time consuming. Again, there is no good reason to live with this.


@Crazy German
I suggest using neutral units as a base since the color change on them would show up easily. Color changing a 'dark' colored unit will not be very visible. To fix the case problem, since windows users will be oblivious, I think will just need a rework at the game engine level of some sort. One additional thing though is we can add a setting so units face 'left' 'right', and then flip them if they have a 'left' facing. I noticed that most maps are extremely inconsistent with left/right facing units, would be nice to get that uniform as well.
unit face.




@Cernel:

- First the game looks at the player subfolder.
-- Ok


- If no image in player subfolder found, then the game looks at assets/units of TripleA.
-- No, this doesn't make sense. The assets/units are duplicates of each other, so we may as well do the color change. Also, why force a map maker to use the colors chosen by the game engine, it's more flexible if the map maker can simply say, US is RGB 00FF11, and Russia is RGB FF1111, and then everything takes care of itself. Furthermore, if there is only one image to update, it is much more likely an artist would spend time to make a really good unit image, rather than  deal with the tedium of repeating that work N times.

 
- If no image in player subfolder found yet, then the game takes the same named units in "Neutral" in the folder, changing them by the ownership colour for that player.
-- This is probably a better 2nd rule than it is 3rd. If it's 3rd then there is no way for a map maker to define a generic unit image palette, they would be stuck with what the game engine provides.

- If no image in "Neutral" subfolder found either, then it uses the "Neutral" subfolder in assets/units/Neutral of TripleA, changing them by the ownership colour for that player.
-- Okay, if there is no map country override, and no map neutral, then we just use the neutral unit provided with the game engine.
 
- If still no image found, then it uses the "notFound" image.
-- Given the color change rules above, we may be close to ensuring an image will always be available. Adding the 'no image' found is very much a band aid solution, I'd rather us not rely on that. Plus, it would be hard to detect+ message to windows map makers that they are breaking the map..



So rephrasing a bit, the updated image search would be:
- look in the map zip for a country override
- failing that look to the neutral units to do a color change
- failing that look to the neutral units provided with the game engine
- failing that, probably best to blow up and notify the map maker they need to fix the missing unit image. Considering there's only one spot you need to drop an image, maybe we'll have the map makers drop in a 'no-image image' while building the map. I'm still pondering this last point, my preference for now is to keep the game engine simpler and cleaner and not have it worry about the no-image image.
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

aaalafayette
Administrator
In reply to this post by Cernel
Saw your latest post just now @Cernel. I like the idea of having images per alliances. I also agree the search order should go from most specific to least.

So in full, the unit image search order would then be:
1. map specific  player
2. map specific alliance
3. map specific neutral
4. game engine neutrals
5. "not found" image


Depending on what the color swapping code looks like, we may still be able to specify a map specific color hue per player, and also allow a game setting to change it in game as well. Will need to do some investigation before I'll know fully what the options will look like.
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

aaalafayette
Administrator
Note, forgot to mention. The game engine perhaps could be used for alliance or player specific unit images, though at the moment I think all the images are just color swapped, so we'll collapse those into the one set of unique images. So maybe in the end we really will have 6 or 7 steps to find a unit image.
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

Cernel
In reply to this post by aaalafayette
My only one strong opinion was that removing the possibility of having fully different units images, of same named units, for different players would be a very bad idea (very bad idea forcing having "germans_armour" or "russians_armour" just to have different images).

But I understand that the player subfolder will be kept and having priority; so, no problem now.

I don't mind the idea of having first checking for the player name subfolder, and then going for other more generic ones (Alliance, Neutral or whatever), nor I really care how it is realized and what the steps are.

And, yes, compared to the time required to make and balance a decent whole map, this units subfolder duplicate thing is indeed close to irrelevant, and good enough as it is, for the single mapmaker making his own map (only).

So, to sum it up, my position is that as long as you can still customize units for the single player like now (without needing "russians_armour", "germans_armour" etc.), then whatever... I don't care for the rest. I've no trouble creating one unit image per country per unit, anyway.

With this said, your reworking of the steps looks good.

As a side note, if Crazy_German feels so strongly about the need of having a "notFound" image, you can go that way, I guess. But I believe the player should receive a console pop-up java error, for that.

Myself, I'm a big supporter of having fully customized per-player units, which is awesome (like seeing the Bismarck for the Germans, the Littorio for the Italians, etc.), tho it is indeed a big effort for the map maker, in this case; this is why most mapmakers settle with one unit and go only for the cheap colour change.



p.s.: A lot of the units in assets/units are not just colour changed, but actually different per player, and you also have some that are not monocolour, like the AAguns with AAradar tech, or the various "hit" and "disabled".

p.p.s.: 95% being only colour change I think it's overstating; I would say more like around 80%.
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

crazy_german
In reply to this post by aaalafayette
My concern with the neutral box was just the direction units face, but the engine is able to flip then there should be no problems.

Also, with my suggestion for a notfound image, there should still be a Java error for the sake of debugging maps. But if map image still load it would be better. For example, in TWW we edit a territory not realizing it has an "occupation" unit, which isn't in every nation's unit folder. We get java errors, suddenly tiles won't load, and its a giant mess. If the error appeared, but the images were still out and still playable, we could just edit remove the problem unit easily and move on without confusion. There are other situations, like a potential forgotten fighter_lr that go unnoticed for a while, it would be convenient. In situations with tech units, could the game just revert to the tech free unit if image not available? (the not found band-aid would be fine too)

BTW, in the assets folder the units aren't just clones of each other with different colors, it includes different models of tanks and artillery. I imagine you would get complaints if suddenly russia lost its T-34 on common maps (i think revised and v3 use the assets)
Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

Cernel
Amongst the WW2, only v1 and v2 (not v3 and followings) use the default assets.

The matter is not only having tiger for everyone or t-34 for everyone, but also colouring up stuff like the damaged units and the aa radar etc..







History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Unify unit images between countries

aaalafayette
Administrator
In reply to this post by Cernel
I suppose my biggest problem with the 40 some images is that it's really tough to ever update them. Puts all the cost up front, and that's not a good thing. In addition it reduces the ability of people that are good with art, but not XML too help out. So we rely on our map makers to be both good XML coders, and good artists as well.

Seems like though overall we're in agreement that the unit search path should start specific and then go more general, failing more gracefully with an image not found and error message, rather than error message + game crashing. The collapsing of redundant images may not happen immediately as well, so likely the biggest change will be either image found (because we used a neutral image and color changed it), or alternatively the more graceful no-image found problem.
12