edited April 2024 in ORK Support
I know ORKFramework and Makinom were specifically designed as a 'low-code' solution more for designers than programmers, but there are a lot of good systems here that I would prefer to work with through code instead of schematics, and mainly use Makinom/ORK to handle list/data related stuff that might change regularly (items, factions, equipment, etc)

I've only been digging around the source for a week or so, but after dissecting it some, I made my own version of ORKGameStarter/base GameStarter classes and I added a new function right after the 'LoadProject(project)' call to my code to set up some of the other settings.

For example, I want to do the Player Setup for the 3D Action RPG tutorial through code instead. So after LoadProject(), I call my CustomSetup() function that has something like this:


public class GameSetupBase : MonoBehaviour, ISchematicStarter
{
protected virtual void Awake() {
// ...
LoadProject(project);
CustomSetup();
}

public void CustomSetup()
{
// ...
var gameControlsSettings = Maki.Data.Get<GameControlsSettings>().controlSettings;
gameControlsSettings.collisionCamera.enable = true;
gameControlsSettings.collisionCamera.settings.type = CollisionCameraType.Cross;
gameControlsSettings.collisionCamera.settings.layerMask = LayerMask.GetMask("Default");
gameControlsSettings.collisionCamera.settings.moveTowards = 0.1f;

var childObjectSettings = new ChildObjectSettings
{
childName = "Head",
type = ChildObjectType.Path
};
gameControlsSettings.collisionCamera.settings.childObject = childObjectSettings;

var orkControlsSettings = Maki.Data.Get<ORKGameControlsSettings>();
orkControlsSettings.playerControl.type = PlayerControlType.Button;
orkControlsSettings.playerControl.buttonController.moveType = ButtonControlMoveType.AnimatorRootMotion;

// ...

}
}


This seems to work alright, but is this a viable way to set things up and are there any pitfalls/tricky areas I should be aware of?
Post edited by bricker on
  • Is it possible? Yes.
    Is it a good idea? Probably not :)

    While you can generally handle of of this via code instead of setting it up in the editor - a big question here is why?
    This is a lot of work to do that's already handled for you in the editor. Some settings might be simple (e.g. setting some settings in a control component), but a lot of the data you input in ORK/Makinom is very complex code-wise and involves a lot of setup and initialization that's handled by the editor and not done when you just set something via code.

    E.g. even if the intial setup seems to work, this might cause errors later due to something not being initialized.
    Also, a lot of data is not directly referenced by the project asset and instead saved as individual assets.

    I'd recommend to handle the setup of things in the editor, or at least the basic setup for your system (status values, abilities, items, equipment, combatants, etc.). If your data is set up in the editor, you can handle the rest via code, e.g. adding combatants to the player group, managing inventory stuff, etc.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Yeah that's fair =-)

    Ive been a C# programmer for ~20 years now so I'm being a bit stubborn because working with code is more comfortable for me. I am slowly picking up the editor alright though, so I think I'll be fine using it once i get more used to it.

    However, another couple reasons I also wanted to work with code is for debugging and change tracking purposes. I use git for pretty much every project, and making changes via the editor is a bit more difficult to track what specifically changed between commits. Like if I managed to introduce a bug because I misconfigured something, but not sure what. I did get a PDB built and hooked up for the dll's, so i can go that route. And I know I can use the backups to go to a previous version, but I'm not sure what the easiest way to compare a project with a backup to determine what changed.

    Ultimately I'm the only developer so I don't have to worry about reviewing PRs or anything, but I'm curious what suggestions you might have on comparing a current project to a backup? Would it mainly be by setting the data format to XML?

  • As said - you can do the whole game starting and gameplay stuff via code just fine. Handling the data setup via code is just impractical, e.g. you also wouldn't set up data in a database via code each time a program is started :)

    As for comparing with backups - yeah, having data format as XML is pretty much the only way to have a somewhat checkable thing there.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.