Jump to content

C++ vs Lua


Yue
 Share

Go to solution Solved by Josh,

Recommended Posts

  • Solution

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.

  • Like 1
  • Upvote 1

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

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;
}

 

FPS.png

  • Like 1

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

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. 

  • Like 2

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

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.

 

  • Like 2

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

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.

Rendimiento.thumb.jpg.142f3b4b113a3ab076db633142a79acf.jpg

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

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. 😎

  • Like 1
Link to comment
Share on other sites

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.

 

  • Like 1

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

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.

  • Like 1
  • Upvote 2

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...