Hi,
On 14.05.2012, at 17:50, Scalatron wrote:
> Regarding the rendering: have you already done anything in that direction, or are you still thinking about it?
nah, I just looked at the code a bit and thought that it would be a rather easy change to make. So I was just thinking about it.
> The reason I'm asking is because I'm thinking about a few pretty significant refactorings that would probably be good to complete before making that kind of change.
> The primary thing I'm after is to make the games themselves (such as BotWar) pluggable, so that other people can write their own games, using Scalatron merely as a multi-user/plug-in/IDE platform.
> I've started along this path in the v2 branch on github, but have since made so many changes on the v1 branch that I'm thinking about starting over again... :-)
Sure, go ahead, I don't have too much time on my hands right now anyways.
> One thing that may be nice would be to decouple the renderer completely into another process, making the server permanently headless (already an option: "-headless yes") and allowing game display on a (or even several) different machines.
> One way to do this would be to implement the Tournament resource of the RESTful API, pull the current/most recent tournament game state as JSON and render it in the remote process.
> This could even be done in a browser; it is probably actually be my preferred option. Very easy, too, with HTML5.
I am not so sure about that the benefit justifies the cost (of implementation and runtime). Process switches waste precious resources :) I like the model as it is now. Also keeps things simple for the admin + users.
> Note that one of the drawbacks of a completely temporally decoupled renderer is that you can no longer single-step through the game for debugging purposes.
The keys could just slow the game calculation down. That way you could still watch the game step-by-step.
For what it's worth, I didn't have to do any (step-by-step) debugging at all when I programmed my bot. Because the control function can be pure, the whole bot is very easily testable, which is what I (and my colleagues) did. Worked great and spared us the debugging.
> Maybe one way to make this optional is to turn the current option of slowing down the renderer (keys 1...9) into a two-way option:
> - 1..4 accelerates the simulator (20,10,5,2 sim steps per frame)
> - 5 is 1:1 sim/render stepping
> - 6...9 slows everything down (min. time per cycle 10, 250, 750, 2000 milliseconds).
> I must admit that I'm a little weary decoupling the in-process rendering completely from the simulation, for said reason.
>
> Maybe the best thing would be a combo of the two options:
> - Step 1: Tournament state via REST, with browser-based rendering - temporally completely decoupled, obviously
> - Step 2: in-process rendering with options for gearing/slowdown
> This would significantly remove the number of moving parts, eliminate many of the conflicts with my planned refactoring and add A LOT of value (remote display - very nice!).
> What do you think?
As stated above, I am not so fond of the process separation. But that's just me.
We did remote display via VNC which worked great. :)
The foremost goal should probably be to keep things as simple as possible. As soon as there is networking involved, there _will_ be people who will have problems.
Just my 2c.
Andreas