>From my experience LUA is the way to go when it comes to c++ embedding. This will also allow user mods in an eventual future :D
A nice solid clean core implementation in c++ and then lua for behaviour and expermentation is a good base to work from. 2014-12-28 11:55 GMT+01:00 Stéphane Magnenat <[email protected]>: > Hello, > > I'm usually not a big fan of Lua as a language, but I have to admit >> this is pretty impressive. >> > > I would also prefer a Pythonic syntax, but I did not find any Python > implementation that was as embeddable (i.e. easy to use from host code > and to modify) and mature as Lua. > > I just don't understand why you say glob would require recompiling >> Lua with integer instead of doubles. Is it only for performance, or >> is there another reason? >> > > In Glob2's network, all clients run the same code and only exchange > orders from the players, so the execution of the code must be > deterministic. Floating point execution is not fully specified (in IEEE > 754 the least-significant bits are left to the implementation), and so the > same code executed on different computers will produce in different results > after a while, leading to a de-synchronisation. This can even appear with > two similar CPUs but with different microcode versions. > > As a comparison, a lot of things can be serialized in Python, but it >> is not to not being trustable (see the warning at [1]). And >> sandboxing is far from being usable. Actually, there has been an >> attempt to make a sandbox for CPython (the main Python interpreter), >> but the author gave up. [2] Pypy (a Python interpreter written in a >> subset of Python that can be compiled) also has a sandbox mode, but >> it is not yet ready to be embedded. [3] >> >> [1] https://docs.python.org/3/library/pickle.html >> > > [2] https://lwn.net/Articles/574215/ > >> [3] http://pypy.readthedocs.org/en/latest/sandbox.html >> > > Yes, that was my impression as well. The Python bytecode in CPython looks > more complex to interact with from the host code than Lua, plus the code > base of CPython seems harder to read and modify. There are smaller Python > implementations around, but none seems really mature (no documentation, > etc.). On the contrary, Lua was designed for embedding and thus seems > nicely structured for being modified. Thus my strategy is to go modify the > Lua standard libraries to provide hard sandboxing, as we have a > responsibility to ensure that no user-created content can get out of the > game and spy or do harm to the player's computer. The main element is to > route all IO operations through glob2's virtual file system and maybe to > remove some calls that give information on the underlying system such as > os.tmpname. > > kind regards, > > Stéphane > > -- > http://stephane.magnenat.net > > > _______________________________________________ > glob2-devel mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/glob2-devel >
_______________________________________________ glob2-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/glob2-devel
