Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (547)
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  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.
2  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.
3  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.
4  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.
5  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?
6  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.
7  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.
8  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.
9  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.
10  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.
11  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.
12  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.
http://www.stimware.com/projects/game-service
13  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?
14  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.
15  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?
1  
2  
3  
public void addTriggerable(Triggerable triggerable) {
    triggerables.add(triggerable);
}


16  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
17  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
18  Discussions / Miscellaneous Topics / Re: Green!!! on: 2013-06-28 09:17:35


 Cry
19  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.
20  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:
1  
Failed to load: java.io.BufferedInputStream@3227f076

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.
21  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:

1  
2  
3  
4  
5  
6  
7  
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.
22  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.
23  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.
24  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.
25  Game Development / Networking & Multiplayer / Re: Network Error with my Multiplayer Pong (First Attempt) on: 2013-06-09 01:20:37
At the risk of sounding like a broken record, you need to stop interfering with Java's exception handling model. I've seen quite a few places in your code where you catch exceptions rather than let them propagate, but do nothing with them except sometimes write to System.out. The program just continues on as if nothing went wrong, resulting in NPEs later on. This makes debugging so much harder than it needs to be.

Learn to use the throws clause. Don't write catch blocks unless you can do something appropriate with the exception. Remember - exceptions are like alarms. All catching them does is turns the alarm off. If you aren't doing something to handle the exception, don't catch it.

26  Game Development / Newbie & Debugging Questions / Re: more Efficient Gravity on: 2013-06-07 14:19:40
What does the variable "c" represent? I'm guessing it's a column of blocks, but have no idea what type they are except that they have "bounds". It's probably intersect() that is taking the most time, but without knowing what types any of these variables are, it's anyone's guess. If unsure, I would run it through a profiler - these are indispensable when trying to sort out performance issues like these. I've made a lot of assumptions in the past that turned out to be wrong after profiling.
27  Game Development / Newbie & Debugging Questions / Re: Remove object from Array without knowing index on: 2013-06-03 01:41:57
I took a different approach to my PacMan clone. The map is a grid of values which can represent:
  • a wall
  • corridor without pill
  • corridor with pill

If the player encroaches a certain distance into a corridor cell that has a pill, then the pill is swallowed and cell reverts to "corridor without pill".

This sort of thing won't work as well when you have a whole range of different static things that can occupy a cell at the same time, but PacMan is not such a game. You have pills, big pills and sometimes fruit.
28  Games Center / Showcase / Re: Space Turdz on: 2013-05-02 00:43:47
I had a go, the graphics don't seem to match what is on the screenshots. I'm guessing it's still the older version that I downloaded? It doesn't have the cooler pixelated fonts.

A minor typo in the game end screen as well - "Your shit!" should probably be "You're shit!". Unless you're talking about my shit, which isn't really worthy of a game Wink
29  Game Development / Newbie & Debugging Questions / Re: Hi, just a few questions hehe on: 2013-05-01 02:24:34
Btw does anyone know if there is a way to encrypt the images in the jar file? just for the game to be able to read the images and not people being able to take them off it. is it possible?

I'm sure there's a way, but if someone wants to rip off your images they'll just take a screen dump of your game.
30  Game Development / Newbie & Debugging Questions / Re: Package naming conventions on: 2013-05-01 02:12:02
I've got my own domain name so that part isn't an issue, but I'm still not sure what path to take with prototypes. Typically I'll just give it a name that vaguely describes what I think the game will be, but often the nature of (or story behind) the game changes so much that the name no longer fits. I then need to do some refactoring to change the package name. It's not a big deal, but has the potential to play havoc with your version control, in particular comparing older versions of files when their folder has changed.

Does anybody use code names for their packages when in the prototype phase? Or even sequential names, eg. game102?
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.

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

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

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

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

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

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

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (29 views)
2014-08-08 02:01:56

Norakomi (36 views)
2014-08-06 19:49:38

BurntPizza (66 views)
2014-08-03 02:57:17
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!