Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

An arcade game should be organized using a game loop. Just make the game loop update the state of the entire game world each frame. This makes it relatively easy to write most of the game in a functional fashion. (You may have to have n "phases" in your game loop. Movement phase, collision resolution phase, etc.)

The OP is accustomed to thinking only in terms of mutating state. He can't get away from it. He wouldn't have had all of these problems if he'd just done ye olde AI class with turn-based board game project in Lisp. (With a prof who set a coding standard for pure functional Lisp.)



This same guy also wrote an article describing the exact same functional style game loop that you are describing:

http://prog21.dadgum.com/23.html


I stand corrected. He knows his stuff already. I'll reread his OP.


How do you solve the problems he mentioned in his followup post? He seems to be saying that there are a lot of people going on about how easy it is but no examples beyond simple games.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: