views:

624

answers:

13

I've been a web programmer for a while and I can also program in Java. I have an idea for a small, multiplayer RPG game that I want to work on. It will be played through a java applet in the user's web browser.

I have written the design document and specifications of the gameplay. What I'd like to know now is how I can develop the game? I've worked only with windows-like business apps in the past, with built-in widgets for textboxes, dropdowns, etc. With game programming it seems that I would have to build my own widget/controls for the UI of the game.

These are the specific questions I have in mind:

1) How to display a 'loading...' message with a progress bar while the game's images, sound, etc are being downloaded. (Using the java applet)

2) How to create the UI of the game with its own menu, controls, etc. Such as by clicking the map icon it would show up a map to them. Clicking the friends icon would let them chat to their friends, etc.

3) And other, general game development issues that i should know about, like whether I should use 2D or 3D graphics, physics in games, etc.

If there's a good recommendation for a book that will help me, do share.

A: 

Q1 = 1% of your time.

Q2 = 40% of your time.

Q3 = 59% of your time.

You might as well be asking how could I write Halo3 for a web browser.

Aim a little lower to start with....

ck
+1  A: 

Don't go the java applet route.

If you want to make a quick casual game, make it Flash; else, develop a full-blown java app and run it via java web start.

Try Tower to see how far you can go using java as a platform, and also how Java Web Start works.

As for progress-bar thing, I recommend you to implement those files' loading and actually use them before you go for progress-bar eye-candy :)

alamar
java web start lets the app get run from the browser? nice
Click Upvote
Using proper java would let you to use cool 3D-game development libraries, there are a few good ones for java.Try http://tower.sourceforge.net/ to see how well java web start + java suits for game development.
alamar
When i click play now for that game, it asks me to download a .jnlp file. That's not what i want, it would defeat the purpose. I'd like them to play the video through the browser while remaining on my website
Click Upvote
Well, do you have JVM installed?If you don't, why the hell do you suddently want to make an applet?
alamar
JNLP apps require an installation even if you have a JVM installed.
Pool
Uhh, I can run Java applets and other java apps, so I'm guessing I do have JVM installed. However the java web start thing always asks me to download a .jnlp files (i've seen it on some other games too). Can this be avoided?
Click Upvote
+1  A: 

Hi there!

http://nehe.gamedev.net/

Has tons of tutorials from basic to advanced using OpenGL from various languages and systems, from C to C# and Python to Java.

I found this very very useful and is a great resource to bookmark. It should get you started with the basics of game/3D programming on your platform/language of choice.

good luck!

Aiden Bell
A: 

opencourseware class on game theory and design. It also comes with a reading list.

yx
This is kind of a snarky reply, Game Theory is a fascinating branch of mathematics but really not essential to coding up your first flash FPS.
sammyo
+1  A: 

As others have said a java applet is probably not the medium in which you want to present your game. The second most people see an applet start to load they run in fear.

If you have no game design experience at all, you are setting the bar very high with a multiplayer RPG. You may want to start with a simpler project such as recreating something like tetris, pacman, or even pong so you can get an idea of all that goes into creating a game.

Flash is great if you are set on doing an online game, Java plus the Jogl open-gl wrappers are also a great option.

Personally I would suggest using Microsoft Xna. C# is similar enough to Java that you should be able to pick it up fairly quickly and Xna does a good job of abstracting away some of the lower level details involved in graphics programming. The community is also very active and helpful.

DMMcKinnon
i did make a small pacman game, thanks :). what i'm most clueless about is question 2 (i.e the ui)
Click Upvote
Well the most basic approach is that you draw sprites to the screen setting their z value so that they appear on top of everything else. For example Zelda draws 3 heart sprites in the top left of the screen to represent your health
DMMcKinnon
ahh... I see. nice
Click Upvote
+1  A: 

One thing that is probably worth being familiar with is multi-threading. For example, with the "load screen", you might have one thread displaying the progress bar, while other threads simultaneously load data.

Similarly, much of the interactivity will happen by dispatching multiple threads to do many things at the same time (move different characters on the screen) or to handle interrupts by user input.

rascher
+1  A: 

I would look at O'Reilly Books

Killer Game Programming in Java

Coding For Fun

NoahD
+2  A: 

If this is your first game, a multiplayer project might be too ambitious.

Loading screens are not terribly hard - I implement them by counting up how many files I have to 'load' and then advancing the progress bar (and doing a screen refresh) every time another file has been loaded successfully. You can do this with as much granularity as you please - it might complicate your loading code to add the UI component. I wouldn't worry about it for now; maybe just throw up a basic "Loading..." frame and then implement a full progress bar later when the game is more solid. I've also seen some good implementations with multithreading.

The other two will come with experience; I think what you need more of is a general tutorial for game development than the specific answers. You should definitely start smaller. Once you understand the structure and problems of a smaller game, it will be easier to apply those to larger games.

Most reasonable game programming books will go over basic game structure; I like Game Coding Complete but it's quite complicated for a beginner (it covers more complex ways to approach large projects). Game Architecture and Design is similar, but might be better suited to what you're looking for since it also covers some minor project management "best practices."

There's a lot of different ways to do UI, from using the Java primitive UI types (depending on what other libraries you're using) to self-writing your own "HUD" implementation with just what you need.

ravuya
A: 

If you're looking for a gentle entry path to game development and don't mind learning C#, XNA has an entire community built around learning how to write games. It has samples of all sorts of things -- the Game State Management sample shows a good way to implement screen transitions and loading, and there's a similar Network Game State Management sample for networking stuff. They also have entire games available as source code to download.

Whether or not your long-term goals are to make a Java applet, Flash game, or you want to work in C/C++ with OpenGL, XNA is a great way to ignore all the hairy implementation details of rendering/sound/etc. That's very very helpful when you're just trying to make your first game, believe me.

ojrac
Any reason for the -1? Thanks for the feedback ;)
ojrac
A: 

Since I can't add a comment, I'll add an answer. I'd recommend NOT using threads for moving characters, etc. For file loading, playing sounds, and even server side networking it works well but any sort of AI/Graphics, it tends to cause endless headaches.

Also, as other people have mentioned, Java may not be the best choice. The simple reason that people say this is that it's difficult. The amount of support/tutorials for Java game development is rather lacking when compared to C++ (GameDev.net is great resource, but it's moved its focus more towards professional development over time), Flash (decent tutorial on Kongregate as well as being a spot that could host the game for you), or even C# (using XNA). Java game development has improved over the years and you can do some amazing things with it, but it may end up being more difficult going that route. No matter which language you choose, definitely look into using a graphics/game engine as it will cut down on the amount of work on your end and allow you to hopefully create a better game.

JaCraig
I don't like it when someone comes and says don't use Java use c++. Wouldn't I have thought of that? I need to use Java so the game can be played through the browser. with flash the designers are very expensive to hire. hence for purely business reasons i need to use java. if you can't help me with that then don't add an answer
Click Upvote
A: 

Don't go with the java applet approach; applets are generally annoying, and slow.

If you really want it to be playable from the browser, consider Flash (actionscript), or maybe silverlight (I don't know much about games in silverlight).

Gamedev is a great resource for general game programming stuff

And ...

I'll shamelessly steal the link from yx's answer:

MIT Open Course Ware: Game Theory and Mechanism Design

hasen j
+1  A: 

Responding to question 3. If you are really keen to start developing games, I recommend you read this short article by Jeff Howland.

Willem
+1  A: 
  1. The easiest route is to package everything in a Jar file. The default screen does show a progress bar with some small ability to customise. You can write custom code to keep track, manage and download files but I would personally advise against this route. If you search for applet loaders you will find more information.

  2. I'm not 100% sure what you mean, but you can use Swing components in the same way you can use them in applications. Use a JButton with an image is quite trivial, then hook the event code in the actionPerformed method.

  3. The biggest problem you will probably come across is animation and the EDT. I asked about this earlier.

This page has a whole bunch of useful links for game development. Pulp core is an open source framework worth checking out - even if you don't use the framework you can investigate the code.

Whether you should use Java applets or not seems out of scope of this question, but a lot of the above answers give objective (or no reasons at all) about whether to use Java applets. If it's a game for a personal exercise to learn Java then it's a great approach. If you wish to make it public you need to consider whether the current adoption levels are high enough for your needs.

Things have changed in the applet world recently. Since 1.6 update 10 it is much more competitive with Flash - the download size is smaller (at typically under 4Mb), the startup time is reduced and a new scaling look and feel was introduced.

Pool
Regarding # 2, i'm basically wondering if its possible to display a constantly moving area representing the game world (moving characters, buildings, terrain, etc) and a group of buttons using Swing components to the right side. I'll be using the repaint() method for drawing the game world, i think. any thoughts?
Click Upvote
Sorry for the delay replying. Yes this is possible, you can use a layout with a JPanel for the moveable world, and buttons on another panel that are statically positioned (ie a normal component). Repaint is OK to use but eventually you may want to look into active rendering for tighter control of animation.
Pool