I have never been to a game jam, but from what I gather you sit there and roll out a small game with other people in a (continuous) period of 24-48 hours, usually on a weekend. How can someone stay productive to do anything, let alone code a game, when they haven't slept in over a day? If you have successfully participated in one of these events, please shed some light for me.
How Are "Game Jams" Productive At All?
I think there are a number of benefits actually. If you are a professional programmer a game jam gives you a short reprieve from a project you have been / will be on for an extended period of time which is why major studios usually have their own in house game jams. A hobbyist like myself may actually get something done thus encouraging me to continue even though I have too many abandoned projects / ideas waiting to be made.
Also, you can get/bring/consume alcoholic beverages, so the focus is clearly on having fun working on a simple but crazy project with likeminded friends and/or strangers.
I've not been to any "game jams" but I have participated in a number of hackathons. Everything from 24 hours to 54 hours. No there isn't much sleep, but it can be highly productive due to the competition and being surrounded by so many other people all trying to do the same thing you are. Obviously it's not a level of productivity that can sustained over any real project.
I challenge the assumption that it's not possible to do work without getting any sleep. If you are healthy and well-rested prior to starting, you can definitely maintain a solid level of productivity for at least 40 to 50 hours, especially if you are with other people. In fact if you ask most people who have done this kind of stuff, or even if you have ever pulled two all-nighters in a row, you'll know that the relationship between "hours since last slept" and "productivity" is not at all linear. In my experience the following late morning is the hardest time where I feel most sleepy, after which fatigue goes away for many hours and productivity can get rather high (kind of like the Ballmer peak but with sleep deprivation). You know you are about to crash when euphoria sets in.
Don't push yourself too hard though, never take any meds to keep yourself awake, and you still need to sleep before and after the event.
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
In a game jam you usually don't have to write maintainable well structured code (although theres nothing stopping you). You just need to write the code that gets the job done. A lot of developers and designers seem to produce some really creative solutions to problems whilst in a sleep hazed fog. When reading the solution back in post mortem they think OMG did I actually write that but, at the time it worked and made people go wow.
How can someone stay productive to do anything, let alone code a game, when they haven't slept in over a day?
Sugar and caffeine. And sometimes taurine.
Also, most people don't stay awake that long when they're doing game jams. In my experience, usually people work from the early morning until midnight-ish and then sleep for 6-7 hours, then get right back to work.
Also really depends on the person, and often their age. Personally I don't have much of a problem being awake upwards of 30 something hours when I need to, staying awake and functional for 48 can be done when required, 60 hours of real functionality is about my limit, and I'm very likely to crash before that point. Especially without meals and lots of tea or coffee. Oh, and something to focus on and keep my mind busy.
The tricky part is pushing through that "I'm tired and I'm suppose to be in bed" that will hit you some time during your first night sometime around 18-24 hours of being awake. Usually for an hour or two things will not be going well for you, but then you basically just wake up again and go to a weary but still alert state.
If you can keep your mind busy, then it stays in an active state. It is once you let it out of that active state and allow it to become bored that you get in trouble.
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.