Yue Posted July 11, 2023 Share Posted July 11, 2023 Thinking about my project, it seems that I am evaluating to try it in C++, because of the performance. Do you really advise me to do that? Quote Link to comment Share on other sites More sharing options...
Alienhead Posted July 11, 2023 Share Posted July 11, 2023 What performance? as far as I can tell it's negligible. Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Solution Josh Posted July 11, 2023 Solution Share Posted July 11, 2023 In Leadwerks, C++ will probably be a bit faster. In Ultra, it probably won't make any difference because all your game logic runs on its own thread. 1 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Yue Posted July 11, 2023 Author Share Posted July 11, 2023 A motivation to learn C++- Quote Link to comment Share on other sites More sharing options...
Yue Posted July 12, 2023 Author Share Posted July 12, 2023 I have a better load of frames per second, going from 220 to almost 300, and a better render time in a simple scene. This makes me feel like a programmer, everything I learned with Lua is here. #include "App.h" #include "CWindow.h" using namespace Leadwerks; int main(int argc, const char* argv[]) { CWindow window(800, 600); Context* context = Context::Create(window.Get()); World* menu = World::Create(); Camera* camera = Camera::Create(); Model* cube = Model::Box(); Light* sun = DirectionalLight::Create(); cube->SetPosition(0, 0, 3); while (!window.Get()->Closed()) { cube->Turn(0, 1 * Time::GetSpeed(), 0); Time::Update(); menu->Update(); menu->Render(); context->DrawStats(0, 0); context->Sync(false); } return 0; } 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 12, 2023 Share Posted July 12, 2023 What's your target FPS for the final game? Quote Link to comment Share on other sites More sharing options...
aiaf Posted July 12, 2023 Share Posted July 12, 2023 I think you should continue with lua and finish the game. One disadvantage of c++ can be the build times. You will be much faster to experiment in game with lua. Depends on what is your goal. 3 Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
SpiderPig Posted July 12, 2023 Share Posted July 12, 2023 Yeah it depends greatly on the scope of the game your building. 1 Quote Link to comment Share on other sites More sharing options...
Yue Posted July 12, 2023 Author Share Posted July 12, 2023 13 hours ago, aiaf said: I think you should continue with lua and finish the game. One disadvantage of c++ can be the build times. You will be much faster to experiment in game with lua. Depends on what is your goal. I think you are absolutely right, since I know this I have focused more on learning things and the strange thing is that with what I have learned in Lua, I feel that the step to C++ is not so complicated and I find it epic to program in C++. In the end the project is not very advanced, it is like a pre-alpha. And if the compilation times are tedious especially when I come from environments like Lua, or blitzbasic products, but for me it is still something exciting to learn new things. 2 Quote Link to comment Share on other sites More sharing options...
Yue Posted July 12, 2023 Author Share Posted July 12, 2023 12 hours ago, SpiderPig said: Sí, depende en gran medida del alcance del juego que construyas. An open world full of rocks on mars I think would be a good approach to move to C++, however I will do some more testing in C++ to see how this goes. But it is really exciting for me to understand c++ with the basics I have learned while programming in Lua. 2 Quote Link to comment Share on other sites More sharing options...
Yue Posted July 13, 2023 Author Share Posted July 13, 2023 This is encouraging, the performance if I am looking at it. In this scene in Lua the performance was down to 150 frames per second. It is a character controller, and I have to assume because I manage it from C++ code and not from the map editor and lua script. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 13, 2023 Share Posted July 13, 2023 I found C++ in Leadwerks a lot faster than Lua. If your making a small game then Lua is fine and a lot quicker to get results. But if you want a large open world then C++ will be faster and give you more access to underlying commands in Leadwerks. It's C++ all the way for me. 😎 1 Quote Link to comment Share on other sites More sharing options...
Yue Posted July 13, 2023 Author Share Posted July 13, 2023 16 minutes ago, SpiderPig said: Encontré C++ en Leadwerks mucho más rápido que Lua. Si estás haciendo un juego pequeño, entonces Lua está bien y es mucho más rápido para obtener resultados. Pero si quiere un gran mundo abierto, entonces C++ será más rápido y le dará más acceso a los comandos subyacentes en Leadwerks. Es C++ todo el camino para mí. 😎 You're absolutely right, I think for me it's a breakthrough, I'm taking a leap that initially I never thought to do it, moving to C++ is a milestone. And everything I have learned in lua, is not in the trash can. The weird thing in C++ is the compile times, but this is more because in Lua this was flying. On the other hand, it is necessary to go slower in the coding, in my case, because I am learning things like -> or to put a semicolon if not everything does not compile. But it's really fun. 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 13, 2023 Share Posted July 13, 2023 Lua is good to learn with. Looking forward to seeing what you achieve! 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted July 13, 2023 Share Posted July 13, 2023 The engine commands won't run any faster in C++ than in Lua. Physics and graphics will run at the same speed, it's just your own game code that executes faster. 1 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.