Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3
1  Game Development / Game Play & Game Design / Re: Looking for help (2D Java) on: 2005-01-29 06:53:35
well this is more a Networking problem than rather a Design Problem.

Normally, you have outgoing messages queues, a Thread sending messages and a Thread receiving them (or with NIO a single thread does both) and then you just add the message to the respective Player Queue.
2  Games Center / 4K Game Competition - 2005 / Re: T4XI on: 2005-01-26 16:39:18
do something like GTA1, giving the user a real feeling of speed, zoom the camera out with increasing speed...forget about the weapons and do something like DRIVER instead, where the whole point is to drive from A to B but encountering numerous obstacles like Police, Road Blocks etc.

Make it really hard to complete but add nice and easy controls and I'll surely buy it.
3  Games Center / 4K Game Competition - 2005 / Re: T4XI on: 2005-01-26 11:40:57
Is there a working link for this ?
4  Games Center / Archived Projects / Re:  Robotron 4096 on: 2005-01-25 10:51:42
Quote


They very rarely spawn directly on top of you. However, they do tend to spawn very near, so keep moving and watch your radar! You almost always need to get a move on it when they first respawn! (The times when they seem to be on top of you, they usually snuck up from behind. :-))

I personally have gotten to Level 10, so I know others can do better! :-)


I am speaking about the level begin...before I even see them on the radar or sth. They just pop out of nowhere and not even 0.5 sec and I am dead.
5  Games Center / Archived Projects / Re:  Robotron 4096 on: 2005-01-25 07:39:33
Hm, quite good...bad I have some comments:

make them SPAWN at a certain distance. I player like 3-4 times and every time, in level 5 they spawned within me and I instantly died. Very annoying and made me stop playing.
6  Games Center / 4K Game Competition - 2005 / Re: Stag Party 4k on: 2005-01-23 18:56:00
Quote


Indeed, mlk has managed to find a way of completely f**king up 6800's.

*Warning*

DO NOT RUN THIS IF YOU HAVE A 6800.

It totally shagged my machine in exactly the same way as KONI.

Its almost like you are setting full screen mode every game loop mlk!?!



Not only 6800, my girlfriend has a NVidia 5700FX and she get's the exact same error, only the game isn't freezing the machine, it has the same flickering but without freezing the machine.

Seems to me as if fullscreen was set at each repaint or if it would try entering fullscreen in an endless loop.
7  Games Center / 4K Game Competition - 2005 / Re: Stag Party 4k on: 2005-01-23 08:43:20
wow, while launching webstart, your program tried going to Fullscreen...BUT then it just freezed my PC.

Windows XP, Java 1.5, Nvidia GeForce 6800

It actually couldn't go to Fullscreen (it also couldn't on my girlfriend's PC) and then resulted in a screen flickering and freeze of the system.
8  Games Center / 4K Game Competition - 2005 / Re: T4XI on: 2005-01-22 08:29:30
Really great game. I'd prefer a bit more speed, larger roads => more action. You could zoom out with increasing speed (GTA anyone).

Although, could you please explain how you did that 3D Thing with the houses ?
9  Game Development / Game Play & Game Design / Re: Getting off the ground on: 2005-01-22 08:23:14
At university, we have a special course on how to organise yourself BEFORE coding. We get a quick overview on UML, OCL but also on class diagrams, protocol diagrams, time diagrams, Use Cases etc.

It is never a waste of time to THINK and to STRUCTURE before starting the real developpment.
10  Game Development / Newbie & Debugging Questions / clear line between Swing and code on: 2005-01-20 18:15:16
I am currently writing a Monopoly Game for a project and I have some problems separating the GUI from the main game code.

I use a network connection thread and a main game thread for the game code. Now, when I want to update the GUI, how can I do that ?

a) Have a Thread running in the GUI looking for changes in the main game data and having it update itself ?

b) Use SwingUtility.invokeLater() in the main game Thread. The problem is here, that I have an anonymous Runnable object and I can't get external variable values into this object ?

c) Use another method ... I don't know yet ?!


So, what is the secret to that ?
11  Java Game APIs & Engines / Java 2D / Re: pacman pathfinding on: 2005-01-14 06:54:15
As I haven't used any path algorithms yet but have heard about the shortest path alrogithm of Dijkstra in our math course (in the context of graphs) and in our TCP/IP networking course, I was wondering if anybody would know of the performance difference if implemented in a game.

You would actually need to calculate a cost for each vertex but if you consider each square on the field as a point and the vertex has a distance of 1 to it's neighboors so the weight of the vertex would be 1.

With a field of let's say 32*32, that would give 32*32 points and each point is connected to it's neighboors with a vertex of weight 1.

Any idea ?!
12  Game Development / Newbie & Debugging Questions / Re: Moving files on: 2005-01-12 20:31:24
I know this will make you wanna cry but: g0t PHP ?

In PHP, it actually takes...hm, lemme see... 1 line  Grin
13  Games Center / 4K Game Competition - 2005 / Re: Pang 4K on: 2005-01-12 16:42:32
Really great game, although a lot of flickering for the balls...and I am running on a P4 2.8 with a Geforce 6800 GE.
14  Game Development / Networking & Multiplayer / Re: Problem with first NIO code on: 2005-01-12 16:37:04
Well well, as I really couldn't get any satisfying answer at first and because I am so thickheaded, I forced myself and wrote a small SERVER/CLIENT Chat System with NIO to get some experience with NIO.

the complete source can be found here:

http://www.martialartsmovies.net/chat.zip

I hope it helps newbies to understand the NIO functionalities better.

The Server saves all the SelectionKeys and for each SelectionKey, a queue (ArrayList) of messages (String) he still needs to send to this SelectionKey.

I use synchronized functions in the Messages Class for the Client to avoid any problems when multiple messages are received before the messages are read or when the client wants to read a message and there is none etc...(usual multi-threads problem)

If you find any mistakes or if you have suggestions, please post them here.

THANKS !
15  Game Development / Networking & Multiplayer / Re: Possible to work with java.io on: 2005-01-12 11:21:07
IBM has a great tutorial about scripting a multi-threaded chat server with java.io:

http://www-106.ibm.com/developerworks/edu/j-dw-javachat-i.html

Enjoy
16  Game Development / Newbie & Debugging Questions / Re: collision detection on diagonal planes on: 2005-01-11 16:11:56
In my destructible terrain demo, I use a collision map and check with the position of the object if it is a collision or not.

I hope this topic is about how to react physically to an object collidion with a vertical plane instead of being a "how to know if an object has collided" topic.

Because what I wrote was mainly how to react and not how to detect a collision.
17  Game Development / Networking & Multiplayer / Re: Problem with first NIO code on: 2005-01-11 15:28:30
the problem I see here is when...let's say...a READ comes when the WRITE hasn't been done yet for each connection.

Then the out buffer will be overwritten ?!
18  Game Development / Networking & Multiplayer / Re: Problem with first NIO code on: 2005-01-11 14:41:25
I've already read them several times, as well as the whole:

http://forum.java.sun.com/thread.jspa?threadID=459338&start=60&tstart=0

My problem is fairly simpel but I can't seem to find a solution:

I want a simple chat server where, when a client sends a message, every client gets this message.

I have experimented with incoming, outgoing queues...complicating things with each try. There has to be a good solution but I can't figure out which one. Until now, I came up with this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.nio.*;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class Server {

      // HashMap where we store the ByteBuffer of each SelectionKey
     public HashMap out_buffers = new HashMap();

      public ArrayList keys = new ArrayList();

      public ArrayList messages = new ArrayList();

      Charset charset = Charset.forName("ISO-8859-1"); // England and most of

      // Europe

      public Server(int port) throws IOException {
            System.out.println("Start init.");

            Selector selector = Selector.open();

            ServerSocketChannel ssc = ServerSocketChannel.open();
            ssc.configureBlocking(false);

            ServerSocket ss = ssc.socket();
            InetSocketAddress address = new InetSocketAddress(port);
            ss.bind(address);

            ssc.register(selector, SelectionKey.OP_ACCEPT);

            System.out.println("Finished init: listening on port " + port);

            for (;;) {
                  // Selector.select() is blocking
                 int num = selector.select();

                  Set selectedKeys = selector.selectedKeys();
                  Iterator it = selectedKeys.iterator();

                  while (it.hasNext()) {
                        SelectionKey key = (SelectionKey) it.next();
                        it.remove();

                        if ((key.readyOps() & SelectionKey.OP_ACCEPT) == SelectionKey.OP_ACCEPT) {
                              // new Connection
                             System.out.println("New incoming connection.");

                              SocketChannel newsc = ((ServerSocketChannel) key.channel())
                                          .accept();
                              newsc.configureBlocking(false);

                              SelectionKey selectKey = newsc.register(selector,
                                          SelectionKey.OP_READ);

                              // create a bytebuffer for this SelectionKey
                             keys.add(selectKey);
                              out_buffers.put(selectKey, ByteBuffer.allocate(512));

                        } else if ((key.readyOps() & SelectionKey.OP_READ) == SelectionKey.OP_READ) {

                              SocketChannel newsc = (SocketChannel) key.channel();

                              // we use the SelectionKey to get the buffer
                             String message = new String();
                              ByteBuffer buffer = ByteBuffer.allocate(1024);
                              int bytesEchoed = 0;

                              while (true) {
                                    buffer.clear();
                                    int r = -1;

                                    try {
                                          r = newsc.read(buffer);
                                    } catch (IOException e) {
                                          System.out.println("Client closed connection.");
                                    }

                                    if (r <= 0) {
                                          if (r == -1) {
                                                // the client has disconnected
                                               newsc.close();
                                                keys.remove(key);
                                          }
                                          break;
                                    }
                                    buffer.flip();
                                    message = message.concat(charset.decode(buffer)
                                                .toString());
                                    messages.add(message);
                              }

                              if(message.length() != 0)
                                    System.out.println("Message received:" + message);

                              for (int i = 0; i < keys.size(); i++) {
                                    SelectionKey tmpkey = (SelectionKey) keys.get(i);
                                    out_buffers.put(tmpkey, charset.encode(message));
                                   
                                    tmpkey.channel().register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE );
                              }

                        } else if ((key.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) {
                              //System.err.println("Ready for write");
                             SocketChannel newsc = (SocketChannel) key.channel();
                              ByteBuffer out = (ByteBuffer)out_buffers.get(key);
                              newsc.write(out);
                              if (!out.hasRemaining()){
                                    key.channel().register(selector, SelectionKey.OP_READ);
                                    out_buffers.remove(key);
                              }
                        } else {
                              System.err.println("Unknown key type");
                        }
                  }

            }
      }

      public static void main(String[] args) {
            if (args.length != 1) {
                  System.out.println("Usage: java Server port");
            } else {
                  try {
                        new Server(Integer.parseInt(args[0]));
                  } catch (NumberFormatException e) {
                        System.out.println("Portnumber must be an integer.");
                  } catch (IOException e) {
                        e.printStackTrace();
                  }
            }
      }
}
19  Game Development / Networking & Multiplayer / Re: Problem with first NIO code on: 2005-01-11 08:57:52
I came up with something but have no idea wether this works or not:

1. register every key to READ only.
2. make a ByteBuffer for every key
3. if message received, get a list of all the keys and try to write in their bytebuffer until limit is reached. If limit is reached, set them to WRITE if not, message is sent and we are happy.
4. if key comes in WRITE, write from their bytebuffer until limit. If limit leave WRITE, else set them to READ.


Does this work ?
20  Game Development / Networking & Multiplayer / Problem with first NIO code on: 2005-01-11 07:26:17
I was playing with NIO and came up with the following questions to which I couldn't find the answer even after hours of research:

1. I want to write a very basic IRC Server and want to send a message to every user connected on the server. So when I read a message from a key in OP_READ state, I save the message somewhere and when a key arrives in OP_WRITE state, I write the message in the channel.

But how can I make sure to have written the message to every connection once. I mean, let's suppose some channels are occupied sending data, then they might miss the message. Or perhaps a connection is really fast and comes 2x in OP_WRITE state, then he gets it twice.

Do I need to keep track of the clients and save to whom I wrote the message already ?

2. When I get a new connection, I set the connection to OP_READ|OP_WRITE but as i am in an infinite loop and OP_WRITE is ready all the time, it gives me 100% CPU usage ?

So should I not set the channels to OP_WRITE and just try to find out when to set them to write...or how is this handled ?
21  Game Development / Newbie & Debugging Questions / Re: collision detection on diagonal planes on: 2005-01-10 19:27:02
Quote
im still in my planning phase, so some thought may be unfinished.
if all bricks were standard rectangles i needed only to test if the point on which the direction*speed vector is pointing lies within the bounding box.

now for the polygons. tom, you got a main problem:
even if i store all normales for each plane i additionally need to know the exact intersection point.
i only know one way to test this, to calculate the intersection of both lines (the one is the plane itself, the other is the line following the ball's direction vector).
but line intersection is pretty expensive so i want to consider all possible methods before using them ...


what about what I wrote ?
22  Game Development / Newbie & Debugging Questions / Re: collision detection on diagonal planes on: 2005-01-09 15:09:38
in my demo of "destructible terrain" in the java2d forum, I was using the following method:

- check for collision
- normalize the speed vector
- backtrace the trajectory until exact collision point found
- do an approximation on the angle of the surface:
calculate dy/dx of a small surface, like from collision point - 2 to collision point + 2. On cp + 2 and cp - 2, we always go up or down to find the exact surface point (up if inside object and down if outside object). this gives you the surface angle

I know this method isn't perfect but worked great in our case. There could be some errors on extreme situations where you hit the edge of something.
23  Games Center / 4K Game Competition - 2005 / Re: Lander 4K on: 2005-01-06 18:57:16
I've updated it several times since people complained it would be too hard and couldn't land once after 10-15 tries.

I also think it is way too easy, I can safely land all the time without crashing once, even with the last version where there is a random gravity.

I have with the last version 4044 bytes and try to add a decreasing fuel meter with each successfull level.

The new version features:

- a life count (3 decreasing)
- a successfull level count
- fire exhaust fume for trust, left & right
- a windowed and a fullscreen mode

Enjoy !
24  Games Center / 4K Game Competition - 2005 / Re: Lander 4K on: 2005-01-06 15:04:31
I've optimised the terrain generation code and gained some bytes here and there. I've added now exhaust fire when using trust and will be adding sidewards exhaust too.

The flag for fullscreen will be in the next version and the actual version is also 1.4 compatible.

Have fun.
25  Games Center / 4K Game Competition - 2005 / Re: Lander 4K on: 2005-01-05 19:16:38
you mean the transparent zones of the aicraft ? Hm, a pixel perfect collision detection is to space-consuming, I only test the collision on the bounding box. As for the free win, how did that happen ?

Was the landing zone at the same place as the launch zone or what ? Because that shouldn't happen, I did pay attention to that.

@ everyone:

does anybody know how to compile with jdk 1.5 to be compatible with 1.4 ?

is it something like:
javac -source 1.4 -target 1.4 G.java ??
26  Games Center / 4K Game Competition - 2005 / Re: Lander 4K on: 2005-01-05 12:19:24
Here come's the new version (still 1.5 though, don't know how to compile for 1.4 with jdk1.5; perhaps javac -source 1.4  -target 1.4 or something).

First the file:

http://www.martialartsmovies.net/lander.zip

now the new changes:

- a new ship grafic, expect the version with the flame burst soon
- a new map generator for hours of fun
- 4017 bytes so I've got some bytes to spare for the level count system.

@dranonymous

thanks for all your great suggestions. As for the fuel problem, I was able to beat every generated level at the first try. My girlfriend needed the first time 10 tries and after that crashed 2-3 before landing.

I don't think it's a computer problem with different CPU speeds, I've got a 20 ms timer and fuel is used if space pressed during a frame.

I changed the text, now it is correct english. I will also indicate somehow when the ship is slow enough to land safely. I am used to the old Lander Game and therefor know how to navigate but perhaps it's too hard for beginners. Please try again and when it's still to hard, I'll double the starting fuel.
27  Game Development / Newbie & Debugging Questions / Re: Simple Mouse Question on: 2005-01-05 11:24:22
I don't know if this is just plain stupid but what came in my mind would be to have a lookup array of int[][] where you can check the x,y coords and get the id back of the region you clicked on.

This would look like the following:


1 1 1 2 2 3
1 1 1 1 2 3
1 1 1 2 3 3
1 1 2 2 3 4

so when you click on 0,0 it would give you zone 1 p.ex.
28  Games Center / 4K Game Competition - 2005 / Re: Lander 4K on: 2005-01-05 11:20:36
still no 1.4 version but I got rid of the map image and implemented a new map generator which will randomly generate a new terrain to play with. You also got a launch and a landing zone now and you need to fly from one to the other.

I think the best way would be to go with a "xx successfull maps withouth crashing" and the fuel would decrease every map and the gravity would be random.

I don't see another possibility with a linear gameplay.

I'm also a little over the 4092 limit so I need to tweak some, expect the new version soon.
29  Games Center / 4K Game Competition - 2005 / Re: SonicRacer4k on: 2005-01-05 11:17:55
no problem here, really great game.
30  Games Center / 4K Game Competition - 2005 / Re: Tilt 4k on: 2005-01-04 22:44:11
I've just tried the mouse control and suggest you'll have a look at NEVERBALL where they have a really good mouse control system running.

Great game though, especially < 4K.
Pages: [1] 2 3
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!