www.jpct.net

jPCT - a 3d engine for Java => Projects => Topic started by: Melssj5 on January 18, 2006, 04:07:06 pm

Title: Flier Match
Post by: Melssj5 on January 18, 2006, 04:07:06 pm
Well, time ago I began with a project called flier match. It was a spacecrafts fps, like descent but multiplayer designed for deathmatchs.

I was nearly to end it, but I got disapointed for no achieving the network part and I deleted it, all its references and backups. few days ago i rememberder which was my error, and I will build it again.
Title: Flier Match
Post by: EgonOlsen on January 18, 2006, 09:53:22 pm
Maybe you shouldn't delete the stuff you are getting disappointed with every time but moving it to a backup path instead. That would save you a lot of work... :wink:
Title: Flier Match
Post by: Melssj5 on March 05, 2006, 03:01:01 am
well, I have had no time, nut now I will began making it.
Title: Flier Match
Post by: Melssj5 on March 06, 2006, 08:12:20 am
HI, here I post some renders of the crafts I will use, these are arts used on the GUIs, but are the models I will use.

(http://melssj5.paulscode.com/imagenes/arts/FMLOGO.jpg)

(http://melssj5.paulscode.com/imagenes/arts/FMLOGO2.jpg)

(http://melssj5.paulscode.com/imagenes/arts/FMLOGO3.jpg)

(http://melssj5.paulscode.com/imagenes/arts/FMLOGO4.jpg)
Title: Flier Match
Post by: Melssj5 on March 10, 2006, 10:26:07 am
Hi, here I left some screenshots of the real program running (Just a part).

The Configuration GUI:

(http://www.flierm.giga-comp.com/Archivos/SS/GUI1.JPG)

it lets adjust the video settings


(http://www.flierm.giga-comp.com/Archivos/SS/GUI2.JPG)

it adjusts the player settings, like the nick and the team color


(http://www.flierm.giga-comp.com/ArchivosSS/GUI3.JPG)

it adjusts the control configuration


Inside the game:

(http://www.giga-comp.com/flierm/Archivos/SS/Menu.JPG)

its the Main menu of the game


(http://www.giga-comp.com/flierm/Archivos/SS/Nave1.JPG)

(http://www.giga-comp.com/flierm/Archivos/SS/Nave2.JPG)

(http://www.giga-comp.com/flierm/Archivos/SS/Nave3.JPG)

The Color of some parts of the crafts change according to the player team color, the crafts can rotate to let the player view it all.
Title: Flier Match
Post by: Melssj5 on March 16, 2006, 05:17:03 am
Well, I am a kind of stuck on the server.

The server working is not the problem, but my game is designed to be a online game.

The game have two parts. the server is apart from the client. The client can be downloaded and the server has to be placed on a web server and that represents a problem since I need to select the maps to play and so on.

I foolishly was doing an appletsto chose the map but I remembered later that the applet runs on the client machine so I needed to began again with that, I thing I must do a kind of web application with cgi or something, maybe a jsp.
Title: Flier Match
Post by: Crate on March 16, 2006, 11:23:21 am
I've done a lot of web programming, and of course people like to fight a lot about which technology is best, but I would not advise using servlets, jsps or any kind of web scripting for a game server. I'd use a simple java application to do the server work. Just the opposite to the client. Servlets and jsps are good for dynamic text (html) orientated web applications (or xml for that matter) but I would not use xml for a game protocol. In my opinion its easier just to work with streams and sockets and a basic java app.
Title: Flier Match
Post by: Melssj5 on March 16, 2006, 07:30:49 pm
Yes, but the problem with that is that how can you load the J2SE app on a web server. ok, you can have a dedicated server but is expensive.
Title: Flier Match
Post by: Crate on March 16, 2006, 09:23:44 pm
Ok, around here virtual hosts are not that expensive. But anyway, if you can get a tomcat or such but not run your own apps, really the only option is a servlet. The problem is, servlets and jsps are designed for request/response mechanisms i.e. the server can only send data to the client if the client requests it. That can work for a game. (Clients polling the server, for example.) I would "tunnel" the protocol using a servlet, that way you can wrap your com layer and it's easy to switch back to an application when you have the money for a root server. You just have to remember the request/response mechanism when designing you protocol.
Title: Flier Match
Post by: Melssj5 on March 17, 2006, 07:15:58 am
Well, I am getting many problems to do it online, I better do it just for a intranet, at least this first version, later I will think on doing it online.
Title: Flier Match
Post by: Uija on March 17, 2006, 09:37:18 am
the problem, developing it for lan is, that the times, packages need in lan are VERY different to those over the internet.
I had a character moving over a plane, sending position and a directionvector, everytime movement changed. other clients recieved those pages from the server and displayed them. when a position an a walking vector was recieved, the clients interpolated movement until the next package was recieved. when the next one was recieved, the player was set to that position (easy way of errorcorrecetion in interpolation) and so on.
In my LAN everything worked fine. Sometimes, player jumped alittle, but that was not often enough to bother in that timeframe of development.
Than I wanted to show a friend, how it goes on with the project, so I send him the client and uploaded the serverapp onto my dedicated server connected over 100mbit to the internet. it was horror. players jumped around everytime they moved. So I needed to interpolate between my current position/vector and the new position/vector and only "reset" it, when the position is too much out of sync.
As you want to develop a shooter, you need the clients to be in sync, otherwise shooting each other would be impossible. You should build the netcode on the worst networkpossibility the client shall work with.
If you want your game run on ISDN you should develop it over ISDN or emulate it with tools.
Afaik is there a VERY good tool from Microsoft, that Xbox2 developers get, to emulate the minimal requirements for xbox games.
Title: Flier Match
Post by: Melssj5 on March 17, 2006, 09:52:13 am
Yes, considering the speed of conections, my server only receives an int from the clients that identifies the event to handle, the server does all the calcs over the world and returns the world with the own craft removed so the request is ver light (and int) and the response is a little bit heavy, but I think that in average I think its so light so it would work even online, but yes I must do tests first.
Title: Flier Match
Post by: Melssj5 on April 07, 2006, 05:50:54 am
Well, I changed it, instead of passing the world each iteration, I pass it only the first one, after that only the posicion and rotationMatrix of the camera. Now I have another problem. The direction seems not to be well asigned. and it only recognize one type of movement by iteration. I will change the request object to send the KeyMapper instead of a identifier of the event, this will reduce the performance but will allow to do more than one thing by iteration.
Title: Flier Match
Post by: Remo on April 07, 2006, 06:11:50 am
Im not sure if you guys know about this but theres a Java game server, its was made mostly for MMOs but you can change some stuff :).

Im already coding jpct for this server but have nothing to show yet.
Anyway heres the link:

https://games-darkstar.dev.java.net/
Title: Flier Match
Post by: Melssj5 on May 11, 2006, 06:22:03 am
Well, this project is delayed again. My University let me no life. I will delay this project and all others until I buy a laptop to use it on the free hours. I better will try to help Rolz on technopolis if he need it. I want to gain experience on a bigger game before continuing with my owns.
Title: Flier Match
Post by: Mizuki Takase on May 13, 2006, 05:59:52 am
I envy you... Due to my game programming experience, my dream project is no where close to where you are at... I would want to say don't delete old projects ever again since you can always refactor... I look forward to seeing the game in action~~
Title: Flier Match
Post by: Melssj5 on May 13, 2006, 06:26:55 am
Thanks a lot Mizuki. It always make me feel motivated when someone tell something good about my projects. I learned to keep them for a later "Keep o going" actitude. But is dificult to retome a projects if there are no documentation that show you what was you doing when you left it.
Title: Flier Match
Post by: Melssj5 on June 19, 2006, 05:14:39 am
Hi, here again, I have made some stuff to the project. I am advancing slow for the time, but in anyway I am advancing with this game.

Now I blitted the health!

Added the collision detection

Corrected the aligning between camera and Crafts

Corrected the initial alignment of the crafts

Here I left a pic.

(http://www.giga-comp.com/flierm/Archivos/SS/SS1.JPG)
http://www.giga-comp.com/flierm/Archivos/SS/SS1.JPG
Title: Flier Match
Post by: Melssj5 on August 23, 2006, 12:41:34 am
AGAIN: Again I must leave y project because of time, As I began to work 2 weeks ago, I have no time for it, and it will be worst because I must began classes soon, so I guess I wont have time neither for going to the bathrrom.

I will release the code as is now for everyone who wants to finish it.

I would say is at a 75% for a first good release.
Title: Flier Match
Post by: EgonOlsen on August 28, 2006, 07:29:44 pm
Hope you'll come back to this or another game related project. There are so few gaming related affords being done in Java already... :cry:
Title: Flier Match
Post by: Melssj5 on August 28, 2006, 07:34:33 pm
Nice to see you back Egon. I am thinking on not quiting from it at all. In fact I am thinking on contract someone to finish some parts of the game that are still mising. I already sent my code to a friend from an Argentina to tell me a price for it.

But 3d and java wont die for me, in fact I am planning to do my tesis using jpct.
Title: Flier Match
Post by: EgonOlsen on August 29, 2006, 12:55:07 am
Quote from: "Melssj5"
But 3d and java wont die for me, in fact I am planning to do my tesis using jpct.
I'm glad to hear that. jPCT has proven track record of academic projects... :wink:
Title: Flier Match
Post by: Melssj5 on October 20, 2006, 06:24:06 pm
Well, I couldn find anyone to continue my project. (I didnt looked too much) in anyway I want to ask a teacher from the university to continue the project not as 100% mine, but something like that. If not then I wont know what to do!
Title: Flier Match
Post by: Melssj5 on October 31, 2006, 09:12:58 pm
Well, I sent it to Mitsuki. She have not told me anything about it, but I hope she can get something from it. I already made an eclipse version with it.

I decided to continue working on it, even just a few hours on a week. Hop I finish it before 2009. On 2005 when I firstly began JPCT had really god quality graphics, now they are godd enough but not too impresive. Just hope that jpct would be still good enought when I finish.
Title: Flier Match
Post by: Melssj5 on October 31, 2006, 09:19:24 pm
I am also re organizing the package structure and changing the classes to make them easier to understand and improve. I guess that one of the stronguest factors to make feel frustated was the difficulty to continue working after sometime because it was a kind of difficult to understand all the code from a moment to another. I guess that making thios will help me to do things faster, better and easier.
Title: Flier Match
Post by: Melssj5 on November 03, 2006, 04:51:57 pm
Well, the radar is fully working, thanks Egon for your base code.
Title: Flier Match
Post by: Melssj5 on November 30, 2006, 04:10:41 pm
The time is my worst enemy again, anyway on the last try I could learn some stuff that are really great I guess that trying to do a half UT and half forsaken game as the first project is too ambitious and even more if there is no time, maybe I should have began with a smaller game, anyway I wont delete the code again and keep it to reuse the main parts to achieve on future projects.
Title: Flier Match
Post by: Melssj5 on December 16, 2006, 09:39:20 pm
Well, I continue postin g even if nobody reads it. Anyway.

Today I run a previous version the last working, but I noticed this:

sometimes on the 3d objects appears a red ..... stuff. Here are some sshots, they are 1024x768.

(http://www.giga-comp.com/flierm/Archivos/SS/SS1512062.JPG)

(http://www.giga-comp.com/flierm/Archivos/SS/SS1512061.JPG)

(http://www.giga-comp.com/flierm/Archivos/SS/SS1512063.JPG)
Title: Flier Match
Post by: EgonOlsen on December 17, 2006, 12:23:48 am
:shock: Now this looks very strange. Does it happen on other objects too or just on the landscape? Reminds of the hardware problem that i once had on a Radeon 9700pro where a memory chip was weak which resulted in colored dots in the textures from time to time.
It doesn't cover the whole polygon, does it? Just a part of the texture!?
Title: Flier Match
Post by: cyberkilla on December 17, 2006, 01:20:09 am
It looks almost as if the texture from part of the aircraft has made its way to the landscape :o
Title: Flier Match
Post by: Melssj5 on December 17, 2006, 04:03:32 am
Quote
Reminds of the hardware problem that i once had on a Radeon 9700pro


Well, I am using a Radeon 9600 pro. In fact a bad quality video card.

Is the first time I see this problem, it appears only on the landscape and it appears and disappears while moving!

 :roll:
Title: Flier Match
Post by: EgonOlsen on December 17, 2006, 02:01:20 pm
Quote from: "cyberkilla"
It looks almost as if the texture from part of the aircraft has made its way to the landscape :o

Too dark IMHO. The textures of the plane as well as the one used for blitting the radar seem brighter. I still think that this is a hardware problem.
Title: Flier Match
Post by: EgonOlsen on December 17, 2006, 02:04:13 pm
Quote from: "Melssj5"
Is the first time I see this problem, it appears only on the landscape and it appears and disappears while moving!
But the red stripe doesn't cover the whole polygon, does it?
Title: Flier Match
Post by: Melssj5 on December 17, 2006, 05:39:25 pm
Well, I dont exactly know what do you mean with the whole polygon! As I understand the mountaing is made with many polygons and many of them are being painted with that red stripe. it doesnt cover all the map, in fact the begining and the end of that stripe change while moving, and appears on different places!
Title: Flier Match
Post by: EgonOlsen on December 17, 2006, 08:07:01 pm
With "whole polygon" i mean that one whole polygon is colored red, not just a part of it. But obviously, this isn't the case. I still think it's a hardware error. I can't think of anything else producing such stuff.
Title: Re: Flier Match
Post by: Melssj5 on March 03, 2008, 06:24:44 pm
Well, I am back to this. I have a bit of time now so I want to work on it again. I have added this:

 - Chat module
 - Fixed many things
 - Reorganized the code
 - Now I continue developing. I hope I can finish it this time.

Now I have had many problems in my life so I have abandoned my thesis, my project, and all. Now I quit from my job and have to repeat only one subject on the university, so I hope to be able to finish it now.
Title: Re: Flier Match
Post by: fireside on March 03, 2008, 07:14:49 pm
Do you have any screen shots?  I found one link back a ways but it was dead.
Title: Re: Flier Match
Post by: Melssj5 on March 04, 2008, 01:57:07 am
Since I posted a link I have changed twice of web server, I will try to post it a link tomorrow!
Title: Re: Flier Match
Post by: EgonOlsen on March 04, 2008, 12:16:18 pm
Welcome back!  ;D
Title: Re: Flier Match
Post by: Melssj5 on March 04, 2008, 11:08:00 pm
Thanks, I will try to finish it now. I will be posting my advances periodically.
Title: Re: Flier Match
Post by: Melssj5 on March 20, 2008, 02:25:52 am
Well I have made some changes, these are:

.- added an splash screen with the java, jpct, lwjgl, opengl and openal logo
.- redefined the changes publisher for notifing clients when a new player is on or off, etc.
.- Added the sound infrastructure
.- Added the chat infrastructure
.- fixed several bugs
.- improved some stupid things (I began the game hwhen I began programming, so there are many stupid code difficult to remove)
.- fixed problems when coloring special parts for diferent players
.- fixed the problem that sometimes the client cant began plating and some clients coulnt see others
.- some other things

I am still working from time to time but there still a lot of work before having a first release of my game.
Title: Re: Flier Match
Post by: Melssj5 on April 10, 2008, 11:51:42 pm
Well as always I quited from FLier Match again becausse I got a new exhausting job working with datawarehousing in Oracle so my game will have no love for a while.
Title: Re: Flier Match
Post by: Melssj5 on April 14, 2008, 03:13:21 pm
All the pics are not being shown becausse I didnt payed another year of hosting, maybe later when I buy another web hosting I will upgrade the links.
Title: Re: Flier Match
Post by: paulscode on April 15, 2008, 02:23:21 am
All the pics are not being shown becausse I didnt payed another year of hosting, maybe later when I buy another web hosting I will upgrade the links.
How much space do you need?  I'll host your stuff if we're not talking anything huge.
Title: Re: Flier Match
Post by: Melssj5 on April 15, 2008, 03:53:13 pm
Thanks, I wont need a lot, just about 20 MB  :o for hosting the pics, a release of my game and maybe a web page for my game.
Title: Re: Flier Match
Post by: paulscode on April 15, 2008, 04:54:53 pm
Ok, I set you up.  Your web address will be:

http://melssj5.paulscode.com

I emailed you your FTP password and stuff.  Let me know if you get it ok.
Title: Re: Flier Match
Post by: Melssj5 on April 15, 2008, 04:56:37 pm
Yes, Thanks a lot.  8) 8)

BTW: Is there j2ee support on you hosting plan?
Title: Re: Flier Match
Post by: paulscode on April 15, 2008, 05:12:38 pm
Yes, Thanks a lot.  8) 8)

BTW: Is there j2ee support on you hosting plan?

Only server-side stuff I've done is with Perl (cgi scripts).  If you are wanting to host a game server, sorry.  My contract specifically states I may not use my site to host game servers or video streams.
Title: Re: Flier Match
Post by: Melssj5 on April 15, 2008, 05:16:40 pm
Its okay. Thanks a lot again.  :D
Title: Re: Flier Match
Post by: Melssj5 on April 23, 2008, 11:20:24 pm
Well, here are 2 pics of the game as is right now. (90%)

(http://melssj5.paulscode.com/imagenes/SS/SS1_22042008.JPG)



(http://melssj5.paulscode.com/imagenes/SS/SS2_22042008.JPG)
Title: Re: Flier Match
Post by: fireside on April 24, 2008, 01:47:56 am
Pretty nice.  The terrain is just a little bland, it would be nice if you mixed it with something else a little.
Title: Re: Flier Match
Post by: JavaMan on April 24, 2008, 02:11:53 am
Cool looking planes. Looks nice! Are you going to put up a download or something when its done?
Title: Re: Flier Match
Post by: Melssj5 on April 24, 2008, 05:15:35 pm
Yes, actually that map is just a simple terrain with mountains just for testing, I am planing to do many maps and more planes to be dinamically added to the game (Just copy and paste inot a predefined directory).

About putting a download link, well, the original idea was to make it free and open source. Maybe I will change this idea but later. Now I just can assign a few hours for week to the project.

Actually I am downloading Strata 3d CX to do more maps and crafts.
Title: Re: Flier Match
Post by: Melssj5 on May 21, 2008, 11:04:36 pm
Actually I am a kind of stuck on this and  a lot desmotivated. I am doing the shooting stuff, I have had no time since I am waiting another baby. Anyway, The project is still on.
Title: Re: Flier Match
Post by: EgonOlsen on May 21, 2008, 11:38:10 pm
I have had no time since I am waiting another baby.
Good luck with that project. Remember to post some pictures in the "baby-thread"... ;D
Title: Re: Flier Match
Post by: Melssj5 on May 23, 2008, 05:18:53 pm
well, yesterday Iqorked a bit on this project. I managed to add the collisionListener to all my targets on my bad structured server. But I am facing some problems:

1.- where should the bullet be fired (If I shoot it from my craft position it will collide with my owm craft)
2.- How to pass the bullets stuff to all clients
3.- The animations for the explosions (BIG for a craft explosion, medium for a misile impact and small for a bullet impact)
4.- Playing sounds (when fired, while moving???, when impacting)
5.- How much should the bullet lilve
6.- how to move the bullet/misil to make it fire the collisionevent and saving resources because the server is getting stressed and lags
7.- zip/unzip all the information for sending and receiveing
8.- how to identify a bullet/misil to know how shooted it, and to keep an id of each shooted bullet

I guess this shooting stuff is the more complicated.
Title: Re: Flier Match
Post by: EgonOlsen on May 23, 2008, 08:05:25 pm
I can only comment on how i solved these issues for the bomberman clone. That doesn't say much about the quality of those solutions except that they do work. After all, this is my first real gameserver. Anyway, here we go:

1.- I fire them in front of the player, but depending on the animation, it may still collide with the mesh. Therefor, i set the player to invisible before checking its own bullets for collision.
2.- My server sends all known objects to all clients in each iteration. This works, because i don't have that much objects. The format in which i'm sending them is quite lean and i'm zipping it, so this hasn't been an issue so far.
3.- The clients determine which animation to play based on the object's state. Animations, explosions and that kind of stuff don't have to be in sync IMHO.
4.- Haven't done this yet, i'm already transfering an event to the clients to inform them about sound type and location. I'm just not playing any sound right now.
5.- My bullets live on all clients until the server stops transfering them. If they don't hit anything, they time out after some seconds...5 or something, IIRC.
6.- I'm violating the "never trust the client"-principle here and am doing these checks on the client that initialy created the object. However, i'm not doing the response directly but send an event to the server to inform him that something has hit something else. The server checks this by doing a rough distance check and if that passes, it sends the information back to all clients.
7.- No problem. You can simply wrap your stream into a GZIPOutputStream/GZIPInputStream. That's basically all that has to be done to zip the data.
8.- Each object carries the local object id as well as the client's id that the server gives it after login. Both in combination are unique. That way, it's always possible to identify which object belongs to which client and, if it was part of an event, you can simply get those two values to add it to the event, so that each client that receives the event knows, which object on whic client caused it. I have some helper methods to find a view representation for that object on each client.
Title: Re: Flier Match
Post by: Melssj5 on May 23, 2008, 08:18:32 pm
another doubt.

If my craft is moving to the front and a bullet is coming to if from the front.

craft------------>   <---------------bullet


my CollisionListener is on the craft. So the the impact is done, then.

a) on my collisionListener which object will be the source of the collition?? I need it to be the bullet but, how knows!
Title: Re: Flier Match
Post by: EgonOlsen on May 23, 2008, 08:30:13 pm
I that case, the bullet will be the source and craft the target. Just as you would expect it.
Title: Re: Flier Match
Post by: Melssj5 on May 23, 2008, 08:43:31 pm
 ??? :o :( >:(

why?

The bullet moving thread and the craft moving thread will be different threads concurently running!
Title: Re: Flier Match
Post by: EgonOlsen on May 23, 2008, 08:53:40 pm
Assuming that those threads are properly synchronized (otherwise, everything may happen...), the craft looks static for the bullet moving and vice versa.
Title: Re: Flier Match
Post by: Melssj5 on May 23, 2008, 09:56:47 pm
then I guess I must do all movements (all crafts and all bullets) on a same thread??. Actually each client has an Atention class on the server side that moves its craft.
Title: Re: Flier Match
Post by: raft on May 29, 2008, 12:12:50 am
7.- No problem. You can simply wrap your stream into a GZIPOutputStream/GZIPInputStream. That's basically all that has to be done to zip the data.

this works for you since (as far as i know) you send data continuously. if you send data only when required (as i do in karga) you will run into problem: ie: you cannot guarantee all your data is sent after a flush

these  compressed input/output stream pair (http://www.dcl.mathcs.emory.edu/downloads/h2o/doc/api/edu/emory/mathcs/util/io/CompressedOutputStream.html) by Dawid Kurzyniec are designed for this purpose. see the discussion in javadoc. i use them in karga. they work standalone, just copy the two source files and they will work.

i have a link to dawid's home page in karga's credit page but it seems to be dead. google for it if interested

r a f t
Title: Re: Flier Match
Post by: Melssj5 on May 29, 2008, 12:15:36 am
Thanks I will check it for sure later. Now I am running in problems for changing the way in which everything is moved inside my game, I have still to migrate some stuff before worring about the size of my stream.
Title: Re: Flier Match
Post by: EgonOlsen on May 29, 2008, 08:05:30 am
this works for you since (as far as i know) you send data continuously.
I wasn't aware of this issue...however, the stream has a finish()-method. Doesn't that help? Anyway, i'm not using this on the socket's stream directly but on ByteArrayXXXStreams, so that i can close the GZIPXXXStream directly after reading/writing. That way, the data should have been written correctly. I'm then sending/receiving these compressed byte arrays over the uncompressed sockets' streams. I'm doing this, because not everything should be zipped. I also include some status data (length, type,...) that has to remain uncompressed because it controls the reading from the actual stream.
Title: Re: Flier Match
Post by: raft on May 29, 2008, 11:31:06 am
i'm not sure if finish will help. it may help writing but reading may be problem. you may need to initiate another gzip in, not sure..

your method of compressing byte array streams then writing should obviously work. i just prefered the other way as it's completely transparent to user. just writing to an ordinary stream

Title: Re: Flier Match
Post by: Melssj5 on May 29, 2008, 04:13:12 pm
well, Actually I am using ObjectInput/OutputStreams constructed using the getInputStream and getOutputStream from the Socket. I used to have a lot of delay until I set the setTcpNoDelay to true.

I am using this becausse Sometimes I have to send object3D, World, craft parameters, etc. So sending them as bytes will require a lot of extra work on my project. Which should be the best aproach to do. So I have to do this????:

Code: [Select]

CompressedOutputStream cos=new CompressedOutputStream (Socket.getOutputStream);
ObjectOutputStream oos= new ObjectOutputStream (cos);
oos.writeObject (whatever);

Title: Re: Flier Match
Post by: raft on May 29, 2008, 04:27:36 pm
i use ObjectInput/Output streams too, constructed over a deflater/inflater stream over socket streams. it's arguable if this is the best approach but it certainly makes things easier.

just make sure you call flush and reset on ObjectOutputStream after sending one bulk of data to make it independent of others bulks.

for sending object3d and world:  i wont do that, they are simply too big objects to send over network
Title: Re: Flier Match
Post by: Melssj5 on May 29, 2008, 04:29:15 pm
I JUST SEND THE WORLD ONCE TO EACH CLIENT AT THE BEGGINING OF THE GAME. AND A OBJECT3D WHEN A NEW PLAYER GETS IN.
Title: Re: Flier Match
Post by: Melssj5 on July 12, 2008, 01:28:33 am
Well, I have to say it. This project is dead, I am dissapointed of everything and I wont continue this. :'( Anyway, I wont delete it at all as the other times. Egon, May I upload it to the download section with the rest of third party apps to anyone can continue it if wanted?

Or If anyone is interested on finishing it for me for a price just let me know.
Title: Re: Flier Match
Post by: EgonOlsen on July 12, 2008, 07:00:58 pm
Bad news... :'( Anyway, i can of course host the current state for download on jpct.net. Just send it over and i'll upload it next week.
Title: Re: Flier Match
Post by: Melssj5 on August 23, 2008, 12:09:19 am
Well, I was waiting to see if I can put it in English, but I wont, on this weekend I will public the project as is. Hope somebody can found it usefull, intersting or even may want to finish it.
Title: Re: Flier Match
Post by: fireside on August 23, 2008, 02:34:26 am
Was that written for internet multi-player?
Title: Re: Flier Match
Post by: Melssj5 on August 23, 2008, 11:32:23 pm
That was the idea but I never tested in on internet just from LAN and works at a good speed. on Monday I will post the project.
Title: Re: Flier Match
Post by: fireside on August 24, 2008, 12:33:24 am
I've been trying to read up on it a little. The only thing I would like to do someday is write some turn based games, but I think it probably wouldn't be allowed on a free site like the one I have.  Apparently I would write a little server socket program and then have to start it somehow on the server site so it would communicate with the applets.  I guess it's ok to talk to the applets from the host where the applets got downloaded, but applets can't talk to each other.
Title: Re: Flier Match
Post by: Jonas on August 24, 2008, 09:51:43 am
I guess it's ok to talk to the applets from the host where the applets got downloaded, but applets can't talk to each other.

I think signed applets do allow other connections..but not a 100% sure.
Title: Re: Flier Match
Post by: EgonOlsen on August 24, 2008, 12:22:15 pm
Yes, they do. Plus, IIRC, there is a RFE that says that applets should be able to talk to other IPs than the one of its server without being signed, because it's an unneeded restriction. Things don't get more unsafe by enabling it. 
Title: Re: Flier Match
Post by: fireside on August 24, 2008, 04:24:37 pm
OK, I'll try to look at things from that angle, then.  If the applets could talk to each other there might be some way I could do it on my site.  I'm not sure how hard signed applets are or anything.  I like unsigned because it keeps everything simple.
Title: Re: Flier Match
Post by: raft on August 24, 2008, 05:35:55 pm
signed applets can connect anywhere but the problem is most computers wont allow incoming connections due to firewalls etc
Title: Re: Flier Match
Post by: fireside on August 25, 2008, 12:40:19 am
There's this other way, not sure if it would work out for me or not, but they do an http message and a cgi script.  It's supposed to work through a firewall.  I just want to do turn based games so I don't need much speed.
Title: Re: Flier Match
Post by: Melssj5 on August 25, 2008, 04:03:22 pm
Well, signing applets is easy, you just have to find a tutorial and follow the steps, there is nothing from the other world to do. The problem will be that each clietn will have the same applet and then the server code will be running on all clients and you have to code a way in which only one acts as a server or something. Applets are downloaded and runs from each client machine.

Maybe if you put your server code on a servlet on you hosting.  :-\ :o
Title: Re: Flier Match
Post by: fireside on August 25, 2008, 04:29:22 pm
Quote
Maybe if you put your server code on a servlet on you hosting.

I don't think they would like that, but I don't really know.  Usually there don't like it when you use sockets.  I can upload a jar, so if I could start it from a page it might work.  I think the http thing might work.  I might experiment with it.  It's not like I need to constantly update.  I just need turn information.  Three floats for a simple vector would give position information.
Title: Re: Flier Match
Post by: Melssj5 on August 25, 2008, 04:34:30 pm
Yes but I mean using the servlet to give the attention. And you can also keep running a program that has the server logic. The problem is that they usually dont like when you use a large amount of processor too. So the best solution is to have a dedicated server. How much expensive is that???
Title: Re: Flier Match
Post by: fireside on August 25, 2008, 04:37:21 pm
Quote
How much expensive is that???

I just have a phone modem right now.  There is a possibility I can get high speed for almost the same price if I quit using my phone and use internet phone instead. 
Title: Re: Flier Match
Post by: raft on August 25, 2008, 04:40:31 pm
There's this other way, not sure if it would work out for me or not, but they do an http message and a cgi script.  It's supposed to work through a firewall.  I just want to do turn based games so I don't need much speed.

that's true for outgoing connections. for direct applet to applet communication (without routing data over server) you will need to accept incoming connections. firewalls will prevent that. furhermore most of the time you wont get real IP but an local area IP. if you want your game work over internet only reliable solution is to route data over server IMHO. but of course as you said that requires server side components.

i can suggest http://jsp-servlet.net/ as a java hosting company. karga is hosted there. minimum package costs $13.95 a month.

http://www.myjavaserver.com/ provides free java hosting but it does not accept new accounts at the moment. and it's down most of the time :/
Title: Re: Flier Match
Post by: Melssj5 on August 25, 2008, 04:47:22 pm
I was reading the policies from http://jsp-servlet.net/  and I guess is not an option for hosting game servers. Look at this:

Restriction:
"Programs that consume an excessive amount of CPU run time or Random Access Memory (RAM) are not permitted. Excessive use can have an adverse effect on the performance of the web server. Each user may get 5MB of RAM, the "right" to use 10% of the processor for 3 seconds maximum every minute."

a game server of course must use more than 5 MB of ram and of course more than 10% for 3 seconds each minute.
Title: Re: Flier Match
Post by: raft on August 25, 2008, 04:54:18 pm
well that policy may be out of date or something. karga is hosted there till the very beginning. the lowest bronze package was limited to 16m jvm and it was quite enough for me. this 16m contains both tomcat and karga server. now they raised it to 64m and it's more then enough if you do NOT do heavy 3d calculations on server side
Title: Re: Flier Match
Post by: Melssj5 on August 25, 2008, 04:58:21 pm
Well, maybe they dont know what are you doing with your hosting. I will denounce you rigth now.  8)
Title: Re: Flier Match
Post by: raft on August 25, 2008, 05:08:09 pm
 :o ;D
Title: Re: Flier Match
Post by: Melssj5 on August 25, 2008, 09:27:48 pm
The most basic dedicated server I found is:

AMD Sempron 2400
1 GB RAM
2 x 80 GB (7200 rpm)
Internet - 100 Mbit Full Duplex
CentOS 5

is at 250 USD each month.
Title: Re: Flier Match
Post by: fireside on August 25, 2008, 11:54:18 pm
That's well out of my budget, which is basically zero right now. ;D 
I can't do applet to applet, but I might be able to have applets check in somehow and get updated from a database.  This would be for something where maybe 3 or 4 people were playing together.  I can have mysql databases on my site and I can use php scripting. My allowed traffic is pretty good.  Something like 20 gig per month.  I'm still at zero percent. ;D
Title: Re: Flier Match
Post by: Melssj5 on August 26, 2008, 12:00:45 am
I guess that would decrease the performance a lot. If there wont be a lot of procesing then you should consider maybe putting the server code on a servlet and using the servlet to receive requests and give responses.

Maybe the servlet can act as a router and redirect the frames sent from the applets, and letting be one of those applets to be the server. ALL of this are complex stuff, you should first finish your game and when all is fine when porting it from the lan to the web.

Maybe getting a cable connection and using your pc as a dedicated server. you can avoid the problem of the dinamyc IPs buying a domain or even using a service like http://www.dyndns.com/
Title: Re: Flier Match
Post by: fireside on August 26, 2008, 12:07:16 am
Quote
ALL of this are complex stuff, you should first finish your game and when all is fine when porting it from the lan to the web.

I'd rather know it's possible before I write a game.  I don't have much purpose for a lan game.  I'll be writing single player games for a while and then maybe experiment with some network things to see if there's some way I can do it very cheaply.  It would need AI for when people expectantly quit anyway.
Title: Re: Flier Match
Post by: Melssj5 on August 28, 2008, 04:59:39 pm
Hi again, I already sent the eclipse project of my game to info@jpct.net. Inside the zip file is a folder that is my eclipse project, it has 2 folders, the src and the bin.

there are also some spanish text files, just ignore them.

The code may look a kind of complicated becausse I began the game when I began learning java so, many things can be messy.

Mainly, is missing the shotting, the methods for blitting text are already coded but I never coded a complete chat because of the gui needed to write the text. There are no sound included but the methods to play sounds are included (Thanks to Paul) I used his first aproach to audio api and another one I found in internet to play mp3. I never put any audio because i never had good sounds for my game.
Title: Re: Flier Match
Post by: EgonOlsen on August 28, 2008, 07:39:36 pm
Ok, i've added it to the download section. Or simply download it from here: http://www.jpct.net/others/FlierMatch.zip (http://www.jpct.net/others/FlierMatch.zip)
Title: Re: Flier Match
Post by: Melssj5 on August 28, 2008, 07:41:13 pm
Thanks. Hope anyone want to finish it.
Title: Re: Flier Match
Post by: Melssj5 on September 26, 2008, 03:51:49 pm
LOL I checked it and I uploaded a buggy version.  :-[ I will send it again. (The fixed version)
Title: Re: Flier Match
Post by: Melssj5 on September 29, 2008, 06:50:08 am
Well, I fixed somethings and almost finished all the chat stuff. (99.99%) I guess I will work on it from time to time.
Title: Re: Flier Match
Post by: Melssj5 on October 01, 2008, 01:08:09 am
The chat stuff is finished, at least for the first release! Now just have to find soundtracks and code the shoots and stats.

ok here are the SShots. Nothing impresive:

(http://melssj5.paulscode.com/imagenes/SS/SS2_30092008.JPG)

(http://melssj5.paulscode.com/imagenes/SS/SS3_30092008.JPG)

(http://melssj5.paulscode.com/imagenes/SS/SS1_30092008.JPG)
Title: Re: Flier Match
Post by: Melssj5 on October 15, 2008, 09:53:13 pm
Well, I am ready to add the sounds to the game, all the method to play mp3 and 3d sounds are coded and tested, but I decided to first finish the shooting stuff.

I guess I will create a Bullet class that extends from Object3d to keep some information as the owner, the damage, the speed, the sound to play, etc etc. Well my mainly doubt is:

The movement should be done: in the client, in the server or both?
Title: Re: Flier Match
Post by: EgonOlsen on October 15, 2008, 10:12:20 pm
I'm doing it on the client that spawned the bullet, but most people say: Do it on the server and do some interpolation on the client (which i'm doing anyway...for all other clients, it makes no difference if the movement is caused by the server or another client). I did it this way, to reduce the lag and make the game feel more responsive. I've never tried it the other way though. I think it's done to prevent cheating and such, but to be honest: If somebody modifies Robombs and wants to cheat: So be it. I don't care, it's not WoW.
Title: Re: Flier Match
Post by: Melssj5 on October 15, 2008, 10:40:45 pm
Well, I read once a ebook in which the idea of a client-server game is to do the movements on the clients and in the server, the client moves the camera or anything until a new response cames from the server with the fixed information, in that way some lag request/responses wont make the game to be felt lag. But I am worried about the performance and the consistency between one client and all the other clients. I have the rendering Thread separated from the "event listening/network interaction" thread. so maybe a faster machine will move the bullets faster unless I make a new Thread for this "automotion" objects with a determined sleep time to be consistent. or something. but in anyway I would need to transfer the bullet position and direction from time to time and that will lag the game if the amount of bullets are high.

FOr example:

100 bullets at the same time flying in the game (100 groups of 2 simplevectros)
+
information about dead bullets (maybe 30 groups of 2 simplevectors)
+
information about where to play which animations (when a bullet hit something, maybe 30 groups of 2 simplevectors)

that will lag a lot the game, even transfering each 10 iterations.
Title: Re: Flier Match
Post by: EgonOlsen on October 15, 2008, 10:45:58 pm
I'm skipping the second part of your example, i.e. i'm not transmitting dead objects. Each client keeps track of the remote objects it knows and to which client they belong. In case that the server sends a new bunch of data from that client and some objects don't get transmitted, the client assumes that they are dead and removes them. Works fine for me.
Title: Re: Flier Match
Post by: Melssj5 on October 15, 2008, 11:26:11 pm
mm yes. anyway will lag everything shoting is free so there is no reason for people to not fill the map with as many bullets as they can.

Maybe only tarnsfering the info of the bullet (just an ID of the bullet class, position and direction) when it starts and the id of the bullet to finish it. grouped in 2 Lists. One for starting bullets and one for ending ones.  The animations of the bullets are checked and calculated on eah client, sonsidering that each server iteration refreshes all the crafts position, then it will be a good thing to trust the client to check for the impact and the server listens the collisions and upgrades the life of each client to avoid cheating.

I guess this is a good idea!
Title: Re: Flier Match
Post by: Melssj5 on October 15, 2008, 11:28:16 pm
Yes, there is no reason for the array of ending bullets!
Title: Re: Flier Match
Post by: Melssj5 on October 17, 2008, 05:21:49 pm
Well, I began coding this 2 days ago, I make a Bullet class, a Shot class and a movingThread for the bullets. I will have a Thread just for moving the bullets. On that way it wont depend on the speed of the rendering Thread nor on the lag from the server. I have not been at home this last 2 days (HANGOVER) but with a bit of luck I would have the basics of the shooting stuff by tomorrow.
Title: Re: Flier Match
Post by: Melssj5 on October 20, 2008, 03:40:12 am
Hi, I am having problems here. My problem is mainly that I am confused about how to set the initial position and direction from my bullets. I made some code here and there and I have now bullets being shot from my camera position "aparently". But I am having some problems, I guess I messed arround the rotation matrix of the camera and the bullets. Egon would you mind checking it a bit. Actually, I guess that is all that is missing from the client visulization. I have not added the shotting on the server yet. I just have a small code for shooting a bullet from my client. I will post the code tomorrow.
Title: Re: Flier Match
Post by: paulscode on October 20, 2008, 08:58:31 am
You probably already thought of this, but just in case.  When applying the Camera rotation matrix to an Object3D, you might need to clone and invert it:

Code: [Select]
myObject3D.setRotationMatrix( myCamera.getBack().cloneMatrix().invert3x3() );
Then you could translate the bullet to the Camera's position in World space.  Then fire it in the direction of Camera.getDriection().
Title: Re: Flier Match
Post by: Melssj5 on October 20, 2008, 04:37:27 pm
Thats exactly what I am doing. But the bullet is rotated 90 degrees and I dont know why. another problem is that I set the initial position of the bullet on the camera.getPosition SimpleVector but is not being fired exactly from the camera position. And when I move the camera down and lookAt the old camera position I dont look ant the center of the bullet. I also checked about the pivot of the bullet and everything is right.

I will continue trying it and post the code by tomorrow to see if I can fix it on somehow.
Title: Re: Flier Match
Post by: paulscode on October 20, 2008, 08:45:50 pm
Another thing I thought of: are you loading the bullet model from a 3ds file?  If so, make sure the orientation on it is correct after loading.  I usually have to do something like this to make the object in jPCT match what the 3DS Max orientation looks like.  I always do this right after loading a 3DS model, before adding it to the world:

obj.rotateX( (float) Math.PI / 2 );
obj.rotateY( (float) Math.PI );
obj.rotateZ( (float) Math.PI );
obj.rotateMesh();
obj.setRotationMatrix( new Matrix() );

I'm not sure why the position is wrong though.  Could you post a link to the bullet model you are using, and I'll play around with it to see if I can help figure something out.
Title: Re: Flier Match
Post by: Melssj5 on October 20, 2008, 08:48:22 pm
Well, I exported to a md2 model as is a very simple model. I checked the model orientation inside max and seems to be well, I will post everything by tomorrow, today I am at office and forgot my pen drive.

I will check that and try to post the project tomorrow.
Title: Re: Flier Match
Post by: paulscode on October 20, 2008, 09:46:56 pm
Ran a couple of tests on MD2 files created with 3DS MAX + QTip, and discovered that there is also an orientation difference with the MD2 format.  Unlike 3DS files, MD2 files only needed to be turned 90 degrees around the Y-axis.  Do this right after loading the file:

Code: [Select]
        myObject.rotateY( (float) Math.PI / 2 );
        myObject.rotateMesh();
        myObject.setRotationMatrix( new Matrix() );
Title: Re: Flier Match
Post by: Melssj5 on October 20, 2008, 09:51:09 pm
Thanks, that should solve the problem about the bullet orientation. But I am still having the problem that when setting the position of the bullet on the camera position , it is placed near but not in the exact place.
Title: Re: Flier Match
Post by: Melssj5 on October 21, 2008, 04:38:31 pm
 :-[ :-[

The problem about not being shot from the camera center was a problem when modeling the bullet. It was moved a bit from the center. Anyway rotating it the PI/2 over the Y axis was helpfull too. Now the bullets are being fired correctly.

Now my problem is that they doesnt fire any collision event. I added a collisionListener to the bullets but they does not fires the event. I have used the collision listener before when moving the crafts on the server but when shooting the bullets on the client they dont.

Basicly.

When I create the bullet I add the colissionlistener, the bullet and the map has CHECK_SELF | CHECK_OTHERS as the collision mode. I am calling the checkforcollision and checkforcollisionelipsoid methods and they doesnt fire any event. The project is posted at:

melssj5.paulscode.com/FlierMatch.zip

Egon, can you please replace the one in the download section with this new one, is still not finished but it is closest to be finished. And please can any one help me with the collisionListening on the bullets?

About the code: Well, I have this classes:

 - BulletThread (Thread for moving the bullets and detecting the collisions)
 - ManejadorDisparos ("ShotManager"--> add the bullets to the List of bullets to be moved, moves the loist of bullets, creates the predefined bullet types to be used in the game)
 - Disparo ("Shoot"--> Is the shot class, it has the position, direction, speed, and the bullet. Has the methods to move the bullet it has)
 - Bullet (Is an inherited class from Object3d that has the damage, type, sounds to play)

The code and var names are in Spanish and the code is a kind of messy but any help would be very appreciated. Actually the shots are being fired with the control key or the space key. They are being shoot from a class called ManejadorEventos an the end of the method EventosJuego.
Title: Re: Flier Match
Post by: EgonOlsen on October 21, 2008, 07:56:52 pm
Judging from a quick look and fighting with spanish method and class names ( ;) ), it seems to me that your code assumes that an Object3D created from another one by new Object3D(<Object3D>) inherits its source's listeners. That's not the case. Try to add the listeners to the newly created bullet not just to the blue print.
Title: Re: Flier Match
Post by: Melssj5 on October 21, 2008, 08:00:40 pm
I am adding it to the new created bullet. I have a method on the Disparo class


public void setBulletListener (BulletListener BL) {
       bala.addCollisionListener(BL);
}


here I am adding the collition listener to the new created Bullet called "bala", bala is a global Bullet var inside the Disparo class.


Here on the ManejadorDisparos class, when I add a shot to the shot list I have:

Code: [Select]
public void addDisparo (SimpleVector pos, SimpleVector dir, int tipoBala, World mundo, Camera cam) {

Bullet bala=null;
if (tipoBala==Bullet.BULLET_BALA1) {
bala=new Bullet (bala1);
}
if (tipoBala==Bullet.BULLET_BALA2) {
bala=new Bullet (bala2);
}
if (tipoBala==Bullet.BULLET_MISIL1) {
bala=new Bullet (misil1);
}
if (tipoBala==Bullet.BULLET_MISIL2) {
bala=new Bullet (misil2);
}//CREATE THE BULLET
System.out.println ("Disparo AGREGADO EN POS: "+pos+" - DIR: "+dir);
Disparo D=new Disparo (pos, dir, SoundManager, bala, mundo, cam);
                          //SHOT CREATED WITH THE NEW BULLET
D.setBulletListener (ManejadorColisionesBalas);
                          //COLLISIONLISTENER ADDED TO THE NEW SHOT
disparos.add (D);
}


May it be due to my Bullet class is a subclass of Object3D and maybe is losing the capacity of firing events???? I am just guessing!
Title: Re: Flier Match
Post by: EgonOlsen on October 21, 2008, 08:07:04 pm
Yes, my fault...i didn't mean the listener but the collision mode. It won't be cloned either.
Title: Re: Flier Match
Post by: Melssj5 on October 21, 2008, 08:12:34 pm
mmmmmmm Yes, I set The collision mode before constructing a new Bullet from the model. Well, I guess I should use a clone method the have an exact copy? I will set the CollisionMode after creating the bullet to see if it helps, I will post the results by tomorrow! Thanks a lot, and please replace the old version of my project beucasse that was a version in which nothing works! Hopefully I will finish the first realease of the game sooner. And of course after that I will have to spend some time modelling some good maps, spacecrafts, bullets, misiles, etc!
Title: Re: Flier Match
Post by: EgonOlsen on October 21, 2008, 08:23:33 pm
cloning is just another way to get the same effect as new Object3D(<Object3D>). Just set the mode afterwards. Maybe i should clone it too...i'm undecided... ???
Title: Re: Flier Match
Post by: Melssj5 on October 21, 2008, 11:06:25 pm
Is the collisionMode keeped inside the world when serializing it?

Each tima a new player gets it, I send all the World from the server to the specified client. But I do not know if those objects inside that world will have the same collisionMode set on them.
Title: Re: Flier Match
Post by: EgonOlsen on October 21, 2008, 11:13:19 pm
It should be serialized, yes.
Title: Re: Flier Match
Post by: Melssj5 on October 24, 2008, 10:58:22 pm
Well, yes now the listener is firing the events. Thanks. I a running into a problem now. A problem os my design. Is about precision. Actually, for each iteration the client sends the events to the server and the server moves everything, so I have a defined speed for turning and moving, but in a FPS the most important thing is the presision of the movements, for example:

         A.                         B.                           C.
         |---------5f--------|----------5f---------|
         |-----------------distance----------------|


Supose my cam is lokking at A and for each event I turn certaing degree to make the camera look at C.

Then I will never be able to aim B. point.  making it turn a lower angle or move a smaller distance will make the game too slow. Any idea about this issue?

I was thinking about moving the cam a smaller angle/distance. But separating the moving thread from the networking and from the rendering threads. The problem is that letting a free independent movement
on the client will lead to cheating. Thats why evertything is controled on the server.
Title: Re: Flier Match
Post by: EgonOlsen on October 28, 2008, 11:41:49 pm
Maybe the client can execute the movement and the server does some kind of simple check to see if the movement was reasonable and rejects it if not?
Title: Re: Flier Match
Post by: Melssj5 on October 29, 2008, 05:20:44 pm
mm I was thinking on this:


for each iteration the client sends an array with the events id to the server (As actually does)

the server takes that information and moves the craft inside the server World (As actually does)


But instead of sending the fixed position, rotation matrix of all the crafts, and upgrading that into the client. I will let the cliente to do the movement for about 6 or 8 iterations, and each 8 or 6 iterations I will send the fixed position and rotation Ms of all the player (Aas actually does). If not cheating then it should be no difference for the player, the position and direction will be changed only if cheating. Anyway an aimbot can always be implemented.
Title: Re: Flier Match
Post by: C3R14L.K1L4 on February 01, 2009, 06:50:25 pm
Quake 3 Arena based games do like Egon said. Players send events to the server (usually running at 20 events / second, server side cvar sv_fps ;)) which does all the checking and logic of the game. Then the clients 'pool' the server for world events, and interpolate these. For making shure the game is fluid (like shooting and not waiting to the server's acknowledge), the client may run a kind of event prediction. That's why when someone connected to the server looses communication and walks (fires, etc.), it may happen that the player actually moves or fires for some little time (on the average of miliseconds), but locally!
Title: Re: Flier Match
Post by: Melssj5 on February 02, 2009, 04:44:28 pm
mm well, the project is dead actually. I dont eve remember the state of the project, I have not seen it in more than 4 months. Maybe I could retake it later.