Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (773)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  HTTP/PHP Server for Java Online Game, Bad Idea?  (Read 4357 times)
0 Members and 1 Guest are viewing this topic.
Offline aeroc

Senior Newbie

Projects: 1

« Posted 2011-11-14 23:57:07 »

I'm relatively new to Java and I'm planning my next project, it will be a slow-paced command-based online game. I'm hesitant to make the game's server in Java due to inexperience, and instead writing PHP scripts on an HTTP server (something I have experience with). The client will be in Java. Is the HTTP server a bad idea? Should I just bite the bullet and learn to code a server in Java?
Offline ra4king

JGO Kernel

Medals: 508
Projects: 3
Exp: 5 years

I'm the King!

« Reply #1 - Posted 2011-11-15 00:20:19 »

HTTP server is actually quite fine. However, coding a server in Java is more exciting Smiley

If you want to make this as fast as possible, use HTTP. Otherwise, I suggest learning how to create Sockets and whatnot since it might be useful later on Smiley

Offline Chromanoid

Junior Devvie

Medals: 3

« Reply #2 - Posted 2011-11-15 00:44:06 »

HTTP might be a very good idea since it often leads to a very scalable architecture (if you stick to its stateless nature). You might want to look at for a nice high level client for webservices. Serverwise you could use jersey too... Using webservices allows you to switch later to javascript/GWT easily. BTW many Zynga games use PHP on the serverside.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mike

« JGO Spiffy Duke »

Medals: 149
Projects: 1
Exp: 6 years

Java guru wannabe

« Reply #3 - Posted 2011-11-15 09:47:41 »

Hi Aeroc,

The first version of State of Profit used php as server side. Eventually I had the need to switch to a full blown java socket app though seeing as I really wanted to way initiated communication. If you want the server to send things to the client without the client having to poll for changes constantly you're better off with a java server. If you are fine with only sending commands/polling for updates then go ahead with php so you can focus on the game instead of the server. Try to keep the communication separate from the game logic though so you can switch it out at a later stage if needed.


My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline gimbal

JGO Knight

Medals: 26

« Reply #4 - Posted 2011-11-15 14:54:19 »

> it will be a slow-paced command-based online game

I know games from the past (and I believe it is still used sometimes) that used EMAIL as its possible communication protocol. I'd say that HTTP is fine for this kind of game, especially if you combine it with for example JSON as your message format. Google has created a nice little API called GSON to make that very easy indeed.
Offline h3ckboy

JGO Coder

Medals: 5

« Reply #5 - Posted 2011-11-15 21:13:23 »

when you mean slow do you mean like turnbased?
Offline aeroc

Senior Newbie

Projects: 1

« Reply #6 - Posted 2011-11-15 23:05:13 »

Thanks for everyone's advice. =)

when you mean slow do you mean like turnbased?

Offline h3ckboy

JGO Coder

Medals: 5

« Reply #7 - Posted 2011-11-16 06:32:41 »

in that case yeah, I think that you should probably be fine. although you should think about how the other players will know it is their turn? will they just poll every couple of seconds to check?
Pages: [1]
  ignore  |  Print  

EgonOlsen (1850 views)
2018-06-10 19:43:48

EgonOlsen (1879 views)
2018-06-10 19:43:44

EgonOlsen (1245 views)
2018-06-10 19:43:20

DesertCoockie (1680 views)
2018-05-13 18:23:11

nelsongames (1345 views)
2018-04-24 18:15:36

nelsongames (1963 views)
2018-04-24 18:14:32

ivj94 (2736 views)
2018-03-24 14:47:39

ivj94 (1938 views)
2018-03-24 14:46:31

ivj94 (3029 views)
2018-03-24 14:43:53

Solater (1078 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!