Sign in to follow this  
Psyclone

Choosing a programming language

Recommended Posts

I'm building a multi-player online Trading Card Game and was wondering if anyone had any suggestions or opinions which programming language it would be easiest and best to build in. I realize easiest and best might mean two different programming languages. Players will have their own unique library of cards from which to build a deck from and the game will keep track of win-loss records, ratings and other player information that will be kept in some sort of database (Excel or Access maybe). The game is turn-based with a map that will have roughly 60-100 spaces. There will be 10 different types of terrain (map spaces). Each map space will just be a simple .jpg image and the units that occupy the space are .png files. It is a 2-player game in which players will be able to play head-to-head against another player or possibly a computer opponent or some sort of mini-game/campaign. I have already started building this in Java, but am having a lot of trouble with Applets and getting it up and running on a web site. There has to be a better option. A friend suggested using a game development tool, such as Unity 3D. I downloaded and started playing around with Unity 3D, but it doesn't seem like the appropriate program for what I'm trying to do. Does anyone have any suggestions on what would be a good programming language or know of any game development tools that would fit what I'm trying to design?

Share this post


Link to post
Share on other sites
Excel / Access integrate well with C# and Visual Basic using Visual Studio. Is this a web based app? And is it running on a MSFT server? If so and using VS, look into ASP and Silverlight too.

Share this post


Link to post
Share on other sites
Quote:
Original post by Psyclone
I have already started building this in Java, but am having a lot of trouble with Applets and getting it up and running on a web site. There has to be a better option.

Applets or WebStarted Java Application (or HTML/javascript or Flash or Silverlight or maybe JavaFX) are actually good choices. What did you have trouble with specifically?

Personally I would recommend using either an Applet or simply HTML with javascript widgets as the client and either PHP or Servlets as the server backend technology. PHP does have the advantage that it's easier to find hosting for. For database you need to be looking at PostgreSQL or MySQL or at least Microsoft SQL Server, definitely not Excel or Access.

Share this post


Link to post
Share on other sites
Quote:
Original post by lightbringer
Quote:
Original post by Psyclone
I have already started building this in Java, but am having a lot of trouble with Applets and getting it up and running on a web site. There has to be a better option.

Applets or WebStarted Java Application (or HTML/javascript or Flash or Silverlight or maybe JavaFX) are actually good choices. What did you have trouble with specifically?

Personally I would recommend using either an Applet or simply HTML with javascript widgets as the client and either PHP or Servlets as the server backend technology. PHP does have the advantage that it's easier to find hosting for. For database you need to be looking at PostgreSQL or MySQL or at least Microsoft SQL Server, definitely not Excel or Access.


I've spent the last 2 weeks trying to get a simple Java JApplet running on my web site. I've tried over a dozen tutorials and all of them are either poorly written, too old (don't include Swing/JApplets), or both. I've made multiple posts (4 or 5) on the Java boards about applets and haven't received any replies other than one user talking down to me about the type of Layout Manager I was using.

My public library doesn't seem to have any books that include programming using Swing either.

I starting using Java as a complete newbie about 6 weeks ago and feel like I have learned a lot. I created an application that is the Deck Editor for the game which takes up about 10,000 lines of code. I'm trying to convert it into a JApplet and get it running on a web site. I'm running into a lot of trouble doing both. I'm trying to rebuild the applet from scratch, but it isn't going so well.

Specifically, I'm having trouble getting .jar files running on my web site. I've finally gotten a simple HelloWorld applet running, but it was simply by luck. Almost every tutorial leaves out changing the manifest file or doesn't explain it clearly.

I'm still trying to learn what exactly I'm going to need. I've been reading about .jar files and .jnlp files and it sounds like I will need both, but haven't had any luck finding tutorials or help with either of them.

Share this post


Link to post
Share on other sites
I've looked over some of the threads you started over at java-forums and I think you have received a lot of helpful advice there, contrary to what you claim. You even have seven threads marked as "solved". Camickr might have been a bit rough with you but he also tried to help. On the other hand, you also asked some questions the answers to which you could have easily found out by reading about it, so you guys are even. :) Overall, perhaps you are moving a bit too fast and are not patient enough - spending a bit more time on the fundamentals of developing Java programs can't hurt.

Since you're far along with Swing, I recommend you stick to Swing and don't try to mix in any of the AWT things, because these two frameworks are generally not compatible. There is a Swing tutorial here that you should read if you haven't already.

Using WebStart (those jnlp files), it is also possible to start a Java application from the browser, so strictly speaking you do not have to convert your application to an applet. The JNLP syntax is described in detail here, and there is information here about how to set it up (but you have already seen this link).

Looking over your thread here, I see two things that could have been the problem. You probably need to add main="true" to the jar resource definition (not sure if needed for applet, but definitely if you try to deploy application with WebStart later on), and your HelloWorld class is not in the default package. When you have a class that you need to describe by name in some XML file, you generally cannot rely on the other side to find this class for you, so you need to use the full name of the class (with dot notation), in this case "gameinterface.HelloWorld" should've been written into the class attribute. Also, when you have the JNLP and the Jar in the same directory, you should be able to simply write the name of the Jar without having to write out the website address or anything like that.

Usually you do not need to edit the manifest directly in order to get applets or applications to run, the exception being when you depend on third-party libraries in which case you need to define them in the classpath of the jar manifest. As you have no doubt gathered by now, a jar is simply a zip file containing some classes, resources and a manifest file, so there's no big magic to it.

Post back here if you still have any trouble and I'll try to help. I'm not all that familiar with WebStart but I think we can work it out :) It would be a shame if you gave up on Java just because you ran into some trouble sorting out the deployment descriptors. Those are not the real problems that you need to get past to write your game.

Share this post


Link to post
Share on other sites
Quote:
Original post by lightbringer
I've looked over some of the threads you started over at java-forums and I think you have received a lot of helpful advice there, contrary to what you claim. You even have seven threads marked as "solved". Camickr might have been a bit rough with you but he also tried to help. On the other hand, you also asked some questions the answers to which you could have easily found out by reading about it, so you guys are even. :) Overall, perhaps you are moving a bit too fast and are not patient enough - spending a bit more time on the fundamentals of developing Java programs can't hurt.


I'm extremely grateful for all the help I've received on the Java forums. I've gotten more help than I could imagine with applications. I've always made sure to thank the people who helped me as well.

My dead end occurred when I started asking questions about applets on the Java forums on February 24. Prior to that, every question I had asked was about applications. I made a post in the Swing forum, which I marked as SOLVED when I moved it to Networking the following day with a note stating that I moved it to Networking. After thinking about it, I thought Networking was probably the appropriate forum and was just trying not to be rude with similar posts in different categories. I then made 2 posts in the Applets forum and didn't receive any responses until last night, which I hadn't read before posting in here.

I put 6 weeks (10+ hours a day most days) into learning and building the application I have now. I started over from scratch several times and always took all the advice I received. If I ever asked a question, it was always after researching,reading tutorials, and trial and error. I'm just so stuck right now trying to get my program running on the internet that I was willing to throw everything away and learn a new programming language, even though I wanted to stick with Java.

Based on your first response, I'm glad to know that Java is the right program for what I'm trying to do.

I've honestly read and attempted all the tutorials you have linked multiple times. They are still very confusing to me though.

Share this post


Link to post
Share on other sites
OK, now about my project and where I'm stuck.

Let me first give you a slightly more detailed explanation of my program.

The way I have it now, there are 4 parts to my game:

1) Login Screen - enter user name and password. The will take you to the Lobby.

2) Lobby - has a chat window, a list of players, buttons to edit deck or challenge other players, choose an active deck, etc.

3) Deck Editor - this window/applet allows you to build multiple decks and change which cards you want in your decks.

4) Game - This is the window the game is played in.

DECK EDITOR

The only part I've really been working on is the Deck Editor. It is almost finished and I'm just holding off on a couple parts of it which I am trying to decide how I want to build it. The Deck Editor application retrieves information from 2 Excel files. One Excel file is the player database which player information, statistics (rating, win/loss record), each player's card library (all the cards they own), etc. The other Excel file is the Master Card List which contains all the cards and their statistics.

The DeckEditor.java application requires 4 other classes as well. One of them is GameArray.java which reads all the information in from the Excel files and builds arrays of mainly 3 different types CardProperties, DeckProperties, PlayerProperties. These 3 types are the other 3 classes.

The beginning of my constructor looks something like this:

GameArray game = new GameArray();
masterCardArray = game.buildMasterCardArray();
playerList = game.buildPlayerArray();
playerLibrary = game.buildPlayerLibraryArray(playerNumber);
playerDecks = game.buildPlayerDecksArray(playerNumber);

The Deck Editor is a JFrame with multiple JPanels. The rest of the constructor just builds the panels and components, and calls a lot of other sub-classes and Action Listeners.

LOBBY

I have some of the Lobby built, but haven't worked on it much because there's not a whole lot to it and some of it would be nice to test out online, ie - the chat TextField.

GAME

I have the basic game GUI built as an application, but am at the point now that I need to start working on some of the multi-player aspects of it.

------------------------------------------------------------------------

It was my understanding that I would need to make this game (at least part of it) an applet in order to make it playable online. If I'm able to keep this as an application and run it with a .jnlp file, then I think that would save me a lot of headaches. I just downloaded MySQL and am going to start reading the tutorials on it tomorrow.

I haven't tried uploading just a .jnlp file and running my application that way. I will try this tomorrow as well.

THANKS!

Share this post


Link to post
Share on other sites
Nope, you can keep it as an application. It will start in its own window once you click on it in the browser instead of staying as part of the page like an applet does.

The networking parts you want to do are going to be pretty complicated, but a multiplayer game always is. Using WebStart you can get the client application (or applet) to the user, no problem, but to do the other stuff you need to be running a server on some computer somewhere. Servlets won't help you much here. You're going to be writing a custom server (using TCP) and passing messages between server and clients using sockets. You could do the actual gaming part as peer-to-peer but maybe it's best to just stick to the client-server model for now since you need to write one anyway. The good news is that this stuff is easier in Java than in C++ for instance :) But it's still not exactly entry-level material.

The networking basics are here, although you might also want to look around for a higher-level package to use. There is a library called Java Game Networking that might or might not help you with the networking part - it's pretty much dead community-wise, so it's either really mature or just abandoned. There is also another forum that you should be aware of that provides discussion specifically for Java game programming - JGO. Some users from those forums came up with networking abstractions based on Java's NIO. Here's one that was announced recently.

Before you dive into MySQL, make sure you read and understand this, because it's the basis for all relational database design. The Wikipedia article unfortunately does not tell you how to resolve an ER diagram into concrete tables. I looked around a bit and found this paper which gives a bit more detail about that. Normally it's not a big deal, but you should think about where you are placing primary and foreign keys, and resolving n:m tables requires adding a third table.

On the Java side, you talk to MySQL through the JDBC layer. You also need to download the MySQL driver (Connector/J). The challenge is mapping the database into an object model within your program (this is called ORM, object-relational mapping, and there are tools like Hibernate or ibatis that can make it even more complicated :-)). In my own experience, this becomes complicated when you want to save back some objects that you retrieved from the database and modified. Just reading or just creating new entries is usually not a problem. At the very least, I recommend you use the Spring Framework's JDBC abstraction layer because it will save you a lot of typing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this