World of Banished

MODS Garage => Mod Talk => Topic started by: Tom Sawyer on April 11, 2017, 06:04:10 AM

Title: More Building Requirements
Post by: Tom Sawyer on April 11, 2017, 06:04:10 AM
I want to start a discussion separate from the other thread to (maybe) solve this issue of more building requirements. As you can see in the picture I was able to build a house with 5 materials, just for example. The game can already handle it. But to make it work I had to disable the BuildRequirementUI in the ToolTipToolbar.rsc and CreateBar.rsc. At these points the game crashes if more then 3 materials are defined. Of course it's not a solution because without this controller the Tooltip does not show the right content.

So what we know is that the problem is the object type "BuildRequirementUI" which controls the UI elements and crashes with more than 3 items. I think it can be easily fixed by Luke. Or we find a way to make the ToolTip work without crash. My trials to add elements there to show more materials failed. But I could live without showing the fourth or fifth material there.

It would be great to have this option of more requirements, also for CC @kralyerg and DSSV @Discrepancy where gears and baskets are included as new requirements as well as for many other mods @RedKetchup, @kid1293 and @Necora. Maybe we find a solution together. :)
Title: Re: More Building Requirements
Post by: kid1293 on April 11, 2017, 06:51:19 AM
Looks very promising!

Don't forget a third file 'ToolTipUpgrade.rsc'
Maybe you must change all three?

Are you sure the extra resources get collected and used as they should?
No problem with the finished building? edit - when destroyed -do you get all rsources?
Just that tooltip?
Title: Re: More Building Requirements
Post by: kralyerg on April 11, 2017, 07:21:34 AM
A long time ago, a modder named OwlChemist did a similar thing and ran into the same problems. I never looked into it much at the time, but it might be worth another look.

Can you share exactly what you did so we can all start from the same point? Or was it literally just commenting out a single line in the files you mentioned? (I'm on mobile so I can't actually look at my files at the moment.)

Title: Re: More Building Requirements
Post by: Tom Sawyer on April 11, 2017, 09:10:41 AM
Yes, it's just commenting out the BuildRequirementUI in ToolTipToolbar.rsc and CreateBar.rsc to avoid crashes. The ToolTipUpgrade is affected too. Thanks @kid1293.

Dialog resource
{
ElementDescription _rootElement = "main";

int _drawLevel = 2;

ElementController _controllers
[
{ ObjectType _type = HotKeyToolTipUI; }
//{ ObjectType _type = BuildRequirementUI; }
]
}



And I made a Build6.rsc with extended storage table referenced by the red cottage BuildUI (to keep the vanilla Build.rsc with3 slots):

RibbonDescription storageTable
{
int _cellPad = 7;

ElementDescription _elements
[
"clearItem"
"storageItem"
"storageItem"
"storageItem"
"storageItem"
"storageItem" //new
"storageItem" //new
]
}


It really works in game. They need the materials and carry it to the building site. You also get back some of them after demolishing. All is fine, only the ToolTip not. I tried to extend it by adding a "build3" item and so on but the game does not use it. Instead of this it crashes. It seems it tries to do something with the materials and fails. If it would just ignore the additional resources in the tool tip then it would work. Of course to show all mats on mouse over would be perfect. 5 resources would fit in this box and it also can be made wider. This is as far as I got.
Title: Re: More Building Requirements
Post by: Turis on April 11, 2017, 09:20:39 AM
Why don't you try adding another step in the production chain where you combine some of those materials to produce something generic like construction materials?
Title: Re: More Building Requirements
Post by: Tom Sawyer on April 11, 2017, 09:46:44 AM
That would of course work technically @Turis and I know it from CC but in game it is just a workaround and somehow artificial. How to combine bricks, tiles and window panes or a paint and some iron or gold or DS baskets and gears in a suitable way and how to name such new resources? Building pack x and y or building supply 1 - 3. I don't know. To just carry it to the building site and to see it there would be much more elegant. Especially because it already works and just needs a fix of the tool tip.
Title: Re: More Building Requirements
Post by: embx61 on April 11, 2017, 12:02:03 PM
Great find @Tom Sawyer

Indeed promising and my guess is that Luke should be able to do something in his code to make the tool tips work without that much a hassle.
Title: Re: More Building Requirements
Post by: Necora on April 11, 2017, 02:39:24 PM
I don't know much about this sort of thing, it is way beyond my knowledge of modding. But I was looking through the dialog files and the CreateBar.rsc has many instances of 'build0', 'build1', and 'build2'. Did you try adding a 'build3' and 'build4' for each time the others are mentioned?
Title: Re: More Building Requirements
Post by: RedKetchup on April 11, 2017, 02:40:14 PM
Quote from: Tom Sawyer on April 11, 2017, 09:46:44 AM
That would of course work technically @Turis and I know it from CC but in game it is just a workaround and somehow artificial. How to combine bricks, tiles and window panes or a paint and some iron or gold or DS baskets and gears in a suitable way and how to name such new resources? Building pack x and y or building supply 1 - 3. I don't know. To just carry it to the building site and to see it there would be much more elegant. Especially because it already works and just needs a fix of the tool tip.

i am pretty sur Tom that if you build your email correctly with all the details, this is certainly something Luke can fix : make his ToolTipToolbar.rsc and CreateBar.rsc compatible for accepting more building resources :).
if you explain him well, pretty sure he can easily fix that :)
Title: Re: More Building Requirements
Post by: Discrepancy on April 11, 2017, 05:53:09 PM
sorry for being an echo, but very good find @Tom Sawyer .

Even if Luke doesn't make changes, I think we could find a new way of getting around this and utilizing the extra resources.

...

A question regarding the returning of resources when a building is demolished.
I don't think I ever really get all the resources back anyway, and I've found with buildings that require few resources I don't get them back. Is this normal?
For example, how many people are getting returned Wagon Parts when they remove a Vendor Wagon? It was happening very little when I was testing.
Title: Re: More Building Requirements
Post by: Necora on April 11, 2017, 06:01:43 PM
@Discrepancy when I built a building that required 1 dory, it seemed to be hit or miss (mostly miss) if I would get any back when it was demolished.
Title: Re: More Building Requirements
Post by: embx61 on April 11, 2017, 06:04:29 PM
@Discrepancy

I think you get half of the materials back you used for the building.
I never really checked it but see stuff on the ground after the building is demolished.
Title: Re: More Building Requirements
Post by: Paeng on April 12, 2017, 07:30:58 AM
Quote from: embx61 on April 11, 2017, 06:04:29 PMI think you get half of the materials back

Yeah, that's correct...

It may be worth some testing if Banished correctly recognizes custom materials added to building requirements (like bricks, lumber, glass or whatever)...
Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 11:39:46 AM
i sent an email to Luke about it ....
hopefully we will get some news on this :)
Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 12:42:20 PM
btw guys...

i cant even get to you guys are .... i crash always as i click my blacksmith icon :S


my BS had : wood, stone and iron. i added brick and rooftile.
in the BuildUI of that BS , i changed    ElementDescription _element = "Dialog/Build.rsc:build"; to    ElementDescription _element = "Dialog/Build6.rsc:build";
i made a copy of build.rsc and renamed build6.rsc
i added 2x    "storageItem" //new at the end of the list of RibbonDescription storageTable
i added a copy of ToolTipToolbar.rsc , CreateBar.rsc , The ToolTipUpgrade.rsc and i shut down the //{   ObjectType _type = BuildRequirementUI;   } in those 3...


but i am still crashing.... what i ve missed ?
Title: Re: More Building Requirements
Post by: Tom Sawyer on April 12, 2017, 12:50:15 PM
Oh, I wrote to him yesterday evening @RedKetchup and did not came to the forum again. Now he will definitely add us to his spam...^^ Lets see.

What copies of the ToolTipToolbar.rsc... have you made? As far as I know the game can only use the originals. And when it crashes in your game? On mouseover (ToolTipToolbar) or click (CreateBar). Or maybe they are just not compiled because not called in mod resource file?

I did not try something new on it but adding more build items does not work @Necora. The game ignores it. Probably this is to be fixed in the core game. To handle more build items by the BuildRequirementUI.
Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 12:55:33 PM
i ve made a copy of these 3 in my dialog and didnt renamed it. i ve let it as a replacement with same name.
in fact , as last try in game ... it is probably when the tooltip should have appeared (after 1 full second) that it crashed, i didnt clicked on it yet. (mouseover)
Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 01:02:57 PM
yeah right, i added the tooltiptoolbar reference in the root resource file and it shows the resources with ?? ?.
i ll add the others.
Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 01:09:25 PM
it effectively works :) it is just the BuildRequirementUI that is messing.
Title: Re: More Building Requirements
Post by: embx61 on April 12, 2017, 01:10:11 PM
So I am not the only one :)

I am in the same boat as RedKetchup. Even hovering over the building Icon in the Toolbar freezes the game and I have to use Task Manager to shut Banished down.

I can see it is a Access Violation Error and that tells me the game looks for something in memory what is not there.
Title: Re: More Building Requirements
Post by: embx61 on April 12, 2017, 01:17:00 PM
Ah, I have to add the files to the XXXresources.rsc files in the root I just read.

Let's get a go at it again.
Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 01:45:46 PM
Quote from: embx61 on April 12, 2017, 01:17:00 PM
Ah, I have to add the files to the XXXresources.rsc files in the root I just read.

Let's get a go at it again.

hehe

on my side i am checking to see if all the other code we can see can cause the error....
i added the build3-4 everywhere... and enable the UI .... but still crashing.
Title: Re: More Building Requirements
Post by: embx61 on April 12, 2017, 02:10:07 PM
Okay get it work just as you guys. The compiler kept complaining about not finding the Build6.rsc file but if I clicked ignore it put the files in the package.
What on earth is up with that is beyond me but it works.

Only one reference is needed for that file, correct? In the Template file of the building.

I see three x x x at the bottom of the tooltip and that is where normally the little icons for the build materials need to go with the text how many of each.


Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 02:19:19 PM
did you put your build6.rsc in your dialog folder of your mod ?

yeah there is 3 x

if you add a build3 and a build4 and at bottom, a labelbuild 3 and 4 .... you will get 5x
but doesnt make us go further lol
Title: Re: More Building Requirements
Post by: embx61 on April 12, 2017, 02:55:28 PM
Without enabling the Build Requirements UI but added two build items to the ToolTipToolBar.rsc I see now x x x x x instead of x x x.

I guess that enabling the UI will crash. Yeps, it crashes with Access Violation Error :(

I fear that the Build Requirements UI is eiter a hardcoded list or array.
If so , nothing can be done by us. Luke has to expand the array/list up to 6.

Part of the Crash Dump File
Memory addresses and some assembly code for those who are interested. LOL
So it is a INVALID POINTER ERROR, so my fear that it is a hardcode array/list seem to be true.

If Luke made a array or list to store 3 items in the Build Req UI and we add some to it will result in pointing to a pointer in memory what is not existing.
FAULTING_IP:
Runtime_x64+4298a
00007ffe`439b298a 493900          cmp     qword ptr [r8],rax

EXCEPTION_RECORD:  ffffffffffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 00007ffe439b298a (Runtime_x64+0x000000000004298a)
   ExceptionCode: c0000005 (Access violation)  [color=red]<========  Object not in memory[/color]
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 0000000000000000
   Parameter[1]: 0000100000000106
Attempt to read from address 0000100000000106

DEFAULT_BUCKET_ID:  INVALID_POINTER_READ

PROCESS_NAME:  Application-x64.exe

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx" referenced memory at "0x%08lx". The memory could not be "%s". [color=red]// Read[/color]

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx" referenced memory at "0x%08lx". The memory could not be "%s". [color=red]// Read[/color]

EXCEPTION_PARAMETER1:  0000000000000000

EXCEPTION_PARAMETER2:  0000100000000106

READ_ADDRESS:  0000100000000106

FOLLOWUP_IP:
Runtime_x64+4298a
00007ffe`439b298a 493900          cmp     qword ptr [r8],rax

FAULTING_THREAD:  00000000000016e0

PRIMARY_PROBLEM_CLASS:  INVALID_POINTER_READ   [color=red]<=========================
[/color]
BUGCHECK_STR:  APPLICATION_FAULT_INVALID_POINTER_READ [color=red]<======================
[/color]
LAST_CONTROL_TRANSFER:  from 00007ff67b38efc1 to 00007ffe439b298a

STACK_TEXT: 
000000f2`37ebe418 00007ff6`7b38efc1 : 000000f2`39cdd890 000000f2`3bcafae0 000000f2`37ebe499 000000f2`3d8fa6a8 : Runtime_x64+0x4298a
000000f2`37ebe420 000000f2`39cdd890 : 000000f2`3bcafae0 000000f2`37ebe499 000000f2`3d8fa6a8 000000f2`3bcafa00 : Application_x64+0x5efc1
000000f2`37ebe428 000000f2`3bcafae0 : 000000f2`37ebe499 000000f2`3d8fa6a8 000000f2`3bcafa00 000000f2`00000000 : 0xf2`39cdd890
000000f2`37ebe430 000000f2`37ebe499 : 000000f2`3d8fa6a8 000000f2`3bcafa00 000000f2`00000000 000000f2`3bfc7fe8 : 0xf2`3bcafae0
000000f2`37ebe438 000000f2`3d8fa6a8 : 000000f2`3bcafa00 000000f2`00000000 000000f2`3bfc7fe8 000000f2`3d4622f0 : 0xf2`37ebe499
000000f2`37ebe440 000000f2`3bcafa00 : 000000f2`00000000 000000f2`3bfc7fe8 000000f2`3d4622f0 000000f2`3d462208 : 0xf2`3d8fa6a8
000000f2`37ebe448 000000f2`00000000 : 000000f2`3bfc7fe8 000000f2`3d4622f0 000000f2`3d462208 00000000`00000030 : 0xf2`3bcafa00
000000f2`37ebe450 000000f2`3bfc7fe8 : 000000f2`3d4622f0 000000f2`3d462208 00000000`00000030 000000f2`3bcafae8 : 0xf2`00000000
000000f2`37ebe458 000000f2`3d4622f0 : 000000f2`3d462208 00000000`00000030 000000f2`3bcafae8 00007ffe`43a3d33b : 0xf2`3bfc7fe8
000000f2`37ebe460 000000f2`3d462208 : 00000000`00000030 000000f2`3bcafae8 00007ffe`43a3d33b 000000f2`3a9e57d8 : 0xf2`3d4622f0
000000f2`37ebe468 00000000`00000030 : 000000f2`3bcafae8 00007ffe`43a3d33b 000000f2`3a9e57d8 00007ffe`000001ae : 0xf2`3d462208
000000f2`37ebe470 000000f2`3bcafae8 : 00007ffe`43a3d33b 000000f2`3a9e57d8 00007ffe`000001ae 00000000`00000000 : 0x30
000000f2`37ebe478 00007ffe`43a3d33b : 000000f2`3a9e57d8 00007ffe`000001ae 00000000`00000000 ffffffff`fffffffe : 0xf2`3bcafae8
000000f2`37ebe480 000000f2`3a9e57d8 : 00007ffe`000001ae 00000000`00000000 ffffffff`fffffffe 000000f2`3a9e57d8 : Runtime_x64+0xcd33b
000000f2`37ebe488 00007ffe`000001ae : 00000000`00000000 ffffffff`fffffffe 000000f2`3a9e57d8 00007ffe`000001ae : 0xf2`3a9e57d8
000000f2`37ebe490 00000000`00000000 : ffffffff`fffffffe 000000f2`3a9e57d8 00007ffe`000001ae 000000f2`3d8fa6a8 : 0x7ffe`000001ae


STACK_COMMAND:  ~0s; .ecxr ; kb

SYMBOL_STACK_INDEX:  0

SYMBOL_NAME:  Runtime_x64+4298a

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: Runtime_x64

IMAGE_NAME:  Runtime-x64.dll

DEBUG_FLR_IMAGE_TIMESTAMP:  58d05a57

FAILURE_BUCKET_ID:  INVALID_POINTER_READ_c0000005_Runtime-x64.dll!Unknown

BUCKET_ID:  X64_APPLICATION_FAULT_INVALID_POINTER_READ_Runtime_x64+4298a
Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 03:20:14 PM
yeah :S there is something in the UI code that make it crash like something has been array at 3 max (0,1,2) and try to read position 3 and 4 and it crash cause it not has been defined.


it is in the BuildRequirementUI code because the game can handle the fact it has 5 resource and the building progress window handle it.
it is surely something very little and very stupid inside that UI code ><

maybe
if we would see it, maybe we could add these build3-4 or whatever is missing... but since we cannot edit it ... only Luke can fix that.
Title: Re: More Building Requirements
Post by: embx61 on April 12, 2017, 03:31:15 PM
I did a complete search in the complete resource folder of the Mod Kit for Building Requirement UI and only the 3 references in the three files came up.

So it is a hidden Object.

O well, I am not wasting more time on it as I am sure it will bring us nowhere without Luke fixing it.
Title: Re: More Building Requirements
Post by: RedKetchup on April 12, 2017, 03:57:00 PM
yeah me too i closed everything
couldnt find a solution... .sorry ><
Title: Re: More Building Requirements
Post by: RedKetchup on April 20, 2017, 05:05:57 PM
Quote from: RedKetchup on April 12, 2017, 11:39:46 AM
i sent an email to Luke about it ....
hopefully we will get some news on this :)

i already pasted a copy of this in Gather our forces thread..... but i post a copy here too....




HEY i ve got some news from Luke today !!!!!!!!! about to upgrade the building requirement from 3 to 6 materials :)

here's a quote copy paste from my email ( his answer is coming first in the quote and then after at bottom, a copy from my words sent to him)


Quote
Hi Michel,

I'll look into it - I think it should be a fairly easy fix/addition without changing to much code, but I won't know until I reproduce the crashes.

As far as my next project, I'm still undecided and working on a few different things. Also working on a bunch of lower level code to support new things which takes a bit of time.




On 4/12/2017 2:38 PM, Michel Guénette wrote:
Hello Luke !

I hope you are going very well !
How goes your games developpement ? Have you decided what is your next project ? last time you told me that you have "some designs in the works for new projects going on and depending which is most fun..." any news on this ?

The moddler community here on world of banished, we tried to look at a way to make pass the 3 building resource requirement to 6 resources instead.
we almost making it even if at first look it should have been impossible without crash...

in fact we found that the game is supporting it, more than 3 resources but there is 2 little rsc that make us crash but if we // comment the
BuildRequirementUI in ToolTipToolbar.rsc and CreateBar.rsc we avoid crashes. The ToolTipUpgrade is affected too. And it works.

so do you think this can be fix easily to allow this 100% fully working ?


In hope to get feedback from you, Luke 😊
Regards,

Michel
Title: Re: More Building Requirements
Post by: QueryEverything on April 20, 2017, 05:18:17 PM
That is good news :)  Great work on getting a response @RedKetchup and thanks to Luke who sent the response :D
Title: Re: More Building Requirements
Post by: Discrepancy on April 20, 2017, 05:33:03 PM
Excellent :)
Nice that you got a response.
Title: Re: More Building Requirements
Post by: RedKetchup on April 20, 2017, 05:33:42 PM
Quote from: Discrepancy on April 20, 2017, 05:33:03 PM
Excellent :)
Nice that you got a response.

indeed!
Title: Re: More Building Requirements
Post by: Tom Sawyer on April 21, 2017, 01:13:28 PM
That's good news. And I also think that the response is promising. If we make specific points as concrete as here, we have good chances of a few more improvements. So I was not wrong to already start a forest glassworks for an additional building material. :)
Title: Re: More Building Requirements
Post by: Nilla on April 22, 2017, 03:21:18 AM
I'm happy, too. :)

I think, if this come true, it will help to keep the game alive longer. You modders have something new to "play" with and the rest of us to try out.

And Tom, I'm glad to hear about your glass plans!
Title: Re: More Building Requirements
Post by: RedKetchup on April 22, 2017, 12:05:24 PM
Quote from: Nilla on April 22, 2017, 03:21:18 AM
I'm happy, too. :)

I think, if this come true, it will help to keep the game alive longer. You modders have something new to "play" with and the rest of us to try out.

And Tom, I'm glad to hear about your glass plans!

definetly the first item material requirement people will surely add first will be glasses (windows)
i always found it strange to add wood/stone/irons for a building which has 4 windows and not being able to add that material.
for sure personally, i would go for a number of "glass" equal to the number of windows you see in the mesh :)
Title: Re: More Building Requirements
Post by: embx61 on April 22, 2017, 12:50:47 PM
Luke will look into it and already stated (What I and others expected) it will not be too hard to add it to the game.

So I am pretty sure Luke will add it to the game and that is good news indeed :)

Summing up what the modders working on it did and tell luke the steps taken will help him pinpoint what the problem is.

My bet is still just a few definitions have to be added to the build requirements UI and make those available for use.
Title: Re: More Building Requirements
Post by: brads3 on April 22, 2017, 06:48:20 PM
i have glass.back then there was no glass. those windows were open holes with shutters to close them against indian arrows or wildlife.i do see new roof materials thou. thatch,tile,slate,etc.i'd  take a maintanence material that has to be added each year ,then we can use furniture,candles,silverware,etc. but that will take more coding.
Title: Re: More Building Requirements
Post by: Paeng on April 23, 2017, 03:15:42 AM
Glass-making can be traced to ancient days, across many cultures... In the Americas, a glass workshop was established at Jamestown, Virginia, in 1608. Until the early 1700s though, the colonists imported glass windows and table glass, as well as bottles, mostly from England. So it was certainly available...  ;)

I would assume that modders will not require glass for a grungy little hovel somewhere in the deepest forest LOL
Title: Re: More Building Requirements
Post by: Abandoned on April 23, 2017, 05:21:59 AM
oh oh, production chains, back to caves for my small mountain map people, need some cave dwellings or those hobbit houses Mr. @RedKetchup   :)

(nice addition for bigger maps and settlements.)
Title: Re: More Building Requirements
Post by: Tom Sawyer on June 13, 2017, 01:38:27 AM
Great news from Luke and I had to load my attempt from the first post of this thread. It works very well and can already out of beta please. ;D

If you want to see it in game you can load RedCottageBeta.pkm (http://www.banishedventures.com/downloads/RedCottageBeta.pkm). It's just an example. I will add other materials like glass. The changes in the dialog files are rather simple and well described in Lukes readme. The only thing that is not mentioned is that also the ToolTipUpgrade.rsc has to be extended if used.

(http://www.banishedventures.com/images/redcottage-beta.jpg)



Title: Re: More Building Requirements
Post by: RedKetchup on June 13, 2017, 02:01:02 AM
good!  awesome Tom !

i hope many will test it and live with it to see if it is stable :)
Title: Re: More Building Requirements
Post by: Tom Sawyer on June 13, 2017, 07:58:07 AM
Playing around with the new feature I noticed that (of course) all mods which add more materials will be red flagged. And actually I don't see a reason why these additional build items in the dialog files should not be already in the core resources. They are hidden and would not change the UI of the vanilla game. So modders would just have to add more materials to the building template. Not a big deal and I can live with it as it is now. But maybe not the perfect solution.
Title: Re: More Building Requirements
Post by: RedKetchup on June 15, 2017, 03:14:21 PM
Quote from: Tom Sawyer on June 13, 2017, 01:38:27 AM
Great news from Luke and I had to load my attempt from the first post of this thread. It works very well and can already out of beta please. ;D

If you want to see it in game you can load RedCottageBeta.pkm (http://www.banishedventures.com/downloads/RedCottageBeta.pkm). It's just an example. I will add other materials like glass. The changes in the dialog files are rather simple and well described in Lukes readme. The only thing that is not mentioned is that also the ToolTipUpgrade.rsc has to be extended if used.

(http://www.banishedventures.com/images/redcottage-beta.jpg)

hey ! anyone testing that ??? we need test results so we can foward to Luke !