Nic got Doom more or less working...
...not sure how you'd approach it from scratch. Sounds like a job for C though, not Lua!