Page MenuHomeWildfire Games

Allow inclusions in CParamNode.
Changes PlannedPublic

Authored by wraitii on Apr 3 2021, 3:38 PM.

Details

Reviewers
None
Summary

This adds a new special attribute to CParamNode: parent. It works like you'd expect (i.e. like our current Parent): it loads the original template, and applies the current children on that.
It's a lighter version of what I wanted to do in D2915.

The existing parent system is adapted to use this. This can be used to do file inclusions.
Pros:

  • will make it easier to maintain some things by reducing duplication.

Cons:

  • may ultimately make loading slightly slower (unlikely to matter a _lot_ to be honest).

TODO:

  • Ideally it would be good to be able to apply any CParamNode to any CParamNode, making it possible to remove the mercenary techs and stuff like that by doing 'mercenary|template_unit_infantry'.
  • Detect infinite loops again.

Future work:

  • More generally, CTemplateLoader should be renamed to CParamNodeManager, & CParamNode moved to ps/.
  • It'd probably be good to be able to load other files into CParamNode, which is currently restricted to XML. A "RawParamNode" datafile, similar to Atla's AtObj would probably be useful.
Test Plan

Agree that this is useful. Agree with the implementation. Test in-game.

Event Timeline

wraitii created this revision.Apr 3 2021, 3:38 PM
Owners added a subscriber: Restricted Owners Package.Apr 3 2021, 3:38 PM
Vulcan added a comment.Apr 3 2021, 3:41 PM

Build failure - The Moirai have given mortals hearts that can endure.

Debug: 
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

    11>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\js\sweepingapi.h(38): warning C4100: 'needs': unreferenced formal parameter (compiling source file ..\..\..\source\simulation2\components\CCmpAIManager.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]
    16>e:\jenkins\workspace\vs2015-differential\source\gui\scripting\scriptfunctions.cpp(37): fatal error C1083: Cannot open include file: 'ps/scripting/JSInterface_TemplateLoader.h': No such file or directory [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\gui.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\simulation2\components\ccmpunitmotionmanager.h(176): warning C4267: 'argument': conversion from 'size_t' to 'u16', possible loss of data (compiling source file ..\..\..\source\simulation2\components\CCmpUnitMotion_System.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\js\sweepingapi.h(38): warning C4100: 'needs': unreferenced formal parameter (compiling source file ..\..\..\source\simulation2\serialization\BinarySerializer.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\js\sweepingapi.h(38): warning C4100: 'needs': unreferenced formal parameter (compiling source file ..\..\..\source\simulation2\serialization\HashSerializer.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\js\sweepingapi.h(38): warning C4100: 'needs': unreferenced formal parameter (compiling source file ..\..\..\source\simulation2\serialization\StdDeserializer.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\js\sweepingapi.h(38): warning C4100: 'needs': unreferenced formal parameter (compiling source file ..\..\..\source\simulation2\serialization\StdSerializer.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\js\sweepingapi.h(38): warning C4100: 'needs': unreferenced formal parameter (compiling source file ..\..\..\source\simulation2\system\ComponentManagerSerialization.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/4938/display/redirect

Note that the builder example would be equivalent to doing <Entity parent="special/generic/builder|template_unit">, and the same would apply to most usages, since this is basically all template composition. However, it's not more complicated to allow including smaller snippets, and it gives a bit more flexibility.

Vulcan added a comment.Apr 3 2021, 3:41 PM

Build failure - The Moirai have given mortals hearts that can endure.

builderr-debug-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblobby_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libengine_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas_dbg.a(precompiled.o) has no symbols
../../../source/gui/Scripting/ScriptFunctions.cpp:37:10: fatal error: 'ps/scripting/JSInterface_TemplateLoader.h' file not found
#include "ps/scripting/JSInterface_TemplateLoader.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [obj/gui_Debug/ScriptFunctions.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [gui] Error 2

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/3843/display/redirect

Vulcan added a comment.Apr 3 2021, 3:45 PM

Build failure - The Moirai have given mortals hearts that can endure.

builderr-debug-gcc7.txt
../../../source/gui/Scripting/ScriptFunctions.cpp:37:10: fatal error: ps/scripting/JSInterface_TemplateLoader.h: No such file or directory
 #include "ps/scripting/JSInterface_TemplateLoader.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [gui.make:290: obj/gui_Debug/ScriptFunctions.o] Error 1
make: *** [Makefile:137: gui] Error 2

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/5552/display/redirect

wraitii requested review of this revision.Apr 3 2021, 3:45 PM
wraitii planned changes to this revision.Apr 3 2021, 5:02 PM

will focus on D3801 first