Hello! I’m a novice programmer looking to make a game like ultima online. (Mmorpg,3d Top down view, persistent world, level-less skill progression, dungeons, ext…) Is this possible with Codea? I have enough of a background in programming to do it. I’m just looking for the proper program to write in and I would love to do it all on the ipad. If not, please suggest alternatives. Thank you!
Hi, Codea unfortunately doesn’t allow sockets because of Apple policy, so any serious real time multiplayer is out of the question.
The multiplayer I wrote works with a php server and http.request, so it’s far from ideal.
I believe @Simeon said he would like to add bluetooth networking at some point, and maybe one day Apple will relax its policies
I’m also wondering if we could use Sockets using the Codea runtime ? This wouldn’t break Apple policies, correct?
Apart from that, Codea is a very powerful, so you can just about make anything with it.
Bit off topic, relating to @Xavier are there many additional libraries when using codea runtime? I havent looked in to it myself.
On topic: The only way you could do this at the moment would be to use either http requests and changing the data on a webpage which would be really sketchy or to make your own socket module using objective c
i just got Jason Rohrers The Castle Doctrine, and that comes with source. So I could check out that this is in fact using http for client-server communication. Granted, it is not quite the same, but http is an option for such games, as long as you don’t intend to transfer massive amounts of data in close to real time… maybe not for stuff like Ultima, but I reckon something Rogue like should be doable.
The real issue is that normal socket programming is poorly suited to the Codea Event model (or the event model is poorly suited to normal blocking socket activity - you pick). We actually had full-on normal Lua sockets in a beta, I think in some part due to my begging for it - and it didn’t work well, and was heinously difficult to use, because the standard lua socket libraries are blocking. That’s why with http.request in Codea you make a call, and register a callback - so that the event loop can continue drawing the screen.
http as a protocol isn’t ideal for gaming - it’s got a lot of overhead, frankly. There are ways people have of getting around that - websockets, long-poll, and the like - but they’re really trying to make a square peg fit into a round hole. If you want to do gaming (or rather - if you want low lag), you use raw sockets, or a gaming library that does - using http falls squarely into the “stunt/I-had-no-other-choice” category.
I have high hopes that in the future we’ll see TLL add support for either the IOS game libraries, bluetooth, or maybe even wrapping UDP in the same callbacks they added to http - all of which would go a long way toward addressing the communications needs of multiplayer gaming. (I could do a TON if I just had a way to send UDP packets, and register a callback for when they’re received - that would be my vote, but I know TLL tends to favor higher-level libraries, and I’m not sure that’s not a better way to go…)
while you are right about http not being particularly suited to games programming, it is not a complete fail, and there is no harm in trying. The worst that can happen is than you learn something.
Speaking about which, I am currently creating and implementing a simple and completely non-blocking socket Api for Lua (on Linux and Mac OS for starters), which came out of some experiments with using http as a client-server protocol for games. Interestingly enough I created this for the server side, to build a simple http server in lua, but it should work very well with codeas event driven model as well. It basically works by using polling, as I do not believe that callbacks are a suitable model for general purpose socket programming. Needs some more tests and a bit of thinking in some regions, but when I think it is reasonably done, I might just post a note here for people (who are not afraid of building a C module and who have a desktop lua) to play with. It does already run the simple http server, though