i've made text-based game in ruby can executed in terminal on unix systems using rvm. little project me learn language.
how can make game available others? maybe through using telnet?
what i'd love people copy , paste line of code terminal , logs them game.
how achieved telnet? or there better protocol these days?
(completely in dark subject, explain slowly, please)
the telnet
protocol simple gets, , text-only applications need open tcp/ip socket , start sending data.
the basic way convert program have use socket input , output rather stdin
, stdout
. manage more 1 connection, you'll need use threads.
at point overhead of using threads become significant. system eventmachine becomes better approach, though converting threaded code non-blocking asynchronous model non-trivial. need engineer target ground up.
a lot of classic text-based games days of internet use sort of approach. single process, single thread, uses low-level select
call multiplex input , output. happens in form of event loop.
the modern-day equivalent of telnet
, ubiquitous in time, websockets , things built on top of socketio. these run in browsers without additional software being required.
Comments
Post a Comment