User Supplied Templates?

One thing I like to do is create a set of templates of my own to use as base code when starting new projects in order to save time getting started - just exactly like the 3d and 2d templates that you have available, except my templates would be more specific to certain types of games I like to work on. (this is mostly handy for generating a starting code base in a game jam once a style or genre has been decided on, for example)

I’m wondering if there is currently a convenient way in CGE to create a project based off of another one, like a “save project as” type thing. I’m not yet familiar enough with the engine to know if just copying a project folder would be sufficient.

Since you already have a way to generate a project based on your built-in templates, I think it would be really cool to add a way for users to add their own user supplied templates to the list for starting a new project. Or it could be as simple as another folder selection and checkbox in the new project dialog - “base project on existing” and let the user navigate to their own template project.

If there is already a simple enough way to do this, just point me in the right direction!

thanks

1 Like

Simply copying the project folder is enough. Everything (like paths) inside the project is relative to this project directory, so just copying the whole project to any new place is sufficient. Optionally, you could also adjust project name/caption in the new project, and remove temp data there. So the full instructions are:

  • copy a project folder

  • in the new project, open CastleEngineManifest.xml in any text editor, and adjust there whatever you need. Typically, name and caption (docs are on CastleEngineManifest.xml examples · castle-engine/castle-engine Wiki · GitHub )

  • remove the castle-engine-output subdirectory of the project, if it exists

  • once you open the new project in the editor, click menu item “Code → Regenerate Project (overwrite LPI, LPR, CastleAutoGenerated)”. This updates some files (in particular CastleAutoGenerated unit) to reflect changes you did in CastleEngineManifest.xml. Alternatively, you can do this on the command-line, execute castle-engine generate-program (see docs on Build Tool · castle-engine/castle-engine Wiki · GitHub ).

We may have a more fancy way of doing this at some point, in particular to easily point to some example CGE project and start off from there. But for now, as “simply copying the project folder” just works (and it always will), this is not a priority a implement.

Thank you! It works as described.