aspose file tools*
The moose likes Game Development and the fly likes browser-based game question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "browser-based game question" Watch "browser-based game question" New topic
Author

browser-based game question

John Williamss
Greenhorn

Joined: Jan 08, 2010
Posts: 6
Hello all,

I want to ask a general question. We are a team of three programmers wanting to create a simple browser-based game (just for fun and learning, nothing commercial). Let's say for example something like http://www.the-west.net/ or http://evony.com/ (just a rough idea, we're heading for something simpler at the moment).

Which technologies based on Java can we use to accomplish this task? Is there any framework suitable for these projects?

Servlets are suitable for this kind of project?

What we should use to generate the graphics the game is gonna need (e.g. the map) on a browser?

I'm NOT looking for tutorials, code samples or something like that. Just a guidance on the technologies we should study to accomplish the specific project.

Thanks in advance.
R Johnson
Greenhorn

Joined: Jan 05, 2010
Posts: 28

If it's for private use I would recommend installing a server packaged with php and mysql or similiar. Such as XAMP, WAMP, or LAMP To make the front end really fast I would install joomla takes 10 minutes to be a fully functional website creator that links with php to mysql. Then Java is all you really need and the mysql_jdbc connector. I don't have the link but a quick google of it should bring it up. I have two mmorpgs created and a hex warhammer table top programmed in nothing more. For something more like LastChaos look into Java3D but I'd start in 2D first.
John Williamss
Greenhorn

Joined: Jan 08, 2010
Posts: 6
R Johnson wrote:If it's for private use I would recommend installing a server packaged with php and mysql or similiar. Such as XAMP, WAMP, or LAMP To make the front end really fast I would install joomla takes 10 minutes to be a fully functional website creator that links with php to mysql. Then Java is all you really need and the mysql_jdbc connector. I don't have the link but a quick google of it should bring it up. I have two mmorpgs created and a hex warhammer table top programmed in nothing more. For something more like LastChaos look into Java3D but I'd start in 2D first.


Thanks for your answer. We don't want to do anything in 3D. Some more examples of the kind of games that I mean (all the websites contain screenshots of the games):

http://www.travian.com/
http://www.ogame.org/
http://www.tribalwars.net/

Also, we do not want to use other technologies than Java (except some AJAX if needed at certain points). Anyway, this is a Java forum so we're asking about Java technologies

PS: I believe that XAMPP is an Apache distribution containing PHP, MySQL & Pearl (If I'm not mistaken) where LAMP (Linux, Apache, MySQL, PHP/Pearl) and XAMP (Windows, Apache, MySQL, PHP/Pearl) are just acronyms and not server distributions. And one more off-topic comment: Joomla (and all the other open-source CMS) isn't the solution to everything. I prefer coding my scripts from scratch so they fit exactly to my needs. I'm not saying that Joomla etc is worthless but the fact that takes (not 10 but) 2 minutes to install isn't an advantage.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

So these types of games are basically RPG style turn based, correct? Most are just using static images, some javascript and some server side calls. Probably a lot of Ajax stuff. If that is the case, any server side technology will be fine, including Java. I don't know of any "frameworks" that would make creating a game like this easier. But you might consider a lightweight MVC framework just to make the server side development easier. Something like Frontman or Stripes. That said, even simple servlets would be good enough because all you're really doing is pulling some data from the client, maybe doing a bit of logic, and pushing stuff in and out of the database.


GenRocket - Experts at Building Test Data
R Johnson
Greenhorn

Joined: Jan 05, 2010
Posts: 28

My examples were for lan network computers and private distribution. My games are strictly java and yes were as I too like to code things on my own I don't want to waste time doing mundane tasks like creating logins for my friends into the game. The Apache server also provides me the the same thing as JSP though I'm not familiar at all with JSP and with joomla combined all I have to worry about it my applet. I guess I should have mentioned there all applets. My games run multiple users online on a browser like evony and travian the only differnence is there real time. Now I'm not a server guru so I couldn't tell you that it'll handle thousands of clients, but me and my 5 or so friends run around in MUD I created in Java Applets with socket programming. The Apache just provides the gateway to the applet. I don't mind java platform programming, but I like the evony games because you don't have to download anything and people at school or work could play them. I assumed this is what you were after. If that's the case then I still suggest a server whether it be Apache IIS or some other server and a server side script PHP/ASP etc then you have to HAVE a relational database. They all use them and you will have to have one so why not a Apache/php/mysql package? And new user creation/guild ranks/Top Rankers/ etc etc are usually displayed in a web page. I would rather make a game for 10 days then sit writing html/php code for 10 days. .... so why not a CMS? Just figured I'd throw that out there and I am curious. Besides joomla in no way would fit your needs so you would have to build your own template which you could then offer as freeware which could then get you more popular!!! This is to create things like evony/Realms of kaos. For travian yes all you need are a few web pages and some serverside scripting. The images don't move but evony is Flash that's how they are capable to offer all those images, but in my opinion Java Applets are a much more powerful gaming atmosphere even it is a little more difficult to work with images.
John Williamss
Greenhorn

Joined: Jan 08, 2010
Posts: 6
Gregg Bolinger wrote:So these types of games are basically RPG style turn based, correct? Most are just using static images, some javascript and some server side calls. Probably a lot of Ajax stuff. If that is the case, any server side technology will be fine, including Java. I don't know of any "frameworks" that would make creating a game like this easier. But you might consider a lightweight MVC framework just to make the server side development easier. Something like Frontman or Stripes. That said, even simple servlets would be good enough because all you're really doing is pulling some data from the client, maybe doing a bit of logic, and pushing stuff in and out of the database.


Thanks for your answer.

Yeap, either strategy or RPG style turn based games.

The AJAX calls seem a good solution in a combination with a server-side solution (like Servlets) for the logic and the collaboration with the database.

But what about the graphics and the general interface? What can I use to generate for example a map with some clickable player's icons on it? Another example: Let's say there is a town image combined with images of buildings and we want when a user clicks on a button, a new building tp appear among the others.

Can I generate the image (a player's icon or a building) via a Java class and place it on a specific position in the screen using an AJAX call? Or maybe using an applet to build my interface and do everything in there?

I've build a lot of web apps using php & javascript (+AJAX) (including some commercial) and a couple using Servlets but I never did something like the one I'm asking for now (and neither the rest of my team), so the principles I'm familiar with aren't applying here. So, I'm very sorry about my ignorance about graphics and how they are used, as well as if I'm making some "stupid" questions.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

I'm curious as to why you think what you've done in the past doesn't apply. If you are doing HTML/JavaScript/CSS (not an Applet) you can utilize image maps and/or general DOM manipulation to add elements (in your case images) to the page, regardless of ajax. You'll just need to take care on the positioning and z-index of new elements so they appear where you want them to appear. You could also code the entire interface via an Applet but then your server side communication could become an issue depending on how you approach it.

Personally, I'd stay away from an applet for something like this since you just need static images to show up in the correct place with click/hover events attached to them. You might have an applet as part of the overall game for something like in game chat. But that's up to you.
John Williamss
Greenhorn

Joined: Jan 08, 2010
Posts: 6
R Johnson wrote:My examples were for lan network computers and private distribution. My games are strictly java and yes were as I too like to code things on my own I don't want to waste time doing mundane tasks like creating logins for my friends into the game. The Apache server also provides me the the same thing as JSP though I'm not familiar at all with JSP and with joomla combined all I have to worry about it my applet. I guess I should have mentioned there all applets. My games run multiple users online on a browser like evony and travian the only differnence is there real time. Now I'm not a server guru so I couldn't tell you that it'll handle thousands of clients, but me and my 5 or so friends run around in MUD I created in Java Applets with socket programming. The Apache just provides the gateway to the applet. I don't mind java platform programming, but I like the evony games because you don't have to download anything and people at school or work could play them. I assumed this is what you were after. If that's the case then I still suggest a server whether it be Apache IIS or some other server and a server side script PHP/ASP etc then you have to HAVE a relational database. They all use them and you will have to have one so why not a Apache/php/mysql package? And new user creation/guild ranks/Top Rankers/ etc etc are usually displayed in a web page. I would rather make a game for 10 days then sit writing html/php code for 10 days. .... so why not a CMS? Just figured I'd throw that out there and I am curious. Besides joomla in no way would fit your needs so you would have to build your own template which you could then offer as freeware which could then get you more popular!!! LOL it's all win win if you still see an error please let me know.


My friend, I'm not asking for a suggestion for a Web Server or for a Database, or for a login system etc. Sorry if I wrote something that caused a misunderstanding. From what you're writting I'm keeping the word "applet" as an answer to my question. But to tell you the truth, I lost the meaning of your saying at some point..
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

R Johnson wrote:The Apache server also provides me the the same thing as JSP though I'm not familiar at all with JSP...


No it doesn't and since you said you aren't familiar with JSP then you shouldn't make assumption that are untrue. It just makes people more confused. The Apacher HTTP Server is merely a web server to serve static content. Even for PHP to work you need the Apache PHP module installed. Apache doesn't just automatically support it. For JSP/Servlets a Servlet container/server is needed like Tomcat or (God forbid) JBoss, etc. You can still use Apache to serve your static content but you'll get no dynamic server side control with Apache alone.
John Williamss
Greenhorn

Joined: Jan 08, 2010
Posts: 6
Gregg Bolinger wrote:I'm curious as to why you think what you've done in the past doesn't apply. If you are doing HTML/JavaScript/CSS (not an Applet) you can utilize image maps and/or general DOM manipulation to add elements (in your case images) to the page, regardless of ajax. You'll just need to take care on the positioning and z-index of new elements so they appear where you want them to appear. You could also code the entire interface via an Applet but then your server side communication could become an issue depending on how you approach it.

Personally, I'd stay away from an applet for something like this since you just need static images to show up in the correct place with click/hover events attached to them. You might have an applet as part of the overall game for something like in game chat. But that's up to you.


You're correct, it's been a while since I used an image map so I never thought of that. As for the DOM manipulation you are correct too. Anyway, my team's point is to use any possible Java technology to learn about them and to use them in the future to build something more professional. I'll modify my question: If I do not want only static images but some kind of animation too, then the best Java solution would be an applet or there is a better solution out there?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

John Williamsss wrote:
Gregg Bolinger wrote:I'm curious as to why you think what you've done in the past doesn't apply. If you are doing HTML/JavaScript/CSS (not an Applet) you can utilize image maps and/or general DOM manipulation to add elements (in your case images) to the page, regardless of ajax. You'll just need to take care on the positioning and z-index of new elements so they appear where you want them to appear. You could also code the entire interface via an Applet but then your server side communication could become an issue depending on how you approach it.

Personally, I'd stay away from an applet for something like this since you just need static images to show up in the correct place with click/hover events attached to them. You might have an applet as part of the overall game for something like in game chat. But that's up to you.


You're correct, it's been a while since I used an image map so I never thought of that. As for the DOM manipulation you are correct too. Anyway, my team's point is to use any possible Java technology to learn about them and to use them in the future to build something more professional. I'll modify my question: If I do not want only static images but some kind of animation too, then the best Java solution would be an applet or there is a better solution out there?


JavaFX seems to be the big thing with regards to Java and animation right now. You might look into that.
John Williamss
Greenhorn

Joined: Jan 08, 2010
Posts: 6
Gregg Bolinger wrote:JavaFX seems to be the big thing with regards to Java and animation right now. You might look into that.


Thank you very much.

Anyone has to propose something different? (just trying to gather different oppinions so we have something to choose from!)
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928


GWT is a cool technology for that.

Check out snakes and ladders made in my site in GWT, its a board based game.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: browser-based game question