Featured games (91)
games approved by the League of Dukes
Games in Showcase (578)
games submitted by our members
Games in WIP (498)
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 4
1  Game Development / Networking & Multiplayer / No stack trace for client code exceptions on: 2006-06-25 11:05:45
I've had several instances where my client code caused exceptions that were not making it to the console. Instead, the user gets silently disconnected from the server. I would have expected that any client code exceptions would lead to a complete stack trace dumped to the console.

The way it is now, subtle bugs can be very hard to find.
2  Game Development / Networking & Multiplayer / Re: Will the license allow open source tools or commercial tools to be developed on: 2006-04-12 20:07:08
I think there is a significant need in the community to get a better understanding of where the SGS is heading, with regards to the license and allowed use. I know that you cannot answer these questions, but it would be very important to open a communication channel between the people responsible for these decisions at Sun, and the community.

This is because SGS looks very interesting and powerful, but at the same time no developer can afford to invest time and ressources into a technology which may suddenly become unreachable to him - due to prohibitive license prices, or due to license restrictions.

For example, some issues that come to my mind:

  • Will non-commercial, open-source projects be possible? What if they contain content that Sun considers inappropriate?
  • What if a non-commercial project wants to cover basic costs (for bandwidth, hardware) and starts to charge a small fee, or starts to sell merchandise?
  • What if a non-commercial project lives for several years, becomes popular, and wants to become commercial?

Etc. etc. I don't expect these questions to be answered right now, but it would be important to address them eventually, and the sooner the better.
3  Game Development / Networking & Multiplayer / Re: Timing problem: sendToServer() immediately after connected() on: 2006-04-11 07:23:00
Wow, that was quick. Great news - thank you very much!
4  Game Development / Networking & Multiplayer / Re: Timing problem: sendToServer() immediately after connected() on: 2006-04-09 11:48:53
Sorry - just found out that this is actually documented in the 'known bugs' list. Until this is fixed, the sleep is explicitly recommended.
5  Game Development / Networking & Multiplayer / Timing problem: sendToServer() immediately after connected() on: 2006-04-09 11:38:53
I have created a fairly basic client and server. In the client, once I receive the connected() message, I want to send data to the server. I do that directly in the connected() method, and it looks thusly:

public void connected(byte[] arg0)
   Log.l().log(Level.INFO, "Connected");
   ByteBuffer myByteBuffer=createRequest();
   try{ Thread.sleep(1000); }catch(Exception e){}
   ccManager.sendToServer(myByteBuffer, true);

The byte buffer gets created in an extra method, but that shouldn't be the problem (I have checked that it creates a correct byte array with 6 elements. Now, this works fine, on the server side I have added a SimUserDataListener which receives the

 userDataReceived(UserID from, ByteBuffer data)

method call. However, if I remove the wait statement in the connected() method, i.e. this line:

   try{ Thread.sleep(1000); }catch(Exception e){}

then it does not work, i.e. the userDataReceived() method is NOT called. What am I doing wrong?
6  Game Development / Networking & Multiplayer / Re: Unit tests on: 2006-04-08 17:09:56

You mean objects that simulate the server on the client side and vice versa? Could work, although this would be very brittle even for minor changes in the way the server and client communicate.

Frankly, for me there is a vast discrepancy between the XP claim that unit tests can and should be written for everything, and the architectural problems of testing distributed applications. And at this time, I am not sure whether this is my lack of experience, or a more general problem.
7  Game Development / Networking & Multiplayer / Re: Unit tests on: 2006-04-07 21:39:30
Unit tests for what? Server app code? I always build my unit tests as individual test harnesses for functional modules soIm not sure I see the issue, but if you could describe what you rhinka  unit testing framework for something liek this shoudl look like we could talk about doing something for it Cool

Sorry for the late response - I was on a business trip the last week. Anyway, what I meant where unit tests for server/client interaction. For example, if I implement a user interaction that should initiate some server-side state change, it would be nice to have a unit test for that. The test would simulate (invoke the relevant method) the user interaction, and would test that the server state changes accordingly.

I know this is very demanding. It could also be that I simply lack the necessary experience for developing unit tests in client/server architectures. Therefore, if you have a better idea on how to unit test, I wouldn't mind hearing it.

What do you mean by 'test harnesses for funtional modules'? I can easily conceive tests for specific functions of the server or client, but what would be the truly critical part of a MOG would be the client/server interoperation, and I thought that it would be helpful (if not essential) to be able to test that automatically.
8  Game Development / Networking & Multiplayer / Unit tests on: 2006-04-03 12:43:34
I've looked at SGS, and think this is pretty good stuff (although I am a bit sceptical as into which direction this will head economically - once enough prestigious projects have picked this up, will the license fees be prohibitive?).

One question, though: Have you guys thought about unit tests? Is there support for them designed into the architecture? As far as I can see right now, it will be quite difficult to implement unit tests, won't it?

9  Games Center / Archived Projects / Re: Paradroidz reloaded... on: 2005-06-21 10:55:27
Couldn't see any fog of war despite OpenGL rendering (on Windows XP, JDK 1.4.2). Is there a fallback to software rendering, and if so, under which circumstances?

Also, it's maybe my clumsiness with the mouse, but it seemed as though hitting the menu items is somewhat difficult. Do you use an exact detection where the user has to actually click on the bars of the characters?
10  Game Development / Newbie & Debugging Questions / Re: problem with importing Gif into 2nd JApplet on: 2005-06-08 22:09:16
Well, frankly you are not very clear. If your problem is how to display a GIF at all, do this: Write a subclass of JComponent (since you use a JApplet), override the paintComponent() method and paint the image into the Graphics context.

As for the problem of opening another applet, I would instead instantiate and make visible a JFrame. Note, however, that any windows opened by a (J)applet will have a warning message at their bottom. If you want to run everything in a window outside of the browser anyway, it might be a better idea to have a standalone application, using Webstart.
11  Discussions / Miscellaneous Topics / Re: Java, C/C++, and performance on: 2005-06-08 22:05:11
Right, things can get very emotional in these advocacy debates. Still, this was from people I usually would not expect to blatantly make things up. I think part of the problem is that it is very difficult to set up a correct benchmark, especially between two different languages / architectures.
12  Discussions / Miscellaneous Topics / Re: Java, C/C++, and performance on: 2005-06-08 17:19:32
Thanks for your insights. The figure of 10- to 50-fold lower performance is not mine - these are numbers people came up with in conversations. Not using C++ (although I have some C++ experience from several years ago), I was in no good position to argue. Still, I have been very happy with Java throughout the last 7 years, and I would not want to change to C++ for performance reasons if not absolutely necessary and absolutely justified by hard evidence.

You are right that the high productivity of Java makes up for the lack of performance (if there is any) for most applications.
13  Discussions / Miscellaneous Topics / Java, C/C++, and performance on: 2005-06-08 11:31:42
Every once in a while, I am involved in a discussion of Java's performance, as compared to C or C++. Personal experiences vary widely, as do industry statements and research reports. While reports come up in fairly regular intervals that indicate a closing of the performance gap between Java and C++, and while some benchmarks seem to indicate a performance penalty of <1.5, personal experiences report a performance penalty more in the range of 10 to 50.

I don't use C++, and I was curious if any of you can shed some light on this matter. GUI issues apart (Swing IS slow), what do you think? I know that benchmarking is an arcane science of its own, but what is your gut feeling?
14  Games Center / Archived Projects / Re: FatMan in StrangeLand on: 2005-06-07 15:52:16
Nice variation on the pacman theme! One minor issue which may well be my fault: In mid-game, when I click into the applet area, the game area is replaced by a completely green meadow plain, with only the monsters being visible. Neither the paths nor my player icon is visible anymore. What's wrong?

Using JVM 1.5 and Firefox under Windows XP.
15  Game Development / Game Play & Game Design / Re: Tutorial Levels on: 2005-05-23 14:58:18
The difficult part is that tutorials depend strongly on game states. If the game is in a different state than expected by the tutorial script (due to the player doing something unexpected), the tutorial may break.

My impression is that commercial games solve this by putting a lot of effort into checks on the game state and into level design where the player has not too many options to go off at a tangent.

This is not feasible for low-budget / small games. I can see two options:

- Have a completely scripted tutorial, where the user triggers certain events, but cannot influence what happens. That is, the tutorial works similar to a slide show. Not very thrilling, but should work reasonably well - the main point of a tutorial, after all, is to get a visual/haptic idea of what to do to play the game.

- Leave all freedom to the player, but check for game state before continuing the tutorial. Whenever the game state is not as expected, either a) set it to whatever is required and issue a warning to the player ('you have slain the damsel in distress, not the dragon - allow me to correct this'); or b) ask the player to establish the required game state (this can be tricky, as the player may not know how to do it, or the game may not allow it)
16  Game Development / Newbie & Debugging Questions / Re: Floating point error on: 2005-05-11 10:17:43
This is probably just a problem of internal representation vs. output / formatting. Just keep in mind that the internal representation is much more precise than you need your output to be (in most cases, that is; if not, then using float/double primitives is a bad idea anyway).

For example, this works nicely:

public static void main(String[] args)
      NumberFormat nf=new DecimalFormat("0.00");
      float f = 0.0f;
      for (int i = 0; i < 10; i++)
            f += 0.1f;
17  Game Development / Newbie & Debugging Questions / Re: Sprite Modification on: 2005-05-11 10:09:01

Oh, write the game anyway, just don't attempt to make any money and let what will be, be.

Personally I would strongly recommend AGAINST such a strategy. Not making money out of a possibly IP-infringing project does not protect you from prosecution AT ALL. There are enough IP holders and lawyers out there who would pursue any infringement, no matter if there is money involved or not.

Even worse, with no revenues, any prosecution will hit you much harder.

All in all, considering the massive amount of work that goes into developing a game (even a non-commercial one), I would take the additional time it takes to generate IP-free artwork. If artwork is very important to you, it would be a good idea to associate with an artist or find open source artwork.
18  Games Center / Archived Projects / Re: Conquer - LWJGL Turnbased Strategy on: 2005-05-03 13:40:03
Nice game, fun to play.

I don't like the GUI, though: The font is hard to read, and there is a lot of visual noise (e.g. the thick bevelled borders). My benchmark for scifi-themed GUIs is this question: Would an advanced civilization in the year 3535 come up with something like this, after they had 1.5 millenia to optimize GUIs? Thus, clean, slim interfaces are usually much more appealing and convincing.

Also, the 'minimize' / 'maximize' buttons of the 'windows' do not work. In fact, my impression is that the whole window metaphor does not work very well with games, and I would simply set up fixed panels.

The biggest space for improvement, IMHO, is the movement of ships: I would try to avoid the switching between mouse and keyboard. For example, it could work like this: Player clicks on a planet and a slider bar pops up. The bar indicates a range of [0-number of ships on planet]. The player then drags the mouse across the bar to select how many ships to move. The number of ships is then shown next to the mouse pointer, and the player simply clicks on the target planet.

On a related note, I would indicate the number of ships next to each planet, since this information is available to the player anyway. As an additional tactical challenge, you could add a 'fog of war' where the number of ships on planets is given as a range (e.g. 50-60 ships), with the size of the range depending on how distant a planet is to the next friendly planet.

Hope I didn't sound too critical - I really like the game as it is, but I think the GUI could be much more user-friendly...
19  Game Development / Game Play & Game Design / Re: ActionListeners for an array of JComboBoxes... on: 2005-04-24 12:49:38
I would parameterize the JComboBox into the constructor. Here is an example with an explicit class implementing ActionListener:

class MyActionListener implements ActionListener
   private JComboBox comboBox;

   public MyActionListener(JComboBox comboBox)

   public void actionPerformed(ActionEvent e)
      String picNum=(String)comboBox.getSelectedItem();
      // ... do something ...

The problem with your approach is that x is not known at compile-time, and whereas x is in the scope of the executed code at run-time, for the implicit ActionListener implementation it is not (as it will be created at compile-time, not at run-time). The compiler wants it to be final, because then it would be possible to get the actual integer value at compile-time.

Instead of having a reference to the JComboBox for each listener instance, you could also have a class member integer which is assigned the value of x; however, I would prefer the JComboBox as it makes it clear what the stored value is about.
20  Game Development / Artificial Intelligence / Re: AI project on: 2005-04-24 12:35:15
In a way, simulating social intelligence and actually having social intelligence is the same - if we can create a reasonably social AI entity, we would be hard-pressed to proof that there is a significant difference to any of us.

It's interesting how hard it is to explain why a 'The Sims' character or the population of SimCity are not 'sufficient' in the sense of this discussion. For example, making a difference between a 'real' emotion, need or desire and a numeric value may not be fair - after all, many of our own emotions are probably rather simple numeric properties of which we keep track and which we adjust according to simple feedback loops.

The thing is: Can there be social and emotional behaviour without intelligence?

As for the language, the primary question should be which level of complexity it should cover. It is easy to conceive a language which allows for indirect speech, questions, complex tenses, expression of emotional states, etc. The problem is the more complex a language is, the harder it will be to provide the matching 'intelligent' AI.

On the other hand, below a certain level of complexity it's not much fun. For example, in a diplomacy game, it should be possible to discuss with an NPC an alliance against another NPC like this: 'Would you be interested in joining my battle against X, if I would back your conquest of island Y?' - 'Yes, but only if you refrain from fighting Z for the next ten turns' - and so on...

The problem is that for each conceivable discussion it is quite easy to set up a language and AI, but it is very hard to do so for discussions we haven't anticipated.
21  Game Development / Artificial Intelligence / Re: AI project on: 2005-04-22 11:35:27
As far as I understand SimCity, it is a very aggregated simulation - the underlying 'social entities' are probably tiles which integrate general parameters such as traffic density.

This, on the other hand, should simulate social individuals where the complete behaviours emerges from the cognitive apparatus of these individuals. In other words, whereas in SimCity a 'happiness factor' may be a simple function of [traffic density, crime rate, pollution, ...], in this case it should be the integrated happiness of all individuals which is again based on the satisfaction of individual desires, ambitions, basic needs, etc.

Ideally, it would be nice to create an AI entity which works believably in large-scale social simulations ('cities', 'nations') as well as in one-on-one dialogs with human players as well as in small-scale simulations à la The Sims.

The code for such an entity could then be constantly improved by the community and employed by individual developers for their specific purposes (war games, large-scale economy simulation, Sims-like social interaction, RPG NPCs, ...). This would, of course, require a decent abstraction of the world state, i.e. it should be possible to 'plug in' different world stati into the AI (or vice versa, depending on your perspective).
22  Game Development / Artificial Intelligence / Re: AI project on: 2005-04-21 13:39:57
Voted 'won't work', but it was a close call (between that and 'cool'). Actually the term 'AI project' is a bit misleading I think, since this would basically be a multi-agent social simulation.

Similar to the Sims, probably, but with a somewhat bigger picture.

Language in this context is an interesting problem. I was thinking for quite some time that it should be possible to create a simple sign language which could be understood pretty well by an AI as well as by human players.

It should be so simple as to make it possible for the AI to pass a Turing test in which this symbolic language is used as the only means of communication (thus, VERY simple).
23  Games Center / Archived Projects / Re: Storm the Castle on: 2005-04-05 09:42:51
Well, on my keyboard the 'Z' key sits neatly between 'T' and 'U' (it being a German keyboard). Don' know about Dvorcak keyboards.

That is to say, don't make assumptions about keyboard layouts. I would strongly recommend to make the keys customizable, or to go with keys which have a fairly standard position (i.e. shift, ctrl, space).
24  Discussions / General Discussions / Re: Locking when using JTextField on: 2005-04-03 17:02:59
From where do you call the game rendering code? I assume that you call it from a game loop running in a separate thread.

If that is the case, the hanging is probably explainable. The paint() method of JComponent (which in turn calls the paintBorder(), paintComponent(), and paintChildren() methods) is not supposed to be called from any other but the AWT thread.

In general, Swing is not a multi-threaded framework, and many things can go wrong if you treat it as such.

If the above scenario applies, using invokeandWait() is valid and actually recommended. In that case, however, I would consider to simply use repaint() in your game loop, and implement the paint() method of the JFrame.
25  Discussions / General Discussions / Re: Locking when using JTextField on: 2005-04-01 17:47:36
Hard to tell what the problem might be, with so little information given.

Here are a few thoughts:

- Check whether you manipulate any Swing components outside of the AWT thread. The spec does explicitly not allow this, and it can actually lead to severe and rather unpredictable problems.

- Have you customized the JTextField (i.e. subclassed it, changed the look and feel)?

- Do you have any listeners registered which may get stuck?

- If possible, try to dig as deep as possible into the stack trace to see where the AWT thread hangs. Debugging into the Swing/ AWT classes works quite well with Eclipse, and usually gives you at least an indication what the problem may be (e.g. a lock on the component tree).
26  Game Development / Newbie & Debugging Questions / Re: Input Box and output box - applet on: 2005-03-30 09:53:55
As for transparency, you could go with a JTextField and use setOpaque(false). This should make it completely transparent.

If you want to have partial opacity (to reduce the contrast of the game content underneath), a custom component will be much easier than JTextField.

In theory you should be able to set a background color with a semitransparent alpha value (such as new Color(255,0,0,128) for a semitransparent red). However, I just tried to do that and it failed - the text field suddenly shows lots of repaint artifacts.

As for the key events, you could do the following: Whenever your game loop gets a KeyEvent and you want that to be processed by the JTextField, retrieve the ActionMap key for that event from the InputMap, then retrieve the Action from the ActionMap and execute the Action:

Object key=textfield.getInputMap().get(KeyStroke.getKeyStroke(e.getKeyChar()));
      Action a=textfield.getActionMap().get(key);
            ActionEvent ae=new ActionEvent(textfield, KeyEvent.KEY_TYPED, e.getKeyChar()+"");

In this example e is the KeyEvent. However, as mentioned by the other posters, using JTextField is probably not worth the trouble, and in the long run a custom component is better suited.
27  Game Development / Artificial Intelligence / Re: A-star 101 on: 2005-03-29 17:11:45
Thanks for the algorithm. I doubt that many will be willing to download the ZIP, open all java files and go through the complete algorithm (I certainly wasn't - sorry).

Maybe you could post a short section of your code where you expect potential for further optimization.

From a quick glance I had the impression that the code was a fairly straightforward implementation of the A* algorithm. One (rather formal) hint: Convention has it that method names begin with a lower case character.
28  Game Development / Newbie & Debugging Questions / Re: Many image-files or many images in one file? on: 2005-03-29 17:05:16
So Im not going to transfer those to 1 big file for this game, but in future games Ill create, would the one-big-image-method make the game's resources (graphics) smaller or increase the game's speed?

No, it won't make the resources smaller (at least not by much; you will save a few bytes overhead for the file headers etc).

No, it won't increase the speed of the game in general. It will, however, increase the loading speed substantially if you retrieve the resources over a slow network connection. Also, if you load the images from a local file, the loading speed will increase somewhat (but not as noticeably).

However, I recommend to split / crop the image into the separate small tiles right at the start of the game, and not use the large master image in the animation/game loop.

Java2D allows to paint only part of an image, but on some platforms and/or with some Java versions, the performance will be very bad.
29  Game Development / Newbie & Debugging Questions / Re: ClassCastException and BufferStrategy on: 2005-03-14 10:40:25
I may have overlooked something (a speciality of mine), but it seems ok to me.

Could be an Apple-specific problem. It compiles and runs fine on my system (Windows XP, Java 1.4.2).
30  Game Development / Newbie & Debugging Questions / Pluggable load/save mechanism on: 2005-03-11 15:44:01
For a game with a fairly complex data structure, I want to make loading and saving pluggable, i.e. I want to have a single entry point for loading and saving to which I can pass a Serializer/Deserializer object which implements an appropriate interface.

In that way, it would be easy to switch, for example, from one file format to another.

Now, saving and loading cannot easily be designed in an abstract way, as they have to know about/have access to all the classes and their fields.

The solution I came up with is thus:

Each class implements a getSerializer(SerializerFactory sf) and getDeserializer(DeserializerFactory df) method defined in an interface. A GameStateSerializer traverses the data tree, retrieves the specific object Serializers and asks them to save the object state.

The SerializerFactory and DeserializerFactory parameters allow to pass factory objects which may be asked to provide serializers and deserializers for primitive data types.

In this way, the logic for loading and saving is isolated from the classes to be saved and loaded (similar to the Memento pattern), and the factories allow to plug in different file formats.

Does that make sense? Any better ideas? How do you do it?
Pages: [1] 2 3 4

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (27 views)
2014-04-15 18:08:23

BurntPizza (22 views)
2014-04-15 03:46:01

UprightPath (38 views)
2014-04-14 17:39:50

UprightPath (20 views)
2014-04-14 17:35:47

Porlus (36 views)
2014-04-14 15:48:38

tom_mai78101 (61 views)
2014-04-10 04:04:31

BurntPizza (119 views)
2014-04-08 23:06:04

tom_mai78101 (219 views)
2014-04-05 13:34:39

trollwarrior1 (186 views)
2014-04-04 12:06:45

CJLetsGame (193 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20 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‑
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!