Python as a modding language
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Python as a modding language
in looking through lua, i found alot of similarities between it and python, aside from the fact that python can do object oriented stuff and lua cant.
also python has C bindings, like lua
so ingetrating it would be just as easy as lua.
i think that if Python were added as an extension(like lua), the quality of the mods coming out would be a whole lot better bcs of the ability of creating object oriented scripts.
What do you guys think, please post and vote. :)
also python has C bindings, like lua
so ingetrating it would be just as easy as lua.
i think that if Python were added as an extension(like lua), the quality of the mods coming out would be a whole lot better bcs of the ability of creating object oriented scripts.
What do you guys think, please post and vote. :)
I don't make messes, I just, er...disturb the local entropy!
Re: Python as a modding language
I vote for Python. Great language! I like it very much. Python scripts can be executed as is, by interpreter or being embedded like in many other software (including proprietary).
Re: Python as a modding language
I like python, but it would take a long time to add a scripting API to Minetest and I don't think that this worth it. Python is slow, compared to LuaJIT.
So even if 100 people vote for yes I think it won't happen because we don't have 100 developers to implement this.
Better to learn Lua. It's not a bad and hard to learn language
So even if 100 people vote for yes I think it won't happen because we don't have 100 developers to implement this.
Better to learn Lua. It's not a bad and hard to learn language
- rubenwardy
- Moderator
- Posts: 7036
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: London, United Kingdom
- Contact:
Re: Python as a modding language
Lua can do object oriented stuff
It just uses a prototype paradigm rather than a class paradigm - which isn't any less valid
Also, Python isn't a very good scripting language due to its architecture. Whilst it can be embedded, It's not designed to be embedded like Lua is. It would be better to make python call Minetest, and then do all the mod loading itself - but this will never happen
It just uses a prototype paradigm rather than a class paradigm - which isn't any less valid
Also, Python isn't a very good scripting language due to its architecture. Whilst it can be embedded, It's not designed to be embedded like Lua is. It would be better to make python call Minetest, and then do all the mod loading itself - but this will never happen
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
all of you guys are right, i just had an idea thats all
I don't make messes, I just, er...disturb the local entropy!
Re: Python as a modding language
I have concerns about the performance of OOP in Lua. I think it won't be as fast as a procedural approach (but it will still be magnitudes faster than Python)
If I have time I will make some experiments
If I have time I will make some experiments
Re: Python as a modding language
I regret. I hoped MT will use Python in future.
:-(
:-(
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
same here Sergey, same here :-(
I don't make messes, I just, er...disturb the local entropy!
Re: Python as a modding language
I want to show you why python will never be added to Minetest. I made a really simple test
a simple python loop with sinus needs on my PC 42 seconds
the same loop in lua needs ~ 15 seconds
But if I run this code with LuaJIT it needs just 8 seconds
a simple python loop with sinus needs on my PC 42 seconds
Code: Select all
import math
for i in range(1,100000000):
x = math.sin(i)
y = math.cos(x)
if x == y:
x = 0
Code: Select all
local sin = math.sin
local cos = math.cos
for i = 1, 100000000 do
local x = sin(i)
local y = cos(x)
if x == y then
x = 0
end
end
But if I run this code with LuaJIT it needs just 8 seconds
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
wow, i didnt know the diff would be that much
I don't make messes, I just, er...disturb the local entropy!
Re: Python as a modding language
And I think it is more with "normal" functions because in this example most time is spend in the math functionsThomasMonroe wrote:wow, i didnt know the diff would be that much
I randomly picked fannkuch-redux from this benchmark and run it with Lua, LuaJIT and Python3 on an AMD FX6300 hexacore CPU.
The Lua code runs on a single core, the Python code uses all 6 cores
This is the output from normal lua. I add a function to measure the runtime. The last number is the time in seconds
Code: Select all
markus@morpheus:~/dev/lua$ lua fannkuch-redux.lua 12
3968050
Pfannkuchen(12) = 65
1363.03
Code: Select all
markus@morpheus:~/dev/lua$ python3 fannkuch-redux.py 12
3968050
Pfannkuchen(12) = 65
373.94084000587463
Spoiler
Code: Select all
markus@morpheus:~/dev/lua$ luajit fannkuch-redux.lua 12
3968050
Pfannkuchen(12) = 65
99.183862
Any questions?
- Attachments
-
- Bildschirmfoto vom 2017-04-13 22-42-40.png (178.35 KiB) Viewed 2786 times
Re: Python as a modding language
Lua is very narrow-specilized — to embed in other software, and therefore it is not standalone. (well, I read it can be standalone, but it is not its purpose). While Python is general purpose language that can do anything with very-very rich included library. And it can be embeddable as well. Python is always in Top-5 of most popular languages, while Lua is... 26 according to TIOBE ratings.
Last edited by Sergey on Fri Apr 14, 2017 19:46, edited 1 time in total.
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
i think the question we need to ask is what type of computer are we saying is the average:
because if you are using a single or dual core computer lua is great, but once you get into the higher cores, python can really take the lead bcs it can maximize the use of all the cores.
because if you are using a single or dual core computer lua is great, but once you get into the higher cores, python can really take the lead bcs it can maximize the use of all the cores.
I don't make messes, I just, er...disturb the local entropy!
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
nvmd i read it wrong
I don't make messes, I just, er...disturb the local entropy!
Re: Python as a modding language
Performance isn't everything. You need feel passionate about language also. It's expecially true for open source projects. According recently published stack overflow survey lua was neither popular neither wanted. Personally I do dislike lua myself, feels limited and ugly language.
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
burli wrote:And I think it is more with "normal" functions because in this example most time is spend in the math functionsThomasMonroe wrote:wow, i didnt know the diff would be that much
I randomly picked fannkuch-redux from this benchmark and run it with Lua, LuaJIT and Python3 on an AMD FX6300 hexacore CPU.
The Lua code runs on a single core, the Python code uses all 6 cores
This is the output from normal lua. I add a function to measure the runtime. The last number is the time in secondsThis is the output of the python version. As you can see on the screenshot it really uses all 6 cores.Code: Select all
markus@morpheus:~/dev/lua$ lua fannkuch-redux.lua 12 3968050 Pfannkuchen(12) = 65 1363.03
And this is the output of LuaJITCode: Select all
markus@morpheus:~/dev/lua$ python3 fannkuch-redux.py 12 3968050 Pfannkuchen(12) = 65 373.94084000587463
If you divide the Lua time of 1363 by 6 you get the time a multicore version of Lua would need. And now divide the LuaJIT time by 6...Spoiler
Code: Select all
markus@morpheus:~/dev/lua$ luajit fannkuch-redux.lua 12 3968050 Pfannkuchen(12) = 65 99.183862
Any questions?
you also have to take into account that lua is not a very extensive language, python is.
and the reason for that is this:
and this:Sergey wrote:Lua is very narrow-specilized — to embed in other software, and therefore it is not standalone. (well, I read it can be standalone, but it is not its purpose). While Python is general purpose language that can do anything with very-very rich included library. And it can be embeddable as well. Python is always in Top-5 of most popular languages, while Lua is... 26 according to TIOBE ratings.
xeranas wrote:Performance isn't everything. You need feel passionate about language also. It's expecially true for open source projects. According recently published stack overflow survey lua was neither popular neither wanted. Personally I do dislike lua myself, feels limited and ugly language.
I don't make messes, I just, er...disturb the local entropy!
Re: Python as a modding language
You can write desktop apps in Lua, you can write webapps in Lua...
But for game modding is Lua the best choice
But for game modding is Lua the best choice
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
i have no doubt that lua is not great, but python is more popular of a language.
and those facts doesnt mean that python would not be bad for modding
and those facts doesnt mean that python would not be bad for modding
I don't make messes, I just, er...disturb the local entropy!
Re: Python as a modding language
You can use it for simple things. But for simple things you don't need a language like python. And for things where performance is important python is useless because it is to slow
I can't imagine a single usecase where python has an advantage over lua as scripting language in Minetest
I can't imagine a single usecase where python has an advantage over lua as scripting language in Minetest
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
maybe a bigger mod like mesecons, one that has a big amount of computation
I don't make messes, I just, er...disturb the local entropy!
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Python as a modding language
Since we're talking about this we should have support for some easily-embedded flavor of Scheme.
Every time a mod API is left undocumented, a koala dies.
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
what is Scheme?
I don't make messes, I just, er...disturb the local entropy!
Re: Python as a modding language
I think that's what he is talking about.ThomasMonroe wrote:what is Scheme?
- ThomasMonroe
- Member
- Posts: 286
- Joined: Tue Apr 04, 2017 16:21
- GitHub: ThomasMonroe314
- IRC: ThomasMonroe TMcSquared
- In-game: ThomasMonroe TMcSquared
- Location: Wherever I am at
Re: Python as a modding language
hmmm.... idk, it looks a whole lot like lisp, not very user friendly i dont think
I don't make messes, I just, er...disturb the local entropy!
Who is online
Users browsing this forum: No registered users and 1 guest