Show Posts
|
|
Pages: [1] 2 3
|
|
1
|
Game Development / Game Play & Game Design / Re: Looking for help (2D Java)
|
on: 2005-01-29 07: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 17: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.
|
|
|
|
|
4
|
Games Center / Archived Projects / Re: Robotron 4096
|
on: 2005-01-25 11:51:42
|
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 08: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 19:56:00
|
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 09: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 09: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 09: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 19: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 07: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 ?!
|
|
|
|
|
14
|
Game Development / Networking & Multiplayer / Re: Problem with first NIO code
|
on: 2005-01-12 17: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.zipI 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 !
|
|
|
|
|
16
|
Game Development / Newbie & Debugging Questions / Re: collision detection on diagonal planes
|
on: 2005-01-11 17: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.
|
|
|
|
|
18
|
Game Development / Networking & Multiplayer / Re: Problem with first NIO code
|
on: 2005-01-11 15: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=0My 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 {
public HashMap out_buffers = new HashMap();
public ArrayList keys = new ArrayList();
public ArrayList messages = new ArrayList();
Charset charset = Charset.forName("ISO-8859-1"); 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 (;;) { 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) { System.out.println("New incoming connection.");
SocketChannel newsc = ((ServerSocketChannel) key.channel()) .accept(); newsc.configureBlocking(false);
SelectionKey selectKey = newsc.register(selector, SelectionKey.OP_READ);
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();
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) { 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) { 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 09: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 08: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 20:27:02
|
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 16: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 19: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 16: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 20: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 13: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.zipnow 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 12: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 12: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.
|
|
|
|
|
30
|
Games Center / 4K Game Competition - 2005 / Re: Tilt 4k
|
on: 2005-01-04 23: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.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|