Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Feature requests and bug reports
[feature request] Per project scripts

rednib
Registered User
Quote
2022-09-22 13:04:09

What would help for version control of a project created with CopperCube would be, to have an option to load scripts from within a project folder. The problem i have is the following: i use git for version control my projects, and i have very specific scripts related to my project, but putting them into the CopperCube extensions folder is messy. Also when i push changes of my project, the script files won't be pushed obviously as they are not part of the project repo.

An easy solution would be, to have a similar convention like with the extensions folder, but with project folders:
- a project folder can have a folder called "scripts" that contains the scripts
- then CopperCube will check if such folder exists in the project folder and make the scripts inside it available within the editor, basically like with the extensions folder, but local to a project.

So then, both will be available, extension scripts and project-local scripts.

I am not familiar with the CopperCube internals, but I assume that scripts are loaded once at CopperCube start to make them available within the editor.
Having project local scripts would require a reload of the scripts when a project is loaded.
The other thing is, when creating new scripts while working on a project: for that a button in the editor for reloading scripts would be handy.

I think this feature should be relatively trivial to implement, as it just involves loading scripts from two folders instead of one. Step one: load the project scripts, step 2: load the extension scripts. If there are name collisions while loading the extension scripts, the project script should have priority (so basically skip loading that particular extension script where name collision happend), so this basically acts like overriding a script from the extensions folder.


VP
Guest
Quote
2022-09-22 13:39:39

I think the extenison-scripts are embedded into the coppercube project itself. If you delete the scripts folder and re-open a project file, it still uses the scripts, even though they no longer exist externally.

If you edit an extension-script on the local machine, that script will update when you next run coppercube or if you manually update the plugins.

That being said, you could probably make an extension for versioning - specifically using extension header-text, which can be edited locally and embedded with the coppercube file - no idea how you would get Github to recognise these changes though - I've never used it.


rednib
Registered User
Quote
2022-09-22 14:00:09

Or even easier solution:

Provide a checkbox in the editor that defines if scripts should be loaded from the extensions folder or from the project folder.
This setting is saved in the project file. If that is to much of a hassle, i would also be fine when this setting is stored globaly like the other editor settings.

I just want to have an easy way to store the scripts inside the project folder, that all.

I guess that would be the least amount of work for the CopperCube devs but would be a huge benefit for the users.

Because this means one can version control the entiry project including scripts.

In the other hand, one can still create not project related scripts and version controll them.
And when one creates a new project, one can just copy those scripts into the project scripts folder.

Thats the way how programming works:
- i have a project containing all my code
- if i want to use libraries, i copy them into my project (either manually or via a package manager)


veganpete
Registered User
Quote
2022-09-22 20:46:53

Yes, it's been asked before for a project folder for all files - hopefully it may happen in the future!

- there is already a way to point coppercube to use a project folder. Some of the more senior members will be able to advise you on that, it's not a feature I've used yet but it is somewhere in the help-page (something like: "API - change project folder").

I've seen ROBO ()and other users share their games as project folders with the exe, various scripts, audio, textures etc. all in one file.

For me the biggest issue I have with versioning is that fonts and audio are not embedded at all - this makes it easier to quickly swap-out or modify files (without even opening the ccb file) but also makes it easier to delete/replace by mistake (by accidentally using the same directory/file name for audio or graphics) and also makes it harder to manage a long-term project which becomes tied up and dependent on external files and directories.

Packing/embedding everything into a Project file would definitely be a really handy feature.


just_in_case
Moderator
Quote
2022-09-23 07:15:41

if you do scripting then you can easily manage to do the project folder thing.
like you can use "ccbLoadTexture" command to load from external file, you can create a folder for texture and load the textures during runtime from the folder. You can do the same thing with soundfiles as well.

there is a non-documented command "ccbChangeCurrentDirectory" or something that can also be used to change the project directory, means you no longer need your exe or .ccb file to be in the same folder or aomething like that.

for scripts if you are using single main javascript file for your game you can create that as well in the folder so that your game uses that javascript file.
like most of the games by @SmnMhmdy Saman uses a main script file that does all the stuff, instead of using different actions and behaviors.

but for non-coders, I am not sure but maybe a plugin can be created for the version control that will also load the extensions from the project folder.
the idea is to simply use system commands to copy all the extension from the project folder to the coppercube extensions folder. Whenever the project get's loaded throught the plugin. and when a game gets published delete those extensions from the CC's original extension folder. but I am not sure if that will work exactly as expected but it can be an idea.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact