UnofficialCrusaderPatch / UnofficialCrusaderPatch2

Unofficial balancing patch installer for Stronghold Crusader 1
MIT License
430 stars 59 forks source link

change build range #445

Open cyptus opened 5 years ago

cyptus commented 5 years ago

is the variable known where we can modify the build range we currently got as a square around the castle? it would be great to increase/decrease this range. already tried to find them with CE, without luck - do you got any ideas here?

cyptus commented 5 years ago

i figured out some more infos about that.

400x400 maps do have a range of total 141 blocks for x and y. 160x160 maps do have a range of total 91 blocks.

i think this comes from the center of the castle + the x and y range which would be 70 for 400x400 and 45 for 160x160. i scanned for these values and found 16 addresses (8 players, x and y):

image

Cheat-Table https://gist.github.com/cyptus/ca710710ae9dfcb8ac4823f632dc042a Scanned with Exterme version, V141-E with Patch UCP 2.13

I could not figure out how to patch/change these values.

Krarilotus commented 5 years ago

Oh, and how big is the build range on 200 x 200 and on 300 x 300 size maps?

Halbarad1 commented 5 years ago

Wow it would be very nice if the Patcher could be able to change the radius. What about moat, is it effected by these values too or does it have its own values (since it has a bigger range)?

GRhin commented 5 years ago

Completely theoretical, but if i were a programmer for the game, id use "radius + x tiles" to ensure they stay relatively the same.

cyptus commented 5 years ago

i am not sure abut 200x200 and 300x300 maps, i try to figure out these days. but i think for a patch it would not really matter.

moat would be interesting too! i also think its relativ to the castle build radius. i think it would be possible to also scan for the block width value of the moat, even it will get harder to scan because the value would not be different for the different map sizes (would it?).

would love to get some help here about patching these values. i already tried to patch some operations from the accessers of the addresses, without luck yet.

Krarilotus commented 5 years ago

The moat is always 5 more tiles than the normal build radius if i remember correctly. I would think it might be sth like 30 + mapsize/10 in x and y direction + the middle point. but not sure, since the 160x 160 has one less than that.

Btw: can you tell which point relative to the keep is the middle of the build area? That would be interesting.

GRhin commented 5 years ago

maybe there is a "minimum value" though i expect in the .exe its hardcoded values rather than that equation.

cyptus commented 5 years ago

i figured some more details out about the center and sizes:

image

160x160 -> 91 blocks range 200x200 -> 101 blocks range 300x300 -> 121 blocks range 400x400 -> 141 blocks range

i dont think there is a formula behind this, i think the values are hardcoded for each size. moat is always 5 blocks.

Sh0wdown commented 5 years ago

I took a look and found (and named) this function: Untitled

So editing the values of the "mov eax, value" cases changes the building range for the different map sizes.

cyptus commented 5 years ago

awesome @Sh0wdown! will we get this into the patcher as an option?

GRhin commented 5 years ago

Awesome @Sh0wdown any chance we can have access to a list of your labelled functions?

cyptus commented 5 years ago

i could verify the function here already, did successfully change the buildrange. i also found the address for the extrem edition: 0x4FBFB0

image (patched in extrem for all map types to 255 build range size)

ByBurton commented 5 years ago

But is the building range not already big enough? 😓

Krarilotus commented 5 years ago

@ByBurton Yeah, it is even to big, thats why i would suggest to reduce it to be equal for all players, if artificial or human

GRhin commented 5 years ago

I think small castle challenges is the only way this feature might be worthwhile for the patch, larger castles is simply unnessacary, I do not see larger castles improving the game in any way, happy to be corrected of course.

Krarilotus commented 5 years ago

maybe it could also be interesting to unlock castle buildings on the whole map for multiplayer. Making you able to build whereever you want. But not sure what that means for balance^^

Sh0wdown commented 5 years ago

@GRhin This is my IDA7 database of the Steam version of Crusader. Take the names with a grain of salt though, as some of them might be wrong. Stronghold Crusader.idb.zip

GRhin commented 5 years ago

Dude you are an absolute legend. Ill let you know (in a separate ticket) If I find anything incorrect or new. EDIT: So idb files appear to be only readable in the paid versions of IDAFreeware? Is it possible to get the .i64 file instead? or am I doing something very wrong?

GRhin commented 5 years ago

Just checked into the price of paid IDA, its in the range of $1,000 USD, I simply cannot afford that much, especially as this would be the only thing i use it for. Is there anyway you could provide a filetype that works with the freeware version?

Sh0wdown commented 5 years ago

Not sure, there is no direct export/save as for .i64 files. You could try to load/import this .idc file, maybe that will work, but I think comments are neglected with this.

Stronghold Crusader.idc.zip

LeSpec commented 3 years ago

@Grhin Did you manage to get that file working somehow? I'd like to have a look aswell. Also, is there a cheattable/address list for all the values that have been figured out so far? I gotta admit its kinda fun figureing this stuff out since i know about ida :D

GRhin commented 3 years ago

Yes I got it working ok, I forget the instructions so I'll come back later and give those. As for a cheat table... well that would be insanely massive, for the unit stats I am working on I am already at around 7,000 addresses, most of which are around each other with consistent offsets (think laid out like a table but every row is just added to the previous row). I think you have another few thousand for aic values. A cheat table isn't really a manageable format for this sort of thing. Especially as you might want another table for extreme values.

LeSpec commented 3 years ago

True true, 7k addresses that's massive indeed. Wouldn't it be nice to have an open file for table values and another one for ida functions, so that everyone can have a look at it and make proposals for descriptions?

GRhin commented 3 years ago

No offense, but that isnt practical at all. Maybe I've misunderstood, because I cant think of a scenario where that would even be an option, let alone necessary. For example the unit stats I have those most of those addresses laid out in a spreadsheet, I forget the exact number but it is probably over 7k there. However unit costs needed to be another table as their location is somewhere else, and they were found based on looking for them, you cant put them up and ask people to guess what they might be. Same situation with building costs, market values, and so on, however these will also have a completely different structure so would have to be separate tables for that reason as well. They are found by looking for them, not by having the values then guessing what they might be, especially because until you know what a section might be, you dont know how to format it. Is it 4 byte numbers or 2 or 1? Is it 80 columns to a row, or 50 or 200?

So in summary, the values cannot be structure to fit in one file, they are spread out, so you cant just dump everything, in most cases having it available for people to guess what it is is unnecessary as the data is found because of what it is. Essentially, the best way to provide a "file" to let people help figure out what stuff is, is the exe. Everyone has access to it, and can see if they can find values that could help. You are coming at this from the wrong direction. It is simpler to say "we have need of these values" and having people who help find them, as opposed to "we have these values, what are they?" If you want to help with the balance values I'm working on, feel free to message me on discord. It is more along the lines of "I still need to find where the unit damage to buildings value is" rather than "any idea what this address refers to?"

Krarilotus commented 3 years ago

Having the table openly available doesn't hurt however. Even if people can't guess it, it would be cool to see what values are found so far, and seeing the adresses put up publicly, would encourage people to dig through the code themselves more and find out stuff easier. I don't see any downside from putting the tables up.

However i agree, that proposals for descriptions are not the point here, i think what we really need is just someone who is willing to put up the work, to design the format and the transformation function at some point, putting in just a small fraction of what has been found as a start. As long as we don't have that, and a bigger concept where to go, we won't really get anywhere anyways, and would possibly shoot ourselves in the foot, doing the naming and branding before the structure and design is worked out, on how we want to adress that problem. And i can understand if GRhin wants to keep the authority on it. SO i see why he doesn't want to give up his information publicly, even tho it would be cool for everyone to have a look.

After all that said, i still would say, the tables should be at least visible somewhere, so that people can start familiarising themselves with all the values and stuff that is in there.

GRhin commented 3 years ago

Krari you have missed the point of the discussion, the balance stats were not the topic of discussion but an example to show the scope of the suggestions from lespec. The suggestions were for all values found to be made available, not just the balance data (which at 7k+ values is a very small piece of the overall puzzle). As well as the ida file allowing for all functions to be made available. Some form of collaboration on what has been found and what has not is a good ide, I just dont know how it could be achieved in this context. You can collaborate on certain sections/projects such as the unit stats or the aic values, however expanding this out to everything is a bit unmanageable with any technology I know of.

I am of course happy to collaborate on any of the projects I am working on if anyone wishes to get in touch. As I just offered to le spec.

As for familiarizing yourself with what is in the tables for the balance values, you personally have it, and several others who have asked for it have it, and there is a file available on stronghold heaven that has 90% of what I have in it.

LeSpec commented 3 years ago

Yes I got it working ok, I forget the instructions so I'll come back later and give those.

@GRhin You still got those instructions?, i did some google search but i couldn't figure it out.

GRhin commented 3 years ago

Um... when I'm on my computer next, which will be a while, I'll try remember to look, it was to do with importing a script or something to load this file after you open the exe.

On Mon, 11 Jan. 2021, 12:17 pm LeSpec, notifications@github.com wrote:

Yes I got it working ok, I forget the instructions so I'll come back later and give those.

@GRhin https://github.com/GRhin You still got those instructions?, i did some google search but i couldn't figure it out.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Sh0wdown/UnofficialCrusaderPatch/issues/445#issuecomment-757580643, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALGGWTS5542T23ZYQSPSLELSZJGRTANCNFSM4IKZWZ4A .

GRhin commented 3 years ago

Actually made time to look at pc. Open IDA Load Stronghold Crusader.exe into IDA Go to File > Script File... (alt + f7) select the idc file provided above. Wait for the script to finish. I got a few errors of "labels are only allowed in functions" but you can ignore these. At this point a bunch of the functions should be renamed.

LeSpec commented 3 years ago

Thx, that worked perfectly.

Unknovn344 commented 8 months ago

i could verify the function here already, did successfully change the buildrange. i also found the address for the extrem edition: 0x4FBFB0

image (patched in extrem for all map types to 255 build range size)

how did you found adress im asking cuz i use diffrent version

cyptus commented 8 months ago

i could verify the function here already, did successfully change the buildrange. i also found the address for the extrem edition: 0x4FBFB0

image (patched in extrem for all map types to 255 build range size)

how did you found adress im asking cuz i use diffrent version

Search in IDA for the 4 different values of the switch case that sh0wdown mentioned above (green in the screenshot) Then you got the addresses

Unknovn344 commented 8 months ago

thx i already found those adreses with cheat engine