Client-Side Lua API - Animated mobs etc.

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

Client-Side Lua API - Animated mobs etc.

by Jeija » Sun Oct 28, 2012 14:41

An idea: We might implement client-side modding support. The server-side modding is just fine for most mods, but first of all mobs are painfully slow.
A client API can be used for e.g. drawing 2D pictures on the player's screen, render screenshot textures for blocks, fast entities (chest lid, move player with minecart, mobs, rays/bullets --> entities), manipulate camera...
The client must be synchronized with the server (shouldn't be too hard)
and the code could still be downloaded from the server so there is no need to install mods when playing on servers (or should there be? --> security)

This is my proof-of-concept (don't expect anything usable, it's just an experiment):
https://github.com/Jeija/minetest/tree/clientside_mods
Last edited by Jeija on Fri Mar 15, 2013 15:29, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sun Oct 28, 2012 15:23

This could be useful. Transfering some code to client and execute it might reduce lag issues.
 

User avatar
xyz
Member
 
Posts: 449
Joined: Thu Nov 10, 2011 14:25

by xyz » Sun Oct 28, 2012 17:55

Jeija wrote:and the code could still be downloaded from the server so there is no need to install mods when playing on servers (or should there be? --> security)

I think disabling os and io modules should be fine (not sure though).
 

User avatar
RealBadAngel
Member
 
Posts: 556
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Fri Nov 02, 2012 18:45

shouldnt such stuff be built in? we are talkin bout basic things that r not workin as they should be.
its not the matter of modding but fixin issues.
 

rarkenin
Member
 
Posts: 668
Joined: Tue Nov 20, 2012 20:48

by rarkenin » Sun Dec 16, 2012 04:53

xyz wrote:
Jeija wrote:and the code could still be downloaded from the server so there is no need to install mods when playing on servers (or should there be? --> security)

I think disabling os and io modules should be fine (not sure though).


What is needed is a mod-accessible database engine of sorts, since mods today are dependent on datafiles for things that can;t be done in one node. Some kind of virtualized SQLite or access to a central MySQL database with limitations imposed.
Admin pro tempore on 0gb.us:30000. Ask me if you have a problem, or just want help.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.
 

User avatar
Strikeboba
Member
 
Posts: 19
Joined: Fri May 18, 2012 01:31

by Strikeboba » Sat Jan 26, 2013 09:09

I can help but be aware that i am busy studying C++ and makeing my own minetest modding program
I live for peace,building and friends My Mods:Upgrade Mod 1.0
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Sat Jan 26, 2013 10:18

I'm not sure anymore if this actually is the direction we want to go. Maybe there's more potential in coding the whole client in c++, especially when targeting slower PCs.
Redstone for minetest: Mesecons (mesecons.net)
 

hdastwb
Member
 
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb

by hdastwb » Sun Jan 27, 2013 19:37

Every mod that I've wanted to make lately has been impossible due to the limitations in using formspec; I think that mods need to have some functionality to add custom UI beyond formspec, and since that is all client-side it would necessitate a client-side API.

That said, I think that minetest could do to move more of the game logic into the engine; mobs are painfully laggy when implemented as mods and would benefit greatly from more engine support. Carts have already gotten engine support, and we've went from an unbearably laggy and buggy carts implementation to a more bearable, responsive, and much less buggy one (though I think there are some things that could still use some work…).
 

rarkenin
Member
 
Posts: 668
Joined: Tue Nov 20, 2012 20:48

by rarkenin » Sun Jan 27, 2013 22:22

What we need are commands for manipulating nodes that aren't sent to the server, and another set of commands for doing something and sending it to the server. Important things to implement are rate limiting and for the server to be able to disable mod-sent messages such as node_dig if the server autodetects vandalism, or as per the wish of the server owner.
Admin pro tempore on 0gb.us:30000. Ask me if you have a problem, or just want help.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Mon Jan 28, 2013 19:30

hdastwb wrote:Every mod that I've wanted to make lately has been impossible due to the limitations in using formspec; I think that mods need to have some functionality to add custom UI beyond formspec, and since that is all client-side it would necessitate a client-side API.

That said, I think that minetest could do to move more of the game logic into the engine; mobs are painfully laggy when implemented as mods and would benefit greatly from more engine support. Carts have already gotten engine support, and we've went from an unbearably laggy and buggy carts implementation to a more bearable, responsive, and much less buggy one (though I think there are some things that could still use some work…).


Carts have gotten engine support? When did this happen? I can't wait for more responsive carts.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
RAPHAEL
Member
 
Posts: 627
Joined: Tue Nov 01, 2011 09:09

by RAPHAEL » Tue Jan 29, 2013 04:29

My 2c is that mobs should be implemented in C++. Or at least the bulk of it with mods being able to make new mods to use the C++ code. (not a coder but seems logical that mobs should be done in C++)
"Before you speak, ask yourself: Is it kind, is it true, is it necessary, does it improve upon the silence?"
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
 

hdastwb
Member
 
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb

by hdastwb » Tue Jan 29, 2013 05:09

Temperest wrote:
hdastwb wrote:Every mod that I've wanted to make lately has been impossible due to the limitations in using formspec; I think that mods need to have some functionality to add custom UI beyond formspec, and since that is all client-side it would necessitate a client-side API.

That said, I think that minetest could do to move more of the game logic into the engine; mobs are painfully laggy when implemented as mods and would benefit greatly from more engine support. Carts have already gotten engine support, and we've went from an unbearably laggy and buggy carts implementation to a more bearable, responsive, and much less buggy one (though I think there are some things that could still use some work…).


Carts have gotten engine support? When did this happen? I can't wait for more responsive carts.


As of 4.4, an the ability to attach the player to things was added to the Lua API. Thus, the carts mod was re-implemented to take advantage of the functionality. I'm not sure if they've finished adding features back in from the old version, but, over the old version that seemed to use the teleportation mechanism to transport the player, the improvements are markable.

If you have 4.4 installed and download the latest version of the carts mod, you should be set. Though, bear in mind that the physics in these versions has gotten a bit more accurate, so you'll probably have to power the cart with periodic mesecon torches in order to go anywhere that's not downhill…
 

User avatar
Mgdie
Member
 
Posts: 25
Joined: Sun Dec 09, 2012 22:03

by Mgdie » Sat Feb 02, 2013 03:15

Moving to luajit ?
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Sat Feb 02, 2013 06:06

I heard from several people that LuaJIT is not really faster or even slower.
Redstone for minetest: Mesecons (mesecons.net)
 

madarexxx
Member
 
Posts: 144
Joined: Sat Aug 04, 2012 06:49

by madarexxx » Sat Feb 02, 2013 15:55

Can you compile test with it (according to their website you need just link to luajit, instead of lua5.1 library). I'm not a big pro in programming, so i don't know how can i make it :)
p.s. if you make it, upload binaries (linux or windows) please
Sorry for my bad English, please help me learn it - correct my worst mistakes :)
 

hdastwb
Member
 
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb

by hdastwb » Mon Feb 04, 2013 00:17

madarexxx wrote:Can you compile test with it (according to their website you need just link to luajit, instead of lua5.1 library). I'm not a big pro in programming, so i don't know how can i make it :)
p.s. if you make it, upload binaries (linux or windows) please


I've been running LuaJIT Minetest with my testing version for the last couple weeks! I really haven't noticed the difference much, but I'm on a higher-end machine so I don't have much lag in singleplayer anyway…

It is more or less fully compatible with the standard Lua distribution and compiled and ran perfectly by just changing the linking procedure in the CMake files and removing some check in serialize.lua that looked for quirky escaping rules. However, the main issue is building LuaJIT itself; I linked my version dynamically against my system-wide installation of the library. LuaJIT is very easy to build when you can just use the automake tools, but it has a somewhat non-standard build procedure and will not integrate as well with CMake as the standard distribution does. In fact, I cannot figure out at all how to convince CMake to compile LuaJIT properly, but once you've got a compiled version it works pretty smoothly.

So, Minetest does play well (in singleplayer, mind you; I haven't hosted any servers yet) with LuaJIT, though the fact that LuaJIT doesn't seem to mesh well with the CMake build system will hinder packaging. I doubt that Linux binaries would be all that useful since there are so many different Linux systems, almost everything in Linux is dynamically linked, and you haven't specified your architecture (I'm running x86_64, if you've got 32-bit Linux you're likely to really confuse your processor by running 64-bit programs). However, I may look at putting together a MinGW win32 build the next time that I'm Windows-side…

I'm also not really aware of any cases in which LuaJIT is slower than standard Lua; from what I understand, the JITing makes the pure Lua indisputably faster and the native linking is much more direct which should also aid in the speed of library-intense things like Minetest mods. I would be interested to hear where it might be slower, though…
 

User avatar
Menche
Member
 
Posts: 994
Joined: Sat Jul 02, 2011 00:43

by Menche » Mon Feb 04, 2013 03:48

I think maybe the people who said LuaJIT is slower may have confused LuaJIT with pre-compiled Lua bytecode? The precompiled bytecode files are usually larger than the normal Lua scripts, which might make them load slower. Precompiled bytecode is not the same thing as LuaJIT.
Last edited by Menche on Mon Feb 04, 2013 03:48, edited 1 time in total.
An innocent kitten dies every time you top-post.
I am on the Voxelands Forums more often than here.
Try Voxelands (forked from Minetest 0.3) by darkrose
 

hdastwb
Member
 
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb

by hdastwb » Mon Feb 04, 2013 03:53

Menche wrote:I think maybe the people who said LuaJIT is slower may have confused LuaJIT with pre-compiled Lua bytecode? The precompiled bytecode files are usually larger than the normal Lua scripts, which might make them load slower. Precompiled bytecode is not the same thing as LuaJIT.


And they're probably the same people who think Java is primarily a compiled language…
 

rarkenin
Member
 
Posts: 668
Joined: Tue Nov 20, 2012 20:48

by rarkenin » Mon Feb 04, 2013 21:14

Precompiled is longer load, faster execution. So, a longer server startup, but less lag once it starts.
Admin pro tempore on 0gb.us:30000. Ask me if you have a problem, or just want help.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.
 

madarexxx
Member
 
Posts: 144
Joined: Sat Aug 04, 2012 06:49

by madarexxx » Tue Feb 05, 2013 06:41

hdastwb, i've 32-bit LMDE, and 32-bit W7 :)
Sorry for my bad English, please help me learn it - correct my worst mistakes :)
 

hdastwb
Member
 
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb

by hdastwb » Mon Mar 04, 2013 03:39

I've been in Windows all day in order to download software; I've also had a chance to compile Minetest with LuaJIT. I've uploaded the binary to my site here:
http://hdastwb.heliohost.org/minetest-0.4.4-win32-jit.zip

I haven't noticed much of a difference, but I haven't found anything (besides some of the escaping tests in serialize.lua) that broke either.
 

User avatar
RealBadAngel
Member
 
Posts: 556
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Fri Mar 15, 2013 10:25

search algorithm on 100 nodes graph depth, loop: 100 times
(one technic batbox, 100 wires connected,20 solar panels. search repeated 100x inside one abm call)

time of execution (LuaJIT):
1.32
1.1
1.45
1.39
1.53
1.55
1.52
1.5
1.29
1.16
1.36
1.3
1.26
1.42
1.4
1.37
1.38
1.62
1.37
1.54

total time: 27.83s
Average time: 1,3915s


time of execution (Lua):
2.68
2.75
2.71
2.97
3.02
3.29
3.06
3.35
3.05
3.26
3.39
3.12
3.08
3.22
3.26
3.31
3.32
3.12
3.11
3.46

total time: 59.42s
Average time: 2,971s
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Fri Mar 15, 2013 15:47

Those are some impressive numbers.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Fri Apr 05, 2013 20:03

I thought about this but wasn't sure. Since in most cases we can code things in the client which are triggered by the server API. I'm not sure exactly what allowing LUA on the client could achieve past that, and it could risk complicating things more for no additional gain.

Currently I'm neutral about this. I'd only suggest such a thing if there's a clear case of something that can't be coded in the client and called with server LUA, otherwise I see it doing more harm than good.
 


Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 23 guests

cron