blakewford wrote:I had a little trouble keeping my browser focused on the screen element so that control input would be recognized.
Should be fixed now, thanks!
blakewford wrote:Can you elaborate a little on the tech behind your browser transition? Is all of the code now client side, or does the solution require server deployment? Did you use a cross compiler for C#?
It's all client-side, if you do a page save you can run it locally.
I did the port by hand but it wasn't as much work as I thought it was going to be, the trick was to first get the original C# code as close to Javascript as I could in order to take advantage of the compiler's error checking instead of waiting for things to blow up at runtime in the browser. First step was to strip away everything that wasn't part of the core engine. Next step was to change any code that relied on C# language-specific features i.e. op code handler attributes (which I replaced with a lookup table along with the handlers themselves) and index operators (which I replaced with get/set/get_bit/set_bit functions); this was probably the most time consuming part of the port but it was just a matter of working through the errors that cropped up when I tried to compile. One of the last stages was replacing all scalar types with doubles, since that's all javascript uses; this created a compile time error everywhere I did an array lookup so I put a cast in all those places and did a project-wide delete of "(int)" when it came time for the actual port.
A few other things helped...I did everything in a separate local branch and made frequent commits along the way so that if I discovered something had broken I could keep rolling back until I found the commit that caused it (although in the end I only had to do this a few times). I eventually reached a point where errors were occurring a few hundred thousand cycles into execution and the lack of an integrated debugger was making it difficult to track them down, so I modified the original C# code to check every single variable in the context after each cycle (RAM, flags, PC etc) and dump the changes to a log file. This took about 40 minutes to log 1 second of execution time but it only had to be done once and after that I knew the exact cycle that every single issue occurred on. If I were to do it all over again I would do this step first because tracking down the remaining bugs was trivial after that.
So yeah, maybe somewhere around 15 hours work all up but not too bad considering, and the code's now in a state where a port to Android/Java (say) would probably only take an hour or two. It'd be interesting to do that alongside a Xamarin version using the original C# code to see how they compare performance-wise.