Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 / Newbie & Debugging Questions / Re: Getting errors in CMD on: 2015-05-03 00:49:14
What is the exact java command line you are running?

Where are the class files generated by javac? Are they sitting in a series of folders under the current location such as com/hansi/spaceinvaders?
2  Game Development / Newbie & Debugging Questions / Re: Getting errors in CMD on: 2015-05-02 00:51:06
I can compile the file, but whenever I try to run it through CMD, it says "Error: Could not find or load main class Game" (Game is my main class). I tried using CMD with this simple program:
e contains more than one class. Four, to be exact.)

Is your "Game" class within a package?
3  Game Development / Newbie & Debugging Questions / Re: JOGL init() method not being called on: 2015-03-23 10:45:42
How do you know init() isn't being called? I did notice one thing odd about it, you're calling System.exit before printing the stack trace within the catch block around ShaderLoader.getShaderProgram(). This will prevent you from seeing the errors that get caught. Swap these around so you print before exit.
4  Game Development / Newbie & Debugging Questions / Re: JAR File isn't being written correctly on: 2015-01-21 12:01:49
fileOutput is a BufferedOutputStream, which will need to be flushed to get it to write to disk. Try this on line 50:

if (inputState > 0) {
  fileOutput.write(scratch, 0, inputState);

Simply closing the stream should do the trick, but flush is useful if you have more to write to it a later stage.
5  Game Development / Newbie & Debugging Questions / Re: Clean code & Smooth development on: 2014-10-16 12:31:41
One technique I would recommend to keep code clean is to follow the principle of high cohesion. In my mind, this is another way of saying "don't write classes or methods that try to do everything under the sun". They should each do one job, and do that one job well. One of the many side effects of not doing this is you end up with scoping issues - lots of variables in the same space, all trying to do a similar but not quite the same job. You then end up elaborating on variable names in an attempt to group them together or differentiate between all the other variables. It's a mess.

As a general rule, if I have any methods that don't all fit within the one screen (and I use fairly liberal amounts of white space) then this is an indicator that it's doing too much. It's not a hard and fast rule, but a solid guideline I like to follow.
6  Game Development / Networking & Multiplayer / Re: Server UI - graphical vs command line on: 2014-10-16 12:12:41
JMX is another option - user interfaces for this are already available, and emitting JMX data from your server isn't that difficult. The JVM already does this for things like memory usage and thread activity.

If you want to interact with your server over the web then a web interface is the way to go, but if you're on the same network and need some sort of interactivity up and running pretty quick, JMX does the job.
7  Discussions / Miscellaneous Topics / Re: What would you like to see in Java? on: 2013-10-08 09:25:01
I would like to see Java follow .Net in discarding checked exceptions. Allow them still be included as part of a method declaration, but not force them to be caught or declared. Far too often often novice programmers will take them option of catching and suppressing them, when that is quite often inappropriate. Java already has a mechanism in place for handling uncaught non-checked exceptions which should be used more often.
8  Discussions / General Discussions / Re: Do you get bored, discouraged or demotivated with your projects? on: 2013-09-02 14:18:51
I've found it enormously satisfying to have a concrete set of requirements for a game, and sticking to them. Have a checklist of the little things that need to be complete before the game can be released, such as sound effects, music, menu system, high score etc. Once you've got those done, move to the next project. It doesn't mean you need to have all the details fleshed out from the beginning, just don't go adding something that needs more than one session of coding to implement.

If you think of really cool stuff to add to your game, just put it on the list for the sequel.
9  Games Center / Archived Projects / Re: Name Generating Lua Script on: 2013-09-02 11:36:50
From a quick look at this code, it seems to represent the probability of certain letters following others using hard coded rules. hat you could do is extend this to derive the rules from actual names used in different languages and/or cultures. You can then generate names that follow these cultural patterns but still appear random. I could be wrong, but I think this is based on the theory of Markov Chains, which can be used to represent rules for generating character sequences using probabilities.

What you need to do is find out for each letter of the alphabet (which doesn't necessarily have to be latin), what is the probability that every other letter will follow it. To do this, just record a count of how many of each consecutive paring of characters appears in a list of names you provide. You end up with a list of pairings, each with the number of times it appears recorded against it (including spaces or the end of the name - we'll record this as a terminator character). I store this in a 2D array, with the first letter in the pairing as one dimension and each letter that has been known to follow is as the second. The value in each cell of this matrix is the number of times the pairing appears, ie. the frequency.

To generate a name, start with a random letter. For the each subsequent letter, look up the matrix using the previous letter. You'll get back a list of letters that have been known to follow it. The frequency of each possible letter will be used as a weighting when randomly choosing one. Keep going until you roll a terminator as the next character.

The end result will be random names of varying lengths that never have character sequences that you don't see in real life. You don't need to do any special handling for vowels or consonants, they will just follow the patterns used by the language of the names you have chose.

You can however get instances of the same letter occurring three or more times in a row. This is not too hard to write some extra conditions in your code for, but another option is to make your "chains" longer. What I've described above is using letter chains with a length of two. This can be extended to a length of three (or more), however it gets a little complicated. Extending the above solutions to a 3D array might be one way, I took a slightly different approach but it'll require a bit of thought to explain it properly. I'll dig up the code and post it somewhere if anyone is interested. The end result is even more natural, however it does seem to lose a bit of randomness - in fact it will often generate regular boring old names such as "John" and "Fred" (no offense to anyone called John or Fred).

I've got an old project that does this using variable length chains, but it's implemented using the Java Application Framework so won't compile using newer NetBeans versions. If anyone is interested I'll put the code up somewhere along with an old build.
10  Game Development / Newbie & Debugging Questions / Re: Loading a Bufferedimage on: 2013-08-29 15:01:03
What is the exact value of this "filename" variable and the exact location of the file within the jar. Note the emphasis on exact. Cut and paste the path if required so we get the correct capitalization, this is no time for vagueness.
11  Game Development / Newbie & Debugging Questions / Re: Trouble finding Main Method on other computers on: 2013-08-27 08:58:39
Can you post the exact error message?
12  Game Development / Performance Tuning / Re: JAVA faster than C++ now? on: 2013-08-16 08:36:52
I can't comment on the C code, but with java I wouldn't be using System.currentTimeMillis for benchmarking. The resolution of this timer on some systems is notoriously low, with Windows being somewhere around 16ms. When you're looking at result around 1 - 2 seconds, this is significant.
13  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Can't render tiled map on: 2013-08-15 15:07:30
I copied that exact code but it's still not working.

I don't know enough about this issue to help, but one thing I can say is that you really need to give us more to go on when asking for help. The single most useless bit of information you can give is "it doesn't work". What would be helpful is:
  • Are there compiler errors?
  • Are there runtime errors, perhaps in the form of a stack trace on the command line?
  • Are you getting behaviour you don't expect? What behaviour do you expect? How is this different to what you are seeing?

I've asked clients when trying to describe errors to express them in terms of words, shapes and colours. This actually works quite well.
14  Game Development / Newbie & Debugging Questions / Re: Having an issue loading text files on: 2013-08-15 14:58:50
If it's working fine in Eclipse and not when running the JAR, then the files you're trying to load are not being included in the JAR file within a folder called "res". Is there something you need to do to the folder in Eclipse for this to happen?

Here's the stack trace. I don't know what good it will do.

It is a critical piece of information. The earlier you share this with people you're asking for help, the sooner issues get resolved.
15  Games Center / WIP games, tools & toy projects / Re: Retro on: 2013-08-12 14:10:58
Beautiful game so far, it has a really nice look to it.

For me, the balance is just a bit too much on the difficult side from the beginning. The green slugs were a bit too tough to take out early on although easy enough to avoid. Some of the platforms were a bit fiddly to land on as well. The gun upgrade was well done, making it underpowered at first but you really appreciate the burst fire and increased rate.

One thing I noticed was the particles floating up under the lights. I actually though this might be a visual cue that gravity was somehow affected under that area. Maybe this could be something to implement? Perhaps having localised areas where gravity is reversed or strong wind currents that the player needs to make use of to sole a particular part of the level.
16  Game Development / Networking & Multiplayer / Re: Applet - Mysql communication in php-made website? on: 2013-07-31 23:26:15
You could make it recognize requests from the same host only, then this will rule out people other than yourself actually playing the game.

Making it only recognize requests from an applet will be impossible - whatever mechanism you implement to do that will be subject to the same kind of impersonation attacks as your main protocol.

A servlet will not give you any additional security as you will most likely still be communicating via HTTP. I guess you could serialize java objects and send them over the wire, but there's nothing stopping a hacker from reverse engineering your code to make their own objects. Being java, this is a fairly simple thing to do.

As sproingie suggested, you could just use SSL. This will prevent people from sniffing the packets the figure out how to hack your protocol, but they can still reverse engineer your code.

So the next question might be how to stop people from reverse engineering your code. Since it's java we're talking about, it's pretty straight forward to decompile. You could implement the client end of your communication using a native library which will slow them down a bit, and rule out hackers who aren't familiar with machine code. It's still just one more breakable barrier though, and could present problems deploying with your applet.
17  Game Development / Networking & Multiplayer / Re: Applet - Mysql communication in php-made website? on: 2013-07-31 11:54:44
Yes, your assessment of hacking in this context is spot on.

I hadn't bothered addressing that in my implementation yet, as it's mainly a proof of concept but there appears to be quite a few ways of going about it. None of them that I could come up with are completely hack proof, only more and more difficult to get around.

You could have some sort of complicated handshake between the client and server, eg. the server sends back a random number "challenge" and the client has to use an algorithm to generate a response that the server validates. Once you've established the session like this, communication continues as normal. It won't stop a determined hacker from reverse engineering the code though, but at least it requires some effort.

A more effective solution I've found is to just make crappy games that nobody wants play. So far, no hacks! But it's an interesting problem and one that I'll probably look into more for my next game.
18  Game Development / Networking & Multiplayer / Re: Applet - Mysql communication in php-made website? on: 2013-07-29 10:55:12
I don't see why you can't implement this using an applet and php. As long as your php is sending back meaningful responses (xml is a reasonable format for this) in response to meaningful HTTP requests, the fact that the client and server are using different technologies is irrelevant.

I've implemented a service for saving high scores that does exactly this. The backend is in PHP (since that's what my host provides) and so far the only client applications are java applets.
19  Game Development / Newbie & Debugging Questions / Re: Sound Problem in my Game on: 2013-07-15 09:57:08
I assume this is an Applet, are you seeing anything in the Java console?
20  Game Development / Newbie & Debugging Questions / Re: Working On first Text based RPG game. on: 2013-07-03 10:59:17
Strip it down to something simpler to begin with. Just have rooms, and exits (or "portals" if you will) that lead from one room to another. Implement simple navigation between rooms.
21  Game Development / Newbie & Debugging Questions / Re: Trigger Cocept on: 2013-07-03 10:55:54
What's wrong with adding a method to your Switch/Keyhole classes (or their common base class) to add a single Triggerable?
public void addTriggerable(Triggerable triggerable) {

22  Discussions / Miscellaneous Topics / Re: My friend is being ruined by his religion. on: 2013-07-02 03:12:15
I have a lot of practising Christians/Catholics in my workplace (with me being the only one who isn't). I still can't think of anything we do that might cause an issue for any employees, even our Christmas parties got turned into an "end of year festive celebration" which is fine by me. If there's something offensive about the OS being used, you can always go for an alternative like Jesux
23  Discussions / Miscellaneous Topics / Re: Green!!! on: 2013-06-29 01:23:21

I am not to worried about speed, I am more interested in quota and cost. My current isp charges $39AUD per month for unlimited (actual unlimited no shaping) quota.

I just wish that my suburb was connected to Australia's National Broadband Network (fiber to the home)

I can't get ADSL at all where I am, but NBN is due to start work in my suburb this year. I just hope they start before Rudd gets the boot Sad
24  Discussions / Miscellaneous Topics / Re: Green!!! on: 2013-06-28 09:17:35

25  Game Development / Newbie & Debugging Questions / Re: File reading for save function on: 2013-06-25 01:17:45
@nhydock, why build lenience into file reading. Keep it strict and reject all deviation, I say!

I agree - just ignoring errors and hoping they go away without affecting the rest of the program is just madness.

Building robust code is not about hiding errors, but finding out what caused them.
26  Game Development / Newbie & Debugging Questions / Re: Problem w/ slick2d Sound on: 2013-06-24 01:29:19
If the file is being found (which we still don't know for sure either way), then the issue might indeed be the mark/reset issue. I'm actually thinking the assumption that this is a classpath issue might be a little off given the error message:
Failed to load:

This seems to indicate that an input stream was instantiated.

This is the advantage of splitting the code up into separate lines rather than cramming it all together. It's much easier to identify what exactly causes the problem, rather than making assumptions.
27  Game Development / Newbie & Debugging Questions / Re: Problem w/ slick2d Sound on: 2013-06-23 05:14:20
This might sound a bit pedantic, but I think we're getting confused about where "src" fits into the classpath. Typically it isn't part of the classpath at all. Normally it is a destination folder called "classes" where all the compiled classes end up.

Most IDEs also have the option of recognising other "source" folders. The contents of these folders (ig. "res" for your resources) are also copied to the destination "classes" folder.

The classloader used by ResourceLoader will most certainly be looking in this "classes" folder for the files. I would be checking there to see if the file exists. This is the reason why making a distinction between "src" and the classpath is important - depending on the type of file and your IDE, the contents of a source folder might not be getting copied to the destination classes folder. It may also be getting put in a folder in classes that does not necessarily mirror the structure in src.

To make debugging this a lot easier I would suggest breaking up the line loading the resource into two. Perhaps even add some additional checking. For example:

String resourcePath = "res/sounds/zhurt0.wav";
InputStream in = ResourceLoader.getResourceAsStream(resourcePath);
if (in == null) {
  throw new IOException("The resource " + resourcePath + " does not exist at the expected location");

this.hurtSounds = AudioLoader.getAudio("WAV", in);

It would have more convenient had the ResourceLoader class performed this checking for you an raised an appropriate exception. I'm not too keen on code that just returns a null on failure. Exceptions do this job so much better.
28  Game Development / Shared Code / Re: REALLY Simple Sound Loader on: 2013-06-13 08:08:45
I have no idea why people insist on catching everything. 95% of the time it is the worst thing you can do, and yet the net is full of example showing this. And new coders just blindly follow.

It doesn't help that the default fix in every IDE is a crappy one (a better one would have been to convert it to a RuntimeException).

Or even better, just use throws and let it be handled in a more appropriate place, without killing the original stack trace. So much better in so many different ways, and costs less effort. But anyway, this is getting a bit off topic (apologies on my part).

I'm wondering if it will work under OpenJDK on Linux when multiple sounds are played at once? I've seen other users from JGO report issues with using Clip in this way.
29  Game Development / Shared Code / Re: REALLY Simple Sound Loader on: 2013-06-12 00:20:31
For the sake of anyone who might want to use this code, I would advise you get rid of those catch blocks and declare the exceptions using throws. You are not doing anything useful with those exceptions, and the end result will be that your users will keep getting NullPointerExceptions after the initial failure. Let the programmers using your code decide how they want to handle the error rather than hiding it from them.

I have no idea why people insist on catching everything. 95% of the time it is the worst thing you can do, and yet the net is full of example showing this. And new coders just blindly follow.
30  Game Development / Newbie & Debugging Questions / Re: I can't find my error ;/ on: 2013-06-09 01:38:11
You have try...catch blocks which are doing nothing. Seriously, this is the most evil thing you can do in your code. You potentially have NullPointerExceptions, ArrayIndexOutOfBoundsExceptions happening to name just a couple, but you want to completely ignore them? This will end in pain. Don't do it.
Pages: [1] 2 3 4
EgonOlsen (73 views)
2018-06-10 19:43:48

EgonOlsen (54 views)
2018-06-10 19:43:44

EgonOlsen (73 views)
2018-06-10 19:43:20

DesertCoockie (253 views)
2018-05-13 18:23:11

nelsongames (154 views)
2018-04-24 18:15:36

nelsongames (154 views)
2018-04-24 18:14:32

ivj94 (895 views)
2018-03-24 14:47:39

ivj94 (156 views)
2018-03-24 14:46:31

ivj94 (808 views)
2018-03-24 14:43:53

Solater (172 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!