[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Deterministic hashing for lua tables
- From: Isaac Dupree <contact@...>
- Date: Mon, 30 Jan 2012 20:24:12 -0500
Hi Holly,
I've been contemplating a fully deterministic Lua. Your post[1] on
lua-users was the closest thing I found, so I'm asking what progress
you've made.
I'm probably going to be hacking on Lua's code anyway, and I'd be happy
to do what I can to implement this.
My use-case: I'm writing a game/simulation where two networked players
can execute the same user-written script, such as an AI for someone's
robot. I desire to guarantee that the two players' simulation states
will not go out of sync. Even if they write stupid/malicious scripts.
I wish the determinism to apply even across
serialization/deserialization (e.g. Pluto[2]), so that the game can be
saved/loaded at any time, new players can be added to a networked game, etc.
(To protect from stupid/malicious scripts I'll also have to implement
processor-time and memory usage limits for Lua, and make sure that
they're deterministic from the simulation's point of view. I think the
limits will be per-robot. Each robot could have its own lua_state to
make the accounting easier. Perhaps a count of bytecodes executed, and
some reasonable count of reachable data, is the way to go. And I'll do
something about worst-case hash-table performance.)
[1] http://lua-users.org/lists/lua-l/2011-12/msg00441.html
[2] http://lua-users.org/wiki/PlutoLibrary