-
Notifications
You must be signed in to change notification settings - Fork 1
[Proposal] Resource Override #29
Comments
Say that we added the ability to override a Resource with My guess is that the Kestrel engine would be unable to handle two Resources with the same id and would throw a runtime error. So ideally we'd want to detect that issue as early as possible by throwing a compile-time error if the first snippet was run. If so, that's an assembler behavior we'd want to implement.
Two solutions come to my mind for this:
I don't think that there should be a standard location for scenarios on the hard drive, since that could vary from platform to platform, and there could be a variety of reasons why they could be in different locations from machine to machine. The two solutions above would be the same for this problem. I suspect that the manifest file would be the better solution since then we have one flag that's passing in data about potentially many scenarios and other resource files (and in the future, could be extended for things like media resources). Given the potential scope of that, it may be worth tracking in a separate issue. |
Yeah I think a conflict would raise an ID collision error. Kestrel won’t throw an error upon finding duplicate IDs in a single resource file, but it would be undefined behaviour. But kestrel should need to have to know about such possibilities, thus the assembler throws an error. Definitely agree with a manifest for all files in your current project. Not sure what that should like though. 🤔 As for scenario locations, I think these should baked into the assembler, based on platform being compiled for. Kestrel won’t be moving these frequently (if ever), and it’s exactly what it does. We can also add options for overriding this location. I need to get some documentation/plans put together on the overall requirements from Kestrel, and ideas I’ve had for KDK. Sent with GitHawk |
I have some ideas for that based on other projects I've worked on. When I get a chance, I can create a proposal issue for it.
I'm not sure I understand why baked in would be preferable to user-defined. Assuming scenario means "base game", wouldn't that be in any number of locations as more games than EVO are supported? On macOS, I assume it would be in something like:
|
Hmm 🤔. Good point 👍. This is where a second set of eyes makes sense. I was thinking about it purely in terms of how Kestrel currently is, which is to have all scenarios defined in a common location: Sorry, this is me being in too deep to the current state of Kestrel to see the wider picture 😅 |
Maybe an environment variable like EV Nova currently uses? |
So that method of overriding is already intrinsically present in the ResourceFile system, and is actually the domain of the Kestrel, not the development kit. This is the other side of the equation, when we assemble the resources. For example, say we have:
Which one should it take? Should just take the most recent, and override the scenario resource? Should it override the newly created resource? Or should it just throw an error? It's probably important to mention that override in this context means something different to what it does in Kestrel. It's a subtle difference, but an important one. We're redefining a resource when we override it. It we try to override a resource that doesn't exist, then this is an error, because it will not have the initial source data from which to build a new resource. Image a
When we override we're asking the assembler to take all of the initial data and substitute only what we need, and not have to redefine everything, like so:
Which results in:
Sorry if I explained bits you already know/understood, but this might be helpful to others coming in who don't. |
Right, well my expected behaviour would be that the most recently declared definition of the resource would have precedence, starting with the new one in the current file and working backwards through the manifest (or however the other files get defined). As an extension of this proposal, a means of easily creating multiple variants of a resource would also be extremely handy. Something like:
Where #128 is duplicated to #129 with a modified cost. |
Proposal Outline
KDL currently allows only for the creation of new resources, and has no concept of overriding existing resources. Whilst it is possible to override them by simply creating a new resource, if the new resource only needs to change the name, or a single value, then it can be tedious to have to define each of the fields with the original resources values.
Detail
At present there is only one way to define a resource in KDL.
This is a passable solution and it gets the job done, but it is not intuitive/friendly to the developer. It should be possible for KDL to explicitly state that a declaration/definition is overriding another resource.
This would allow the assembler to know that the resource should be overridden, and require it to load the existing resource data and use that as a basis for the new resource. This will however, require a number of additions and improvements to the assembler.
These additions are the minimum required to allow this to work.
The text was updated successfully, but these errors were encountered: