Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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 2608 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: 355
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 http://jersey.java.net/ 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: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« 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.

Mike

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

JGO Knight


Medals: 25



« 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?

Yep.
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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (64 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!