Hello all,
My question is mainly directed to those who have tried this approach. I understand that it is possible theoretically, but are there any examples of someone who has actually done it? In short, using C++ instead of Lua
Thanks
Hello all,
My question is mainly directed to those who have tried this approach. I understand that it is possible theoretically, but are there any examples of someone who has actually done it? In short, using C++ instead of Lua
Thanks
Hi @umen242_umen !
While one user (@sergey.lerg) has made a game using C++, and our Defold SDK, it is not something I would say is a smooth experience for most users.
We recognize that many users would like to use C++ for their game logic, and we’ve decided to add more functions to our sdk in order to facilitate that.
We have no ETA for this now though, but we’ll at least add a ticket, and we can start adding tasks there.
But what about minimal documention? how to do something with this ?
The Defold SDK is documented in the api reference. That’s a good start to acquaintance yourself with what is possible.
Then you also have the life cycle functions of an extension:
You’ll also have to look a lot on how we do things via our Lua api, so that you can understand what you need to do in your extension.
Look at the SpiralKit above for inspiration.
you have idea where is the link to the game or some info ? can’t find any thing specific on the game
are you talking about spiralkit ?
It seems that the only documentation on SpiralKit is that youtube video. Yield the floor to @sergey.lerg.
Is C++ wanted only for static typing? Static typing is not a panacea. Write tests for all your Lua code, this is the best way to assure coverage. TDD (test driven development). Tests can be written to run outside of Defold.
There must be other reasons for wanting C++, speed? something else?
speed, security
Are you certain that what you want to do can’t be achieved using Lua? There are plenty of Defold games made with Lua that run well even on low end devices
Could you please elaborate?
For me it’s static typing for easier and more maintainable development, easier refactoring, robust connections between modules. And much more types! Integers were really missing for me. Also clearer memory layout helps with some use cases but for most games it’s not that important.
As a bonus easier integration with other C/C++ libs and static analyzers help some times.
Documentation is missing for SpiralKit, but you should follow official Lua documentation and map it to my framework. Read the code and the example.
My two cents are that if your game is going to be so heavy that you need to consider the speed of the language itself then I would probably not use Defold, the type of games where the fact that it’s lua would make or break the game isn’t the type of game I would personally make in Defold.
If you are making the type of games Defold excel at and noticing that some part of your code is too slow even if it is perfectly optimized then I would consider breaking that individual algorithm out into C++. The team I worked with on one game did consider that at one point but in the end it was enough to do some clever optimizations to the lua code to have it run well with what we needed.
It’s important to let the engine handle as much as possible a good example is to use the go.animate and similar functions instead of moving the object manually by manipulating positions.
Unless you are trying to mine crypto or something, Defold has excellent optimization and runs very smooth and performant. It is always very fast, very low memory storage and cpu footprint. It has been enough for me even when my scripting was worse and inefficient when I began to learn in 2019. If you state your concern maybe it can be advised if there is a way to achieve it in Lua? Working in Lua has a much easier workflow with Defold