can we go back to c++
- stormchaser3000
- Member
- Posts: 422
- Joined: Sun Oct 06, 2013 21:02
- GitHub: stormchaser3000
can we go back to c++
i had an idea. we may be able to boost the speed of the game if we went back to having all the nodes and items for he default minetest_game mods recoded in c++ and put into the main engine. and if this is posibl can we keep the modding api in so we can still mod the game.
Last edited by stormchaser3000 on Sat Jan 04, 2014 14:48, edited 1 time in total.
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Doesn't make much difference, other than loading times.
The only thing that slows the code down is the transition from C(++) to Lua (and back) and the Lua execution speed.
Say there is a mod called Foo. This mod only adds nodes to the game, and a few tools. No abms, no global ticks, no on_punch functions. Once the mod is loaded, the lua code will never be called again. The items in the mod are added to a c(++) table, so there is no need to go to the lua code.
However, when you add abms and global ticks, this all changes.
A year ago I made a finite liquid mod in Lua. It runs okay, but it was too slow to convert all the sea into finite liquid. This is because it is constantly running abms.
Then proller made the C(++) patch version. While it technically still uses abms, they are c(++) abms, so the transfer to lua is never made.
Minetest_game does not have any content in it that is too heavy for lua, and slows it down too much. It does not have many abms. The sort of things that might be useful having in c(++) is:
So in conclusion: there is no need to transfer blocks in to c(++) code from lua; there would be no speed benefit. However transferring abms and global ticks would give a speed benefit.
Note: that I wrote c(++) rather than c++, as quite a lot of the code is in c style.
Note2: If I am wrong, please correct me
The only thing that slows the code down is the transition from C(++) to Lua (and back) and the Lua execution speed.
Say there is a mod called Foo. This mod only adds nodes to the game, and a few tools. No abms, no global ticks, no on_punch functions. Once the mod is loaded, the lua code will never be called again. The items in the mod are added to a c(++) table, so there is no need to go to the lua code.
However, when you add abms and global ticks, this all changes.
A year ago I made a finite liquid mod in Lua. It runs okay, but it was too slow to convert all the sea into finite liquid. This is because it is constantly running abms.
Then proller made the C(++) patch version. While it technically still uses abms, they are c(++) abms, so the transfer to lua is never made.
Minetest_game does not have any content in it that is too heavy for lua, and slows it down too much. It does not have many abms. The sort of things that might be useful having in c(++) is:
- Mobs
- Projectiles, entities
- Anything that uses tons of abms and global ticks
- Mapgen (although less important now, with voxelmanip)
So in conclusion: there is no need to transfer blocks in to c(++) code from lua; there would be no speed benefit. However transferring abms and global ticks would give a speed benefit.
Note: that I wrote c(++) rather than c++, as quite a lot of the code is in c style.
Note2: If I am wrong, please correct me
Last edited by rubenwardy on Sat Jan 04, 2014 20:17, edited 1 time in total.
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
http://luajit.org/ext_ffi_tutorial.htmlaldobr wrote:what could be done is a binary modding api, making the lua interpreter one module of said api and allowing people to mod using any language...
Notice: I was told that this is very slow. Don't use it and disregard this post.
Who is online
Users browsing this forum: No registered users and 12 guests