Is EDITOR of cocos creator open source?

You mentioned hot-loading, do you mean hot-loading c++ code, or resources?
It sound very interesting, and the quake-style console command :smiley:

Iā€™m an entry level dev, could you please share some thoughts or resources on those features for me to research?

Well hot-loading is sort of not an entry level thing, per se, but itā€™s not difficult, just probably not what Iā€™d start with - go make a few fun silly small games first :smiley:

Also, if you are using Creator then Javascript mitigates some of this since the entire game is scripted and doesnā€™t need to be recompiled. I do wish, however, that they added more update at run-time capabilities (maybe the latest version has improved in this area).

Hot-reloading that Iā€™ve used personally is resources/data only, not c/c++ recompiling on the fly (though that is also possible). So either the game code watches for file change notifications, or polls files for changes, or has UI to force reload of object(s).

The data is reloaded from file (ā€œentity_typename.dataā€) into the entity typeā€™s ā€œtemplateā€ of sorts (for those created in future) and applied across all current entity instances in the scene of that type. Various resources are referenced in this template: sounds, animation frames, textures, etc.

So at a high-level the texture is swapped, base property values are updated (each instance can apply modifier values to these), some other properties are updated in whole (overwritten), new animation frame sets are swapped with old, etc.

Iā€™ve added videos from handmade hero and j.blowā€™s Jai development for some current examples.

(sorry the rest is quite long, I should probably move this onto my blog and link)

====================================================

If I started a new game (medium to larger, year+ long project) Iā€™d want to start with some of these things right up front.

  • Hot reloading of data (maps, entity, localization, etc)
  • Heavily data-driven (again while scripting makes things easier initially, just making all data/properties modifiable without re-compiling gets you 80-90% of what scripting provides in most cases Iā€™ve worked with where Lua/JS was used)
  • In-Game UI to modify data/properties/scene as well that allows save/load (and versioning)
  • Quake-style console either hooked up to CCConsole commands, or written from scratch (or open source code)

====================================================

Handmade Hero Hot-Recompile in C99 (but c++ compiler for a few extra features)

For a look at how one can in fact do hot-reload of actual code while debugging (or technically in released build on platforms where executing data is allowed) you can check out handmade heroā€™s videos:
https://hero.handmade.network/episode/code/day022.

I think if you look at week 5 on this link those videos may also have some notes.
https://hero.handmade.network/episodes.

Note: I really donā€™t recommend this for anyone using cocos2d-x. If you really wanted this with c++ go use Unreal instead.

However, in general I do believe people think scripting languages are some golden ticket when in fact they really just wanted data files and an in-game editor with hot-reloading of these assets. An external editor can be used, but if you use an in-game editor with save/load then you donā€™t need the actual live reloading, for the most part.

====================================================

Coincidentally Jonathan Blow just did some streams on this exact very subject (see below). He doesnā€™t go into the platform layer file notification, but you can use libfswatch (https://github.com/emcrisostomo/fswatch) to hook up the capability. He also develops the console using immediate mode GUI ideas. You could use imGUI to use similar code, but otherwise youā€™d have to figure out how to best apply the state onto the cocos::ui::Widgets if you use them for the quake console.

One key aspect Iā€™ve found makes this easier with cocos2d-x is that we have game entity state separated from the Node* derived rendering instances. We update the Node* (et al) properties (position, sprite frame, etc) from the state. This means we only use Actions for menus and effects (particles, etc), but we do use the internal tween:: functions.

Cocos2d-x has a highly coupled data design, especially if you use Actions and such for manipulating state. We manually update spriteFrames for our animations by keeping frame index and anything else we need to set current sprite frame, for example. This allows us to hot-reload the prefix/frame-index-list and have a character on screen change to use the new animation texture/frames associated with the current running state (e.g. ā€œwalkingā€).

Quake Console
Cocos2d-x does have a limited console-like experience that can be used by telnetting into the game remotely. You can see the implementation in CCConsole.cpp

Archived Twitch Stream Videos
Disclaimer Notes:

  • These are long and unedited archives of him live streaming on Twitch
  • I wouldnā€™t watch straight through unless you were very interested in his new language
  • Heā€™s mostly streaming to show his progress on his new programming language JAI
  • He does a little C++ here and there when heā€™s debugging his JAI compiler

Hot-Reload Global State - variables, in his terms, you can extrapolate this out to loading data into a game entity
https://www.youtube.com/watch?v=Fl3CV7L6faQ&list=PLmV5I2fxaiCI9IAdFmGChKbIbenqRMi6Z&index=4 .

Initial Quake Console UI (6 parts - mostly again Iā€™d expect it to be uninteresting for you)
https://www.youtube.com/watch?v=jjTzVMq_M3M&list=PLmV5I2fxaiCI9IAdFmGChKbIbenqRMi6Z&index=6 .

Adding simple Commands
https://www.youtube.com/watch?v=N2UdveBwWY4&list=PLmV5I2fxaiCI9IAdFmGChKbIbenqRMi6Z&index=7 .

Playlist where these exist (some others)
https://www.youtube.com/playlist?list=PLmV5I2fxaiCI9IAdFmGChKbIbenqRMi6Z .

2 Likes