The Settlers 4 - modding forum

Playable dark tribe and more :)

You are not logged in.

#1 2017-03-27 18:48:30

Tarvanis
Member
Registered: 2017-02-15
Posts: 11
Windows 7Firefox 52.0

Buildings, their use of space (PosLines) ...

I thought it would be a good idea to drag the discussion on the topic of buildings onto this forum.
First of all, here are all the original posts from the "Settlers 4 Editor - questions" thread. (I took the freedom to cut a few of the posts into one in order to save some space.)

royalux (21st of March 2017, 15:53) wrote:

Hi MakusieQ
Well, that is one of problems when we decoding it. I am not know so much. But here is what I found

L9d7lK.jpg

If you can see, you will know that is a "Binary Map" of the "WaterWorkerHut". First translate the dec code to hex, then hex to bin. I shift each binary line, just for matching what we can see in the game. I call it "Mask Pattern". I think that is what the code actually working for.

That pattern is matched to the building's base ground shape and direction. So you can not change it as your will, unless you know the main "Mask pattern" of each building. Because the size and shape are so different on each one, that will cause the 1st issue as I said.

I just remember there is a function using the "builingposline" pattern and recognizing where to put the building. and it is Deutsch. Sorry I forget where can find it.

Regards
RoyRua

Tarvanis (22nd of March 2017, 18:27) wrote:

Oh, I see what you mean now.
I guess this is the same pattern for any "PosLines". That would at least make sense to me.
I assume WaterPosLines is where the building needs water to be in order to build it (e. g. the port needs water somewhere to be placed).
So with this info people would be able to create their own building patterns IF they wanted.

Actually, I guess a binary <-> decimal calculator would be enough. However, we need one that's able to calculate with negative binary numbers. (I mean ... I could calculate it by myself ... but that would just take me ages. [dblpt]) )

royalux (23rd of March 2017, 14:54) wrote:

Hi
You're right! WaterPosLines is using for the building on shore, and also indicate the direction of pier. The size of each Poslines defined by "lines" are all the same, but the pattern for different PosLines may not be the same shape.

Yes, we need a tool to edit those codes. (Maybe you can help us. [dblpt]please[dblpt] ) There has another thing I know is the "bitBoundingRect". Inside the "bitBoundingRect", you will get "minX", "maxX", "minY" and "maxY".
    "maxY" - "minY" + 1 = "lines" (pattern height)
    "maxX" - "minX" + 1 = (pattern width)
Those codes also caused error when they don't match the pattern size.

Regards
RoyRua

royalux (24th of March 2017, 18:43) wrote:

[dblpt]cry[dblpt]  [dblpt]cry[dblpt]  [dblpt]cry[dblpt]
oops! So Sorry, I made a big trouble! My friend just reminded me : The "Poslines" options can not decide where to put the building.

The actually option is the "kind".

So Sorry for my worst memory!

RoyRua

Tarvanis (26th of March 2017, 00:22) wrote:

I'm afraid I can't create a tool for encoding self-made PosLines into Settlers 4 script text. I guess this binary converter must be enough for now:

http://www.binaryconvert.com/convert_signed_int.html

If you want to convert a decimal number into a binary one, simply insert it and hit "convert to binary". If you want to convert your binary PosLine pattern into a decimal number for the Settlers 4 code, insert the number into the right box under the "Binary" sign and hit "Convert to decimal". Copy the result out of the box under "Decimal".
Have a try with the numbers from your screenshot to get the idea!  [dblpt])

royalux wrote:

The "Poslines" options can not decide where to put the building.

The actually option is the "kind".

What exactly do you mean by "where to put the building"?
So far I thought that "kind" only describes the role of the building in some way (in other words, links to some role in another file that we don't have). With this role assignment the game knows that a castle is supposed to increase your controlled ground and is able to contain soldiers, that kind of stuff.

Another thing: Does anyone know what RepealingPosLines is for?
I'm wondering what BitBoundingRect describes. I mean, I see the maths you described, but what is it for...  [dblpt]huh[dblpt]

royalux (26th of March 2017, 12:20) wrote:

Well, as I know, there are 21 of  "kind"s inside the game.(maybe more) I assumed those are all constants
For example, just change the "kind" of GuardTowerSmall from "HOUSE_KIND_MILITARY" to "HOUSE_KIND_MINE".  Then you will found the small guard tower only can be put on the mountain.
They are also relative to the role, as you said.

About the "repealingPosLines", it could be using after you destroyed a building. (some materials left on the area)

The "BitBoundingRect" is using for calculating the memory size of the pattern, and defining the center of the patterns.
For example, you point somewhere for building by mouse. The point value is always (X:0, Y:0) in the "BitBoundingRect".
As you can see, all the size of "PosLines" never bigger than the "BitBoundingRect" size.

Regards
RoyRua

Added later 3 h 26 min 30 s:
7lQlJH.jpg

Hope this helpful

RoyRua


So, let's move on from here! [dblpt]D

Added later 1 h 18 min:
I've decoded all the Lines of the Mayan barracks (I just thought it has a recognisable shape, so it would be easier to see).

oaasjqav.gif
(Little typo: "bitBoudningRect" is of course "bitBoundingRect"  [dblpt]whistle[dblpt] )

digPosLines and blockPosLines are exactly the same. I wonder why. Obviously the entire ground beneath the building needs to be dug up by settlers (but I've never looked THAT closely, to be honest).

repealPosLines obviously seems to be where the building entrance is and where the weapons and gold are stored. So I guess these are the positions where settlers technically can be, but are sort of pushed away from if they're idle. (Settlers can't stand on top of a stockpile or a door.)

I'm currently working on something else regarding the PosLines. But I think it's too early to post this here yet.

Regards
Tarvanis

Offline

#2 2017-03-27 21:00:53

MakusieQ
Administrator
From: Poland
Registered: 2016-07-22
Posts: 40
Windows 7Opera 44.0.2510.857

Re: Buildings, their use of space (PosLines) ...

Tarvanis wrote:

I've decoded all the Lines of the Mayan barracks (I just thought it has a recognisable shape, so it would be easier to see).

oaasjqav.gif
(Little typo: "bitBoudningRect" is of course "bitBoundingRect"  [dblpt]whistle[dblpt] )

digPosLines and blockPosLines are exactly the same. I wonder why. Obviously the entire ground beneath the building needs to be dug up by settlers (but I've never looked THAT closely, to be honest).

repealPosLines obviously seems to be where the building entrance is and where the weapons and gold are stored. So I guess these are the positions where settlers technically can be, but are sort of pushed away from if they're idle. (Settlers can't stand on top of a stockpile or a door.)

I'm currently working on something else regarding the PosLines. But I think it's too early to post this here yet.

Regards
Tarvanis

Great work! It looks good, let us know about your progress [dblpt])


Check out my youtube channel : http://www.youtube.com/MakusieQ


Any questions? Just write me a private message [dblpt])

Offline

#3 2017-03-28 05:07:38

royalux
Member
Registered: 2017-03-14
Posts: 9
Windows 7Firefox 52.0

Re: Buildings, their use of space (PosLines) ...

WOW! [dblpt]good[dblpt]  [dblpt]applause[dblpt] Well Done! Tarvanis

About the building entrance, you may need to check the "door".
The position for the weapons and gold also indicated by the "pile". Something inside the pile I can not sure is the "pixeloffset".

RoyRua

Offline

#4 2017-03-28 19:16:52

Tarvanis
Member
Registered: 2017-02-15
Posts: 11
Windows 7Firefox 52.0

Re: Buildings, their use of space (PosLines) ...

Oh, thanks guys. [dblpt]shy[dblpt]

Of course the repealingPosLines don't tell the game where goods and the door are. But from the graphic I'd tell that these are positions from where settlers are pushed off. The only reasonable explanation is that these are the positions of the door (or where the settler exiting the building is created, rather) and the goods. Settlers aren't supposed to stand on there. So if they are idle, they'll automatically leave those positions.

Therefore it's logical that the door and goods are "on top of" the repealingPosLines.

From a brief look over the offsets in builderInfo, flag, door and piles, I'd say these offsets refer to the bitBoudning rect. It's a offset from the center of the building. I'd say they are expressed in standard coordinates.
I think that the pixelOffset is simply for a nicer positioning of the goods graphics in the game.

However, I'm not quite sure what flag, miniflag and workingpos are. I mean there is a flag on every building. Maybe "flag" puts the flag on a coordinate and "miniflag" is like the pixelOffset for it? The values in workingpos also seem a bit strange. I've got no idea...

Unfortunately I don't have the time right now to do some tests on these things here.  [dblpt][slash]

Greetings
Tarvanis

Added later 14 min 04 s:
Edit: I just had a little go and watched the settlers dig up the ground for building the Mayan barracks. They actually don't care for the ground unterneath the stone plates (you know, on the right; those where the settlers run around on to deliver weapons). So the digPosLines DOES describe what tiles need to be even. And from this building I'd tell that the digPosLines usually match the blockPosLines.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman