Abstract
Implementing multi-player networked games by broadcasting the player’s input and letting each client calculate the game state -- a scheme known as *lock-step simulation* – is an established technique. However, ensuring that every client in this scheme obtains a consistent state is infamously hard and in general requires great discipline from the game programmer. The thesis of this pearl is that in the realm of functional programming – in particular with Haskell's purity and static pointers – this hard problem becomes almost trivially easy.
We support this thesis by implementing lock-step simulation under very adverse conditions. We extended the educational programming environment CodeWorld, which is used to teach math and programming to middle school students, with the ability to create and run interactive, networked multi-user games. Despite providing a very abstract and high-level interface, and without requiring any discipline from the programmer, we can provide consistent lock-step simulation with client prediction.
Supplemental Material
Available for Download
Artifact: A virtual machine (VirtualBox/Vagrant box) with a running version of the CodeWorld server.
- ECMA International. 2015. ECMAScript Language Specification (6th ed.). Geneva. http://www.ecma-international.org/ ecma-262/6.0/ECMA-262.pdfGoogle Scholar
- Elijah Emerson. 2009. How to make Box2D more deterministic? (2009). http://www.box2d.org/forum/viewtopic.php?t= 1800&start=10#p16662Google Scholar
- Jeff Epstein, Andrew P. Black, and Simon L. Peyton Jones. 2011. Towards Haskell in the cloud. In Proceedings of the 4th ACM SIGPLAN Symposium on Haskell, Haskell 2011, Tokyo, Japan, 22 September 2011, Koen Claessen (Ed.). ACM, 118–129. DOI: Google ScholarDigital Library
- Ben Lippmeier. 2017. gloss. http://gloss.ouroborus.net/ . (2017).Google Scholar
- Simon Marlow (Ed.). 2010. Haskell 2010 Language Report.Google Scholar
- Forrest Smith. 2011. Synchronous RTS Engines and a Tale of Desyncs. (2011). https://blog.forrestthewoods.com/ synchronous-rts-engines-and-a-tale-of-desyncs-9d8c3e48b2beGoogle Scholar
- Luite Stegeman and Hamish Mackenzie. 2017. GHCJS. https://github.com/ghcjs/ghcjs . (2017).Google Scholar
- Mark Terrano and Paul Bettner. 2001. 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond. In Proceedings of the 15th Games Developers Conference. http://www.gamasutra.com/view/feature/3094/1500_archers_on_a_ 288_network_.phpGoogle Scholar
Index Terms
- Lock-step simulation is child's play (experience report)
Recommendations
Minority report: Computer Science skills perceived by students in different disciplines
Koli '08: Proceedings of the 8th International Conference on Computing Education ResearchSoftware skills are more and more required within different technical disciplines and the skill requirements vary through time and discipline. Within the Computer Science (CS) discipline the evolution is naturally rather well understood and adapted by ...
Technology workshops by in-service teachers for pre-service teachers
SIGUCCS '01: Proceedings of the 29th annual ACM SIGUCCS conference on User servicesThis project was an initiative through university courses to have graduate in-service teachers, who have learned the use of technology for classroom instruction, offer workshops to undergraduate pre-service teachers. The goals of the project were two-...
Experience report: CS1 for majors with media computation
ITiCSE '10: Proceedings of the fifteenth annual conference on Innovation and technology in computer science educationPrevious reports of a media computation approach to teaching programming have either focused on pre-CS1 courses or courses for non-majors. We report the adoption of a media computation context in a majors' CS1 course at a large, selective R1 institution ...
Comments