ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Feature requests and bug reports
forum topic indicator Request - Import CCP and CCP files during runtime
person icon
kaelgodoy
Registered User
Quote
2024-10-22 17:45:45

I was trying some things in CopperCube, and noticed the code "ccbSwitchToCCBFile" just opens the file as it was the main game (no need to compile to an .exe), but for optimization and code preservation purposes, i wanted to import the CCB file as a "prefab" (to stay in the same scene as the exe i'm playing).

In resume: my request is to be possible to import CCB files as if the were a prefab, to keep the assets from the main scene while opening the CCB. Or to be possible to import CCP files during runtime, making it a good option for optimization, and possibly game code preservation.

person icon
guest_Robbo
Guest
Quote
2024-10-24 09:33:58

I cant promise anything as my C++ skills are not that good but I was thinking to look into that part also to maybe adjust what is loaded and what can remain in memory instead of a total swap out....would need some time to look into though ...

person icon
morbott
Registered User
Quote
2024-11-02 21:13:21

I was thinking about this same thing a little while ago too!
Like, what we see is an envelope that loads and unloads/purges CCB files.
Interesting idea.

person icon
kaelgodoy
Registered User
Quote
2024-11-04 17:19:43

I hope it works, it's chaotic to create a lot of scenes for each map of the game. I have my main project that's a FPS game, something similar to Metro/Stalker (of course, in a much lower scale), and for optimization, loading .ccb files seems a good option, since i can put the scenes in folders, and ask to delete or hide specific ones instead of loading all areas.
Another thing i'm doing is basically GMod for testing multiple save files, controls, etc. And that's where i thougt about the .ccb/ccp file loading, since the maps could be saved there and edited, but the camera and scripts would be safe on the exe.

person icon
guest_Robbo
Guest
Quote
2024-11-11 06:55:18

Well sort of what you wanted maybe but not exactly:

I just finished making a new way to load a single ccb file as a separate "Document" as normally you only ever have 1 document but this new way allows for 2 documents or effectively 2 ccb files open at the same time and the 2nd ccb file can be loaded in anytime.

It is a new document so not like just importing in assets into your standard game.
There already is a way to import assets into your runtime game using the system command actually - maybe that's what your after ?

My new method is designed for a separate menu selection with a number of scenes that can be accessed anytime in my game as it stays in memory and not deleted. I find this method best instead of editing every single separate ccb file with any changes every time for menu changes (pain in the arse) so instead have one instance of it and just edit that once for all levels. Its a bit like using a function instead of multiple uses of the same code all over the place.

I tried just using the switchToCCB file and back again but that deletes the last ccb file open and prefer to keep the game in memory and just open the menu as a new document.

Its working fine actually....
Will be in my next update.

person icon
guest_Robbo
Guest
Quote
2024-11-11 08:22:57

Actually the system command to load assets from a ccb file option seems to only work within the Editor...can anyone confirm ?

person icon
Monks
Guest
Quote
2024-11-11 10:58:58

I'm sure it can work in .exe

person icon
kaelgodoy
Registered User
Quote
2024-11-11 13:55:38

guest_Robbo wrote:
Well sort of what you wanted maybe but not exactly:

I just finished making a new way to load a single ccb file as a separate "Document" as normally you only ever have 1 document but this new way allows for 2 documents or effectively 2 ccb files open at the same time and the 2nd ccb file can be loaded in anytime.

It is a new document so not like just importing in assets into your standard game.
There already is a way to import assets into your runtime game using the system command actually - maybe that's what your after ?

My new method is designed for a separate menu selection with a number of scenes that can be accessed anytime in my game as it stays in memory and not deleted. I find this method best instead of editing every single separate ccb file with any changes every time for menu changes (pain in the arse) so instead have one instance of it and just edit that once for all levels. Its a bit like using a function instead of multiple uses of the same code all over the place.

I tried just using the switchToCCB file and back again but that deletes the last ccb file open and prefer to keep the game in memory and just open the menu as a new document.

Its working fine actually....
Will be in my next update.


I'm excited to test the new functions. And your work is awesome, as soon as my invoice closes, i'm supporting you more on Itch, btw.
About the importing system, i imagine it being useful for creating maps/areas and npcs, something like that function inside CopperCube's editor (Import CopperCube Scene), but do it during runtime

person icon
guest_Robbo
Guest
Quote
2024-11-13 01:38:42

thanks 'kaelgodoy'.

Im just going through and testing everything out will better debug messages.

The default method of unused texture deletion in CC happens not on next ccb file load but on the one after that in case you have the same textures in a subsequent load.

So in other words any texture that is not used stays in memory for 2 ccb file loads (the original load and the one after).

I have changed that to immediately delete all textures not ending with special character ( '0' for now) for better memory management. Any textures used in the next ccb file load will not be deleted if ending with '0' - unless you can think of a better character to use....

I will look into just a simple load new scene also...

person icon
kaelgodoy
Registered User
Quote
2024-11-13 17:33:03

guest_Robbo wrote:
thanks 'kaelgodoy'.

Im just going through and testing everything out will better debug messages.

The default method of unused texture deletion in CC happens not on next ccb file load but on the one after that in case you have the same textures in a subsequent load.

So in other words any texture that is not used stays in memory for 2 ccb file loads (the original load and the one after).

I have changed that to immediately delete all textures not ending with special character ( '0' for now) for better memory management. Any textures used in the next ccb file load will not be deleted if ending with '0' - unless you can think of a better character to use....

I will look into just a simple load new scene also...


You can use the test scenario i'm using. It is a simple project i made to test these function.

https://drive.google.com/file/d/...

person icon
guest_Robbo
Guest
Quote
2024-12-05 00:37:28

Hi 'kaelgodoy',

I tried adding new scenes on the fly using available C++ methods but it didn't work out too well as had unintended consequences so instead added the OtherDocument method instead which work fine if you saw that video recently or not..

That way you can load another ccb file if you like but its actually designed for a menu system.

You could create a lot of partly empty scenes and load textures into them during runtime when needed is one solution for loading time and memory usage. You could also delete any no longer textures needed (I will add this API soon).

OR

You can just stick with the standard ccbSwitchToCCBFile and it will delete textures and start again (except when texture name ends with '0')


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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