#1 13th May 2019 03:50:10

ImTheFrostbite
Armed Peasant
Reputation: 0

Registered: 22nd Sep 2018
Posts: 8

Color Changing Progress

Hello,

This thread is mostly for Lord Chris, but anyone can feel free to contribute.  I know on a previous thread here that there were discussions about efforts into diving into the coding of how color selection is made in Stronghold 2 and that I believe Chris was going to look into that.  Does anyone have any kind of information on if this is even possible or if there have been an efforts directed towards this?  I would love to push this however I can and am willing to help learn how to find a solution if someone would like to work with me.  There has to be a way!
Thanks for reading,

ImTheFrostbite

Last edited by ImTheFrostbite (13th May 2019 03:50:23)

Offline
  • 0

#2 24th May 2019 17:52:27

Lord_Chris
Lord Commander
Reputation: 148

From: England, United Kingdom
Registered: 14th Aug 2013
Posts: 2,194
Website

Re: Color Changing Progress

Welcome back again ImTheFrostbite- we've missed you!

I'm honestly not sure is the truth as I just haven't been able to find anything. Hex codes, colour codes, C++ is totally not my "thing" at all. I'm much more of a PHP guy than a C++ one. However I do know that Charles of Tours is studying C++. He may be able to find something about this and how easy it is.


The fields have eyes, and the woods have ears.
— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles
All Stronghold Legends Trails & Walkthroughs
Adding Units From Stronghold Legends into Stronghold 2
Extracting Audio Assets from Stronghold 3
Locking/Unlocking Stronghold Crusader 2 Maps

Offline
  • 0

#3 26th May 2019 17:02:34

Charles of Tours
Knight Banneret
Reputation: 68

From: Lovecraft Country
Registered: 16th Apr 2014
Posts: 257

Re: Color Changing Progress

Hi ImTheFrostbite. I'm not familiar with how Stronghold 2 does color selection. In SH1 and SHC, colors for players were saved as part of the map file, and could be changed in a hexadecimal editor like HexEdit, which allows you to change the RGB color scheme. HexEdit will allow you to read the binary code in hexadecimal, which is a bit easier for a human to read.

RGB is fairly standard. It allows you to pick a value between 0 and 255 for each of Red, Green, and Blue. This color picker will show you the 0-255 decimal values as well as the hexadecimal value for each color. For example, red is ff0000.

I suggest you make a blank "demo" map with some troops on it and try to open the file in HexEdit, that way nothing will go wrong with the game itself.


Mqb938i.png
Do you crave a life of adventure? Check out our Adventures in the Duchy of Riverborne and apply here to join the action!

Offline
  • 1

#4 27th May 2019 16:55:06

Lord_Chris
Lord Commander
Reputation: 148

From: England, United Kingdom
Registered: 14th Aug 2013
Posts: 2,194
Website

Re: Color Changing Progress

I've gone ahead and briefly tried myself what Charles of Tours suggested. Though this was on a campaign map which I had already written, because I didn't actually load the game up.

I can't find any hex codes in the map relating the player colours, which to me makes sense. Speaking from a programming point of view it wouldn't make sense to store these codes in the individual saved game files, there are just too many possibilities. What id you later wanted to update the whole game and change the colours? How would you make the old maps compatible? How would you ensure new maps played on older versions? .etc. etc.

I've gone ahead and looked at the shaders folder again and I'm convinced we're onto something here. The problem is that I feel what's happening is that the game .exe file is somehow "injecting" into the relevant shader files what share colours to do. Again, this kind of makes sense to me. Let's not forget that the players in multiplayer change colours dynamically. This would be a lot of code for these shader files and I've yet to find any evidence of this (or anything similar) in the shaders files and in my opinion it doesn't really make sense putting these colours in the shaders files either; shaders should simply be rendering things, not actively telling themelves what to do. It's just basic code separation.

My money is on the .exe file. My belief is that it's somehow injecting the colour codes into the shaders, telling the shaders what to render on each unit. This makes it almost impossible to change the player colours if this theory is correct unless you start hacking the exe file, something which we cannot condone. Unless Firefly were to release the source code, I doubt we will get very far on this one.


The fields have eyes, and the woods have ears.
— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles
All Stronghold Legends Trails & Walkthroughs
Adding Units From Stronghold Legends into Stronghold 2
Extracting Audio Assets from Stronghold 3
Locking/Unlocking Stronghold Crusader 2 Maps

Offline
  • 0

#5 27th May 2019 21:10:34

ImTheFrostbite
Armed Peasant
Reputation: 0

Registered: 22nd Sep 2018
Posts: 8

Re: Color Changing Progress

Hello Lord_Chris and Charles of Tours, and thank you for all of your work and research on this!  Did Firefly Studios ever release the source code to the other SH games listed here?  Just was curious as to if that would ever be a possibility.  Charles of Tours Have you been able to figure anything out with having some C++ knowledge?  Or has Lord_Chris basically summed it up nicely here?  I personally have reached out via Twitter to Nick and discussed the possibility of this, so maybe I can ask about if they would ever release the source code?

Just trying to figure out ways I can help out if possible.  Let me know if this seems to be our only option at this point.

Thanks again,

ImTheFrostbite

Last edited by ImTheFrostbite (27th May 2019 21:12:29)

Offline
  • 0

#6 30th May 2019 14:06:33

Charles of Tours
Knight Banneret
Reputation: 68

From: Lovecraft Country
Registered: 16th Apr 2014
Posts: 257

Re: Color Changing Progress

ImTheFrostbite said:

Did Firefly Studios ever release the source code to the other SH games listed here?

Everything I have read says no. Releasing the source code of a game to the public is essentially the same as releasing a game for free. While there could be a license restricting the use of the code, it's almost impossible to enforce licenses on open source material, especially on an international level.

ImTheFrostbite said:

Charles of Tours Have you been able to figure anything out with having some C++ knowledge?  Or has Lord_Chris basically summed it up nicely here?  I personally have reached out via Twitter to Nick and discussed the possibility of this, so maybe I can ask about if they would ever release the source code?

Chris seemed to sum it up quite well. In theory there are decompilers that could try to translate the compiled binary code into something human-readable, but I can't help here for legal reasons.

While searching for info about other conversations people had about the code, I stumbled across an open source reimplementation of Stronghold 1, but I would feel uncomfortable linking it here since it looks like it uses graphical assets from SH1. It isn't illegal to make a new game engine entirely from your own code, but things like graphics and audio are usually copyrighted. One open source workaround is to rely on an installation of the base game in order to actually run. See: openMW and KaM Remake. Granted, Bethesda gave their blessing to OpenMW after certain conditions were agreed to.

An open source reimplementation would be far easier to modify, but it would be like "reinventing the wheel" for something like changing colors. It's really unlikely that the source code for any of the Stronghold games will ever be released, since copies of the HD re-releases are selling on Steam.


Mqb938i.png
Do you crave a life of adventure? Check out our Adventures in the Duchy of Riverborne and apply here to join the action!

Offline
  • 0
Users in this topic: 0 guests, 0 registered users

Board footer

Powered by Aura

[ Generated in 0.060 seconds, 13 queries executed - Memory usage: 1.31 MiB (Peak: 4 MiB) ]