Welcome to Dream.In.Code
Become a Java Expert!

Join 150,071 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,802 people online right now. Registration is fast and FREE... Join Now!




Simple Multiplayer Online Game?

2 Pages V  1 2 >  
Reply to this topicStart new topic

Simple Multiplayer Online Game?, Ideas, Opinions, Suggestion, Comments, Anything..

mensahero
11 Jun, 2008 - 11:03 AM
Post #1

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
Hello.. Good day to all.. After I've finished my project in JAVA I got bored and try vb.net with SQL but luckily.. microsoft hates me.. mad.gif so I hate them to and decided to better learn JAVA..

my problems:

1. I can't learn by just reading books or anything.. I want a Goal.. something to accomplish.. That's how I learn..

2. I'm planning on making a simple ONLINE GAME played by 3 persons..

3. What do I need to learn? Don't hesitate I'm good at learning by myself.. but I need a specific lesson to learn.. I can't learn them all..

4. Is it possible to be done with pure JAVA? if so what part of JAVA do I need to learn.. specific API? or anything..

5. If I need to learn something that is not related to JAVA.. what is it? and what part of it do I need to learn..

6. I only have a single PC. Its a browser based game.. Do I need another pc to act as a server? or I can get webhost to act as a server? What do I need to learn about online server?

7. Any suggestion, Opinions.. but please don't laugh and tell me I'm a dreamer.. I'm new to JAVA.. but give me the Topics and I can learn them..

8. Any possible diagram would be great.. diagram on how the data flow..

9. I'm getting pretty bored.. and classes will start next week.. I need something to keep me pretty busy so that I can avoid going out and wasting my time just hanging around doing nothing.. blink.gif

This post has been edited by mensahero: 11 Jun, 2008 - 11:05 AM
User is offlineProfile CardPM
+Quote Post

1lacca
RE: Simple Multiplayer Online Game?
11 Jun, 2008 - 11:18 AM
Post #2

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
You should specify a bit better what kind of an online game you are thinking of. You wrote that it is browser based. Does it mean, that you would like something that works like a homepage, and it is refreshed by clicking links?
Or something that is more dynamic, and refresh it's state asynchronously via AJAX? Maybe something that is not based on HTML at all (an applet)?
The first two options only require a servlet, and you are fine, but you'll have to know HTML, and in the second version some Javascript as well.
Sticking with the third option, you can create just about anything. If it is turn-based, then you can get away with HTTP refreshes. If you want something where the clients get real-time messages from the server, then you'll need to look up socket programming. For this some knowledge of TCP/IP might be useful, but not necessary.
So what will it be?
As for testing with one machine: it is possible in all cases, but in the last option simulating user inputs might be tricky.
User is offlineProfile CardPM
+Quote Post

mensahero
RE: Simple Multiplayer Online Game?
11 Jun, 2008 - 11:31 AM
Post #3

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
Now.. thats a good.. start.. well sorry to be less informative.. I'm in the middle of giving up hope on .net while posting that.. I prefer the third one.. It offers a lot to learn..

more information..

1. It would run on a browser. An Applet is a great IDEA since i'm into those..

2. It will only consist of 3 players. That will give me enough IDEA on how to develop it..

3. I don't want people downloading anything. I just want to simulate 3 persons playing together online. something like a multiplayer side scrolling game..

4. What technology would hold the data? and were can I upload the database or something.. ? does webhost a possible server? or Do I need my pc to be the server.. what technology should I learn?

5. To be honest.. I'm not really into games.. I just thought that this project could give me the whole IDEA on how JAVA ONLINE could work.. how data are transfered from what to where..

6. and if its possible on JAVA ALONE.. I prefer doing it PURE JAVA.. ? but still if its no possible.. then what do I need to learn? and any specific topics about them.. i.e.. learn HTML .. but what part of HTML?

biggrin.gif biggrin.gif

This post has been edited by mensahero: 11 Jun, 2008 - 11:34 AM
User is offlineProfile CardPM
+Quote Post

pbl
RE: Simple Multiplayer Online Game?
11 Jun, 2008 - 04:29 PM
Post #4

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
You you know the Game "RushHour" ?

I guess you can Goggle for it if you don't know it.

You have a parking lot with vehicles that can be moved in only one direction (up and down or left to right)
There is only one exit from where a designated vehicle should exit. You should move vehicles to clear the way to let the designated one to exit.

That was the first Java program (after HelloWorld) I wrote.

Lots of challenges...

You need a Grid object composed of Corridor objects into which Vehicles objects can be dragged.
Vehicule object have a size (2 or 3 squares) and a direction (up/down or left/right).
That will teach you a lot of Swing and mouseListener.

Your first version can use simple Rectangle as vehicle then you can load Image from cars downloaded from the Internet that will teach you Image manipulation in Java.

Then you can put predefined problems (with their level of difficulty) into an SQL database and retreive them at random. Sure, you will need a GUI to populated that database. This database will be filled with Problem objects that will be the initial state of the parking when the game start.s That will teach you SQL programming from Java. (Use HSQLdb easy to use and to put Java object into it).

Then you can share between 3 users athe same problem and see who does the problem faster that will teach you Socket programming.

RushHour comes with predefined problem (and their solutions). If you want you can try to figure out an algorithm to find the better solution. That will teach you Operational Research.

Do that and you will know a lot about java and you can publish that problem into the net. (For free I hope so I can play).

You can start with an hardcoded problem single user... then add the database thing then add the multi user interface.
That will teach you how to re-use objects already created.

I was a C/Cobol programmer, learned Java and OO in 3 months doing that project at home.

If you can't find predefined problems on the net I'll be glad to email you my Problem class and an file containing Problems object into it.

Have fun

This post has been edited by pbl: 11 Jun, 2008 - 04:47 PM
User is online!Profile CardPM
+Quote Post

pbl
RE: Simple Multiplayer Online Game?
11 Jun, 2008 - 09:49 PM
Post #5

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
Mensahero

can't wait to play RushHour with Cindy biggrin.gif
when will you post it on your web site ?
User is online!Profile CardPM
+Quote Post

mensahero
RE: Simple Multiplayer Online Game?
11 Jun, 2008 - 10:24 PM
Post #6

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE(pbl @ 11 Jun, 2008 - 10:49 PM) *

Mensahero

can't wait to play RushHour with Cindy biggrin.gif
when will you post it on your web site ?


Cindy will be out.. around 3 AM in the morning.. I guess you could play with her during that time.. biggrin.gif biggrin.gif

Well.. I did a search for rushHour.. I did find it.. to bad it was made in flash..

Now.. SQL Server << that thing again.. that's the reason I run away from .NET.. it took me almost two days.. to make that work.. lmao.. pretty n00b.. crazy.gif

now This one is more interesting... I guess I'll read more about.. HSQLdb ..

well I need to face my enemy.. *SQL* .. blink.gif

Lastly classes will start next week.. So I don't have enough time to work with it.. too bad.. but it will make sure that I won't waste my free time hanging out doing nothing.. which is a good thing.. biggrin.gif Vacation is over.. :sigh:

And I'm not planning on doing something like rush Hour.. I have this idea.. a real pokemon game applet.. the one played in gameboy advance.. I starting to gather sprites, images.. used in that game.. and i'll try creating the game engine first.. that will keep me pretty busy for the next few days..
I want it to be PURE GAME APPLET.. not like browser games were you read paragraph's and given choices.. blink.gif

it's perfectly hard.. but it's the best way to learn.. rather than just reading..

Thanks for the suggestions bro's.. i'll keep you updated with my progress.. biggrin.gif

This post has been edited by mensahero: 11 Jun, 2008 - 10:24 PM
User is offlineProfile CardPM
+Quote Post

pbl
RE: Simple Multiplayer Online Game?
12 Jun, 2008 - 04:49 PM
Post #7

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
No need to implement SQL right away
You can put your problem in a flat file as objects.
User is online!Profile CardPM
+Quote Post

mensahero
RE: Simple Multiplayer Online Game?
12 Jun, 2008 - 06:16 PM
Post #8

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE(pbl @ 12 Jun, 2008 - 05:49 PM) *

No need to implement SQL right away
You can put your problem in a flat file as objects.


Yeah.. that's a good Idea.. but somehow.. I cannot run from SQL all my life.. since this is not really a paid project or anything.. I better face that SQL.. blink.gif


Implementing the SQL language is not my problem.. it's running the SQL server that causing me lots of headache.. lmao.. blink.gif

.. I'm still doing some research about java basic networking.. and hopefully I could learn how to use your suggestion.. HSQLdb.. blink.gif ..

..and SQL SERVER 2005 is now running fine in my pc.. lmao.. maybe I could use it with JAVA.. not sure though.. how to do it since I never tried to read something about it.. biggrin.gif
User is offlineProfile CardPM
+Quote Post

pbl
RE: Simple Multiplayer Online Game?
12 Jun, 2008 - 06:34 PM
Post #9

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(mensahero @ 12 Jun, 2008 - 07:16 PM) *

Implementing the SQL language is not my problem.. it's running the SQL server that causing me lots of headache.. lmao.. blink.gif


Don't need a server with HSQLdb... and the Database engine is embedded with your Java Application

So in your Java code you "connect" to the databse "files" not a server
User is online!Profile CardPM
+Quote Post

mensahero
RE: Simple Multiplayer Online Game?
12 Jun, 2008 - 06:41 PM
Post #10

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE


Don't need a server with HSQLdb... and the Database engine is embedded with your Java Application

So in your Java code you "connect" to the databse "files" not a server


is That possible? WOOW.. blink.gif blink.gif nice information.. THANKS for telling me that.. if it's all inside JAVA.. the better.. blink.gif blink.gif

well Since it's a database inside java.. here's my assumptions:

1. I can dynamically change data through code? send/retrieve data dynamically?

2. Well since it's embedded inside JAVA.. is it like file level connection? like access and vb6?

3. If Everything (Java files, along with the database) I uploaded in a webhost.. will the database works the same?

I'm very new to servers, htmls.. but I've learned how to setup a webhost since I need it to test my former project online..

blink.gif blink.gif

This post has been edited by mensahero: 12 Jun, 2008 - 06:43 PM
User is offlineProfile CardPM
+Quote Post

pbl
RE: Simple Multiplayer Online Game?
12 Jun, 2008 - 06:55 PM
Post #11

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
Yes
Yes
and Yes

the only draw back.... the database cannot be shared by multiple application

Your application locks it.... so only one application can access the DB at one time.

Then you have 2 choices:

HSQLdb has also a server mode... and can be run has a server...
or (the solution that I prefer) you write your own server

So your server opens the database in embedded mode and you have clients that connect to you and transmit to you (through) Java object their SQL request...

Happy to have make your day
User is online!Profile CardPM
+Quote Post

mensahero
RE: Simple Multiplayer Online Game?
12 Jun, 2008 - 07:02 PM
Post #12

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
well.. access too has file level restrictions.. but since I'm only doing it with probably 3 - 4 players.. this will be good..

I think I could code something like what you've suggest..

4 of them uses a single embedded database.. that only allow a single connection/transaction everytime.. well I think I can sort it out with codes.. probably.. something like.

.. open db.. send/retrieve data.. close db.. then let other user use it.. that logic seems easy.. some background threads will handle the checking if db is open or something..

.. lmao.. blink.gif I can't wait to get started.. well I'm still reading some information of basic java networking.. and I've read a tutorial here that its better to plan first than jump with the code right away.. which is what I often prefer.. lmao.. blink.gif

This post has been edited by mensahero: 12 Jun, 2008 - 07:03 PM
User is offlineProfile CardPM
+Quote Post

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:57PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month