Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Comments: Game server or App server?
Started by Develephant Jan 08 2014 12:08 PM

* * * * * 1 votes
50 replies to this topic
[TOPIC CONTROLS]
Page 2 of 3 1 2 3
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

marble68

[GLOBAL: userInfoPane.html]
marble68
  • Contributor

  • 170 posts
  • Corona SDK

FWIW - Apache HTTPD supports using Lua as a language, too.

http://httpd.apache.org/docs/trunk/mod/mod_lua.html

I use it for my game server. I do everything in Lua server side. Uses MOD_DBD - so you can use any datastore.

Basically, if you can do it on Apache HTTPD, you can do it with mod_lua.

What's really cool about this is since its httpd, you can throw your game server onto Heroku.

I run httpd locally with mysql under it - I use Lua Glider as my editor; and have the server files in the same editor.

I can use local file storage, etc.

Just thought I'd offer this up - Coronium could be a really nice object library to run under httpd if you saw fit. It's a heck of a lot easier than forklifting this from scratch.

The Coronium object could abstract from the storage and the presentation layer; rendering results in JSON (what I do, personally) or hand it to a view controller.

In apache, the flow happens in a function call "handle" that passes the request object in. You output to it (versus print), and return a status OK.

I do this today, now. Want to use your LUA code as REST server? See mod_rewrite.

RewriteRule ^/api.*$ /api/handler.lua?%{QUERY_STRING} [L]




Here's what the code looks like. My implementation is much more complex, but you get an idea of how easy it is.. and more importantly, flexible. You get Apache HTTPD + Lua. The rest is libraries.


 

function handle(req)

-- Do with the request object as you see fit here
-- such as


lfs = require("lfs")
md5 = require("md5")
zip = require("zip")
stringx = require("string_ext")
json = require("json_pure")
https = require("https")
ssl = require("ssl")
smtp = require("socket.smtp")
ltn12 = require("ltn12")
socket = require("socket")


local responseData = {}

responseData.verifyIwork = "Hello World!"

if req.method=='GET' then

responseData.value = 5
responseData.detail = {value=6, name="joe"}

elseif req.method=='POST' then

-- send to your data storage class here

elseif req.method=='PUT' then

-- take action on PUT method

elseif req.method=='DELETE' then

-- take action on DELETE method

end

req:puts( json:encode(responseData) )

return apache2.OK

end

It has it's quirks, since it's a (relatively) new Apache HTTPD feature - but building on top of Apache HTTPD is likely to go a long way.

You can also do things like this:
 

local myfunction


function myfunction(sTemp)


    return sTemp .. " altered"


end




function handle(req)


    local responseData = {}


    responseData.verifyIwork = "Hello World!"


    if req.method=='GET' then


        responseData.value = 5
        responseData.detail = {value=6, name="joe"}


        responseData.fromFunction = myfunction("testing")


    end
    
    req:puts( json:encode(responseData) )


    return apache2.OK


end


[TOPIC: post.html]
#27

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

@marble68 mod_lua was a almost a first choice, but I spent some time researching and the nginx implementation of Lua is production ready and much simpler IMHO.

 

But you are correct that the libraries are what will make it interesting. ;)

 

Cheers.



[TOPIC: post.html]
#28

marble68

[GLOBAL: userInfoPane.html]
marble68
  • Contributor

  • 170 posts
  • Corona SDK

So why not OpenResty?



[TOPIC: post.html]
#29

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

Of course OpenResty. :)

 

Coronium is more focused on being a library and server configuration that will give you the same power of something like Parse.  The other aspect is integrating systems like MySQL and PHP.  Of course Coronium gives the developer the power to use it without API restrictions, and allow for much more flexibility.

 

The push server, which is forthcoming, will be using PHP_GCM and easyapns as part of the stack.  The Coronium library will unify all of the pieces and make it very simple to have a powerful Lua application stack matched with a client side module.

 

The base stack will be open sourced as well.

 

Best.



[TOPIC: post.html]
#30

marble68

[GLOBAL: userInfoPane.html]
marble68
  • Contributor

  • 170 posts
  • Corona SDK

I've joined the google group because I'm very interested to see it in action and potentially contribute. I have some libs done that once I'm done with this project, I could potentially adapt into Coronium.



[TOPIC: post.html]
#31

marble68

[GLOBAL: userInfoPane.html]
marble68
  • Contributor

  • 170 posts
  • Corona SDK

I get it. Do you already have a git repository for the source?



[TOPIC: post.html]
#32

marble68

[GLOBAL: userInfoPane.html]
marble68
  • Contributor

  • 170 posts
  • Corona SDK

FYI - you might also reach out to the Corona Labs team  - see if they will grant you access to the source code to Corona Cloud - the solution they used to offer. There might be one or two things in there of value to you. It's on Git.



[TOPIC: post.html]
#33

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

@marble68 Yeah, I came on kind of late, so I was never familiar with the Corona Cloud service.  I'll take a look.  Thank you for that.

 

I would love to have your feedback and framework ideas on Coronium, especially since you have experience using server-side Lua code.  Can I set you up an instance?

 

Best.



[TOPIC: post.html]
#34

marble68

[GLOBAL: userInfoPane.html]
marble68
  • Contributor

  • 170 posts
  • Corona SDK

I don't have much time currently - I'm sprinting to finish my current project (which lives under Apache on top of MySql).

When I can spend more time I'll get more involved.



[TOPIC: post.html]
#35

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

@marble68 Excellent.  Anytime, just shoot me a message.

 

Best of luck with your project.  Got any links you can share yet?

 

Cheers.



[TOPIC: post.html]
#36

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

[TOPIC: post.html]
#37

marble68

[GLOBAL: userInfoPane.html]
marble68
  • Contributor

  • 170 posts
  • Corona SDK

Not quite yet - :) I'm almost in alpha playtest right now. then a graphic brushup, then a round two; then move public exposure. 

 

I have to do consulting and stuff on the side to eat; so sometimes those eat into delivery.



[TOPIC: post.html]
#38

ted89

[GLOBAL: userInfoPane.html]
ted89
  • Observer

  • 1 posts
  • Corona SDK

Check out http://webscript.io for something that's pretty much exactly this. (I'm not affiliated with those guys; I just find them really easy to work with.)



[TOPIC: post.html]
#39

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

@ted89 That looks great. I wish it would have come up in my original Google search for Lua based cloud code.  Could have saved me a lot of time.  ;)

 

The price is right too.  Thanks for sharing.

 

Cheers.



[TOPIC: post.html]
#40

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

There is a Leaderboard and Tic Tac Toe example as well.  For people who have been looking for something like that.

 

Cheers.



[TOPIC: post.html]
#41

c0ppo

[GLOBAL: userInfoPane.html]
c0ppo
  • Enthusiast

  • 47 posts
  • Corona SDK

Does this mean you won't work on Coronium anymore?



[TOPIC: post.html]
#42

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

@c0ppo  I'm going to look into the overlap, and see what makes sense.  I still think an open-source push solution for Corona projects would be nice.  At the very least I'll just put up what I have going now with the Coronium library to a public repository and we can all peck on it here and there.

 

My concern is making sure I focus my time in the right places, as far as solutions for Corona devs are concerned. :)

 

Cheers.



[TOPIC: post.html]
#43

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

What? Noooooooo.... Coronium is the best thing ever!!! Please don't pull the plug. Pretty please?



[TOPIC: post.html]
#44

c0ppo

[GLOBAL: userInfoPane.html]
c0ppo
  • Enthusiast

  • 47 posts
  • Corona SDK

IMHO, Coronium is worth the time, at least I've got high hopes for it. I really hope you continue on, but if you decide otherwise, I wish all the best to you. Maybe someone else will try to finish it :)



[TOPIC: post.html]
#45

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

@ksan I don't plan on pulling the plug at this point.  You're all good. :)  I still like the MySQL and PHP integration on the server, which webscript.io doesn't do.  I think there is still a place for Coronium.  But I think it needs a distinct angle/solution.  Though I think that if someone is looking for some Lua cloud service right now, then this option looks good as well.

 

Cheers.



[TOPIC: post.html]
#46

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Sigh of relief. Thank you very very much!!! I think what you have already is amazing with the MongoDB or MySQL based storage options + PHP tie in. If you managed to squeeze in the Push component as well that works on IOS & Android then you will have an amazing product. These are things you can't get anywhere in one box / solution. 

 

And once again thank you very very much for all your hard work.



[TOPIC: post.html]
#47

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,457 posts
  • Corona SDK

I certainly appreciate the votes of confidence.  Many thanks.

 

More updates soon.

 

Best.



[TOPIC: post.html]
#48

marble68

[GLOBAL: userInfoPane.html]
marble68
  • Contributor

  • 170 posts
  • Corona SDK

I do think something like webscript.io and a stack for corona are very different animals. Sure there would be overlap; but very different verticals. 



[TOPIC: post.html]
#49

dgaedcke

[GLOBAL: userInfoPane.html]
dgaedcke
  • Contributor

  • 264 posts
  • Corona SDK

Guys....I've not read this thread (just saw link on the blog & have to run out to a meeting, so apologies if this has already been considered/discussed), but if not, you guys should DEFINITELY be looking at OpenResty as a base for this project.....capitalize on that existing lua framework and run 2.5 x faster than Node.js server.....



[TOPIC: post.html]
#50

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Yes. I believe @develephant is using OpenResty. It is amazing!!!




[topic_controls]
Page 2 of 3 1 2 3
 
[/topic_controls]