Author Topic: Flier Match  (Read 99817 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Flier Match
« Reply #60 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.

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: Flier Match
« Reply #61 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.
Nada por ahora

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Flier Match
« Reply #62 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 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

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: Flier Match
« Reply #63 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.
Nada por ahora

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Flier Match
« Reply #64 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.

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Flier Match
« Reply #65 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


Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: Flier Match
« Reply #66 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);

Nada por ahora

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Flier Match
« Reply #67 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

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: Flier Match
« Reply #68 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.
Nada por ahora

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: Flier Match
« Reply #69 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.
Nada por ahora

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Flier Match
« Reply #70 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.

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: Flier Match
« Reply #71 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.
Nada por ahora

Offline fireside

  • double
  • *****
  • Posts: 607
    • View Profile
Re: Flier Match
« Reply #72 on: August 23, 2008, 02:34:26 am »
Was that written for internet multi-player?
click here->Fireside 7 Games<-

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: Flier Match
« Reply #73 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.
Nada por ahora

Offline fireside

  • double
  • *****
  • Posts: 607
    • View Profile
Re: Flier Match
« Reply #74 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.
click here->Fireside 7 Games<-