Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (570)
Games in Android Showcase (154)
games submitted by our members
Games in WIP (619)
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 ... 37
1  Game Development / Newbie & Debugging Questions / Re: Looking for Source Code Ressources on: 2015-04-19 02:39:28
You might check out princec's "Revenge of the Titan's"
2  Game Development / Newbie & Debugging Questions / Re: [Newbie]Need feedback on achieving smooth animation on: 2015-04-13 20:01:05
Your program ran quite smoothly for me. (I commented out the FPS measurement coding at the top of the loop.)

Using a fixed sleep amount is not terrible, as long as there is a minimum of variability in the rest of the program. Often people take a time stamp at the top of the game loop, and measure the elapsed time for the update and render, then subtract that from the target sleep amount, and sleep the result. For many simple applications this is quite adequate.

Another strategy is to use a util.Timer (not Swing.Timer), or a ScheduledThreadPoolExecutor with a time increment set via ScheduleAtFixedRate. With this, there is no need to worry about measuring elapsed time.
3  Game Development / Shared Code / Re: Curve fitting on: 2015-04-02 02:47:49
I'm not entirely sure that Fourier analysis is what is needed here as the best way to do the particular curve fitting you are trying to accomplish. But I did spend some time last year working through the math of the DFT, and collecting links. I managed to get the basic concepts of DFT and for programming convolution. I didn't make it as far as FFT.

Maybe something here will be useful.

I think this is the main book I worked through. "The Scientist and Engineer's Guide to
Digital Signal Processing"

ccrma is a fantastic resource, with sections for some of the background math.

I have a link to some Java implementations of FFT, from StackOverflow, that I haven't followed up on yet.

StackOverlow now has a DSP site:
I haven't tried using it yet. Just signed up prior to this post.

4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Lost System.out.println, Being bombarded with text. on: 2015-03-27 19:54:00
This is why I usually include the class and method in println diagnostics. A few extra keystrokes vs. time sink-hole trying to figure out WTF.
5  Game Development / Game Play & Game Design / Re: How to win the boss-fight on: 2015-03-24 05:17:45
Just make sure there is a walk through available.  Grin
6  Game Development / Newbie & Debugging Questions / Re: Play Audio from Byte Array without distortion on: 2015-03-16 01:14:46
Is there a class assignment requirement to put the data in a byte array? If not, you can use the AudioInputStream to open a Clip object. Playing back a Clip is one of two standard methods for playback supported by Java audio. It is optimized for sounds that are short enough that they can be preloaded and held in RAM.

It looks to me like the "sample" you create is only used for printing out the length. Instead, you can calculate the length from the frame length and the frame size, from the AudioInputStream and the AudioFormat.

    Clip clip;  // often set up as an instance variable  
    File soundFile = new File("A:/Code/MeusProjetosJava/AudioAnn/src/resources/cat10.wav");
    AudioInputStream sound = AudioSystem.getAudioInputStream(soundFile);

    // load the sound into memory (a Clip)
    DataLine.Info info = new DataLine.Info(Clip.class, sound.getFormat());
    clip = (Clip) AudioSystem.getLine(info);;

Usually, Clips are loaded in advance of when they are to be played. At a later point, when you are ready to play them, all that is needed is the following command:

7  Discussions / Miscellaneous Topics / Re: Lambda - Java 7 Alternatives on: 2015-03-15 04:42:49
Tons of games have a button that can move a player left or right without the use of lamdas or delegates. From the little that you've posted, I don't see what is being gained by using that sort of implementation. Can you clarify the example some more, say more about what you are trying to do?

I do use the equivalent of lamdas in an "event system" for an audio mixer. This allows me to schedule "AudioCommand" items, such as starting or stopping a synthesizer or changing the volume on a track, at a given frame.

public interface AudioCommand
   void run(long currentFrame);

The various types of commands extend AudioCommand.

Somewhat simplified:

public class PlayCommand implements AudioCommand
   private Note note;

   public PlayCommand(Note note)
      this.note= note;
   public void run(long currentFrame)

There's a similar construction for note.release(), which is used to end a Note. As I said this is simplified, as there is a specific Synth involved, and a given pitch, volume, pan. This is just for showing the basic idea.

Then, at the given frame the following executes (again, some of the scheduling aspects are not shown, just the basic idea):
    for (AudioCommand ac : audioCommands);

It seems to me like the above plan will be pretty straight-forward in terms of intelligibility, going forward. I don't know if this helps as an example or not. It's just what I came up with, not knowing any better, and not having Java 8 available, and now, having some ambitions to port the code to Android.
8  Game Development / Newbie & Debugging Questions / Re: Where to start for something like this on: 2015-03-13 19:58:01

I've done many years of Java coding and done quite a few games - just working on a random dungeon generator which is going ok, was just
interested if the game in question uses random dungeons or just maps drawn using something like tiled?


Clarifies the question, which is good. Had you done so from the start I wouldn't have spent the time I did finding that link and writing an essentially useless reply.  Sad

But I could also learn to better recognize ambiguity and respond with clarification requests rather than going out on a limb.

Welcome to JGO!
9  Game Development / Newbie & Debugging Questions / Re: Where to start for something like this on: 2015-03-13 00:24:41
I would think the first step (assuming you've done some Java game programming already) would be to learn about tile-based techniques, and sprites. I think there are already lots of free graphics that one can use for tiles, to use as placeholders for getting started.

I did a quick search on tile-maps and found the following tutorial. I haven't read it and can't vouch for it, but it seems like it could be decent enough to at least get you started.

Folks that have actually made this sort of game (I haven't) may come up with better links for tutorials, as well as a recommendation for learning how to manage "sprites".

But definitely, if you haven't yet done the classic bouncing ball, that would be a good thing. I tend to make that my first pass at getting to know a graphics programming language. It's not entirely relevant, as tile-based games don't tend to have objects with momentum, and collision detection is simpler. But it's still worthwhile, and not that difficult.
10  Discussions / Miscellaneous Topics / Re: Android Studio comedy of errors on: 2015-03-09 21:59:14
@nsigma - Thanks for rubbing it in, after the fact.  Wink

I could have used this info earlier. I'm new enough with Ubuntu and Linux that the searches I did for installation help did not uncover this. I really wasn't aware of or had grasped the PPA concept or how to search for them.

Here's another fun one for naive Ubuntu users, a major "Doh!" moment for me. Le't say you have an executable, and using the Terminal shell, you navigate to the file folder where the executable resides and type in it's name. What happens: crickets, and a command not found message. But when you type 'ls' the command is clearly there in the file folder. SOLUTION: to execute the command, you have to prefix the file name with "./" .

I'm unclear if the PPA you linked installs the KVM or not.

It looks like this PPA-made Studio has to be run with sudo after all. Maybe it is okay that both the Android Studio and the Android SDK are in the /usr folder, and they will communicate with each other nicely that way. I'm guessing that there's a lot going on in the /root directory as a consequence. As long as it works (most users say it does) then that's all good. But for my dual partition setup of Ubuntu, it would have been an utter disaster. I made "/" only 15 GB, with the bulk of the remaining disk space (350+GB) going to $HOME. Putting Android in /usr would have cramped up the 15 GB pretty quickly. (So maybe what that indicates is that the advice to make a dual partition for Ubuntu was bad to begin with.)

As long as it's working, I'm not going to go back and change anything.  Tongue

Well, live and learn. Life of a DIY'er--unless you write something that impresses someone so much that they decide they want to help out, you have to spend a disproportionate time in learning an endless number of technologies and mastering countless configuration issues. That is time that might otherwise be spent with the much more fun programming and experimenting.  Cool
11  Discussions / Miscellaneous Topics / Android Studio comedy of errors on: 2015-03-09 03:36:38
My goal is to learn enough about Android programming to code an adapter or bridge of some sort that allows an Android program to make use of my Java-based audio mixer and audio tools. To that end, I decided to install Android Studio on my newly made PC. But it's taken close to a month to get the software to work! Last night I was finally able to run parts I & II of the tutorials provided at the Android site: successfully emulating a Nexus 5 which ran an app that displays the text "Hello world!".

The last time I wrote about this, on the Chit-Chat Monster, I was complaining about "configuration hell" and getting the Emulator to work at all. I found out many JGO'ers also found the software difficult to install and make use of alternatives. So, maybe, maybe not, some notes on what went wrong and how it was solved will be useful?

1) I think the decision to use Android-Studio instead of the Eclipse plug-ins for Android development is okay. This seems like a good way to keep this work segregated. I found switching between Eclipse workspaces to be clumsy. Also, having all the Android stuff seemed like clutter when I was just trying to do pure Java dev. But maybe it is just a matter of preference.

2) It makes a difference if you are using an Intel cpu vs AMD.  I suspect that at Google, most Android development is done on Intel cpu's. The main reason I came to this conclusion: the easiest to find instructions recommend installing an Intel-made and provided tool for vm acceleration, and I believe it only supports Intel cpu's. It is certainly possible to run Android Studio on AMD with acceleration, but you will have to go online to find "how-to's" on blogs and StackOverflow, rather than being within the safe bounds of "official" instruction pages. (See #8 below.)

I built my computer with an AMD setup. I don't regret this, but I could see where someone who wanted to do Android dev and was making a decision as to the cpu for their system might be advised to prefer Intel.

3) I decided to install on Linux. My understanding was that Android dev was originally done on Linux, and the instructions for how to build the vm acceleration on Linux were less scary than for Windows 8.1. I am admittedly over my head here and may have gotten the wrong impression, but it seemed to me that, on Windows 8.1, the work-around for acceleration for the emulator compromises some of the graphics pertaining to the new tablets oriented GUI. I could easily be wrong on this, though. The decision was made pretty far back and I have forgotten most of the details.

Of course, if you are new to Linux, factor in an additional learning curve!

I decided to go with the current Ubuntu, 14.04.

4) Partitioning for dual booting is a bit tricky. I decided to follow a tutorial that recommended having two partitions where there might more usually be one: one for "/" and one for "/home". It seems there might be performance benefits, but again, I am speculating beyond my competence level. This split led to some complications which I will get to, but so far I think it was an okay decision. The main thing: many of the blogs are becoming more and more dated. Be sure to check the date, and maybe guestimate on the high side--the older blogs have size recommendations that are clearly too small for the current generation of computers and software. I figure the trend for sizing the partitions for the swap and for the "/" (if you go that route) will be to always increase over time.

5) You won't be able to use Ubuntu's built in software tools for installing Java. Android Studio requires Java 7, and Ubuntu is only providing Java 6. I ended up installing Java 7 from Oracle, in /usr/lib and it went okay. But, I've been reading that this might not have been the ideal choice. There was an article on where to install in the Ubuntu help areas, and I can't recall where it is at the moment. It does exist, and in my scanning of it I noted that there was another /usr folder that might have been better. At this point, as long as it works, I'm not going to revisit the issue.
EDIT: just took a second look at Ubuntu Software Center and did a search for Java. OpenJDK 7 was on the list. My mistake.

6) The directions for installing Android Studio and the Android SDK confused me. If starting again, I would simply put both on $HOME, in separate file folders. I made the mistake of setting one up on /usr/lib and the other at $HOME. Then, when running Android Studio, I found I had to use "sudo" as part of the command. This led to problems.

a) Files were being built in file folders in /root, and this was cramping the "/" partition, leading to system warnings about lack of disk space. Some of the files built there were the result of updates or installs, especially via the SDK Manager.

b) The .ini files built by the AVD Manager were ending up in /root and not visible to Android Studio.

It seems "sudo" (I am new to Linux/Ubuntu) changes the value of $HOME and/or some other environment variables that are used by Android, and the various sub-systems aren't in synch on this. All this grief can be avoided by just installing everything on $HOME and making sure there is no need to use sudo when launching the application. (I ended up moving the /usr/lib install to $HOME, and then going to /root to remove two Android directories that were built there. Mucking around with /root is generally not recommended as it is a good way to totally wipe out your OS. It seems I was careful enough, though, this time.)

7) If you are running a 64-bit OS, you will have to load a program for running 32-bit mode. The first web blogs I found that identify this problem recommend the use of a program (ia32-libs) that was dropped after Ubuntu 12. It took more digging but eventually found the replacement packages.

8.) I think (am not entirely sure) that you have to install the vm acceleration software in order for the AVD Manager to work and to be able to run emulations. I installed KVM. The basic overview on configuring VM acceleration on Linux is at the following site:

Details on installing KVM can be found here:

To be honest, I'm not entirely clear if the Nexus 5 emulation I ran on my first tutorial made use of the acceleration or not. I'm going to have to review the process I went through in the AVD manager, and see if I did the steps spelled out in the first link above (under the heading "Configuring VM Acceleration on Linux"). (Late middle-age memory issues, compounded with minimal understanding. I did this somewhat earlier in the process of steps and the emulator fails I thought I was thus correcting may have been more about not having the 32-bit code runner working.)


Am very much looking forward to getting back to programming, proper.

 Huh Tongue Huh Tongue Huh
12  Game Development / Game Play & Game Design / Re: Game Design - Puzzle desgin on: 2015-03-06 19:05:23

There are different approaches. Some games will kill you quickly and frequently, but they still catch on, e.g., Flappy Bird was a brief viral hit until programmer freaked out at all the success.

Other games progress more slowly.

I think the main thing is whether the player cares or not. They may care for various reasons. If at some point the user "flips the bozo button" (for example, realizes that the puzzle is hopeless or impossible) then it's all over. Many people like to feel like they have learned something from a puzzle, and this gives them motivation to continue.

I don't know of anything written on the subject. There might be articles at Gamesutra on the subject.

If you do kill frequently, my best advice is that the kill be something one can see coming, in hindsight, if not in real time.
13  Game Development / Game Mechanics / Re: Making GUIs on: 2015-03-05 02:56:00
I wonder if it's easier to use JavaFX that way?

This isn't really an answer to KevinWorkman's question, I don't think. But it does involve using JavaFX on Android, and I thought it looked interesting. Has anyone else sized up this strategy for running JavaFX on Android?

Maybe this isn't a total hijack. The subject line of this thread is "Making GUIs" after all.
14  Discussions / General Discussions / Re: where can i get better at java? on: 2015-02-27 19:30:46
I'm reading the Oracle Press book: "Java, A Beginner's Guide" Sixth Edition, by Herbert Schildt. I'm finding it very well written, and there are quizzes at the end of each chapter and lots of example code. The book covers new features in Java 8 as well as intros to both Swing and JavaFX. You might find it a bit pricey. My copy is from the local library.

The Java Tutorials are an underrated resource for learning the language, are actually quite good. And they are free. Some expensive texts seem to duplicate a lot of the lessons taught here.

There are good texts available online, either through a library (if they subscribe to Safari), as well as some free books. I remember thinking the Eckels was pretty helpful:

There's a lot to coding even a simple 2D game: with much to learn about graphics, keyboard/mouse control, animation (often not taught in beginning courses), as well as core Java OOP.

Hey, I just noticed a 3rd Edition of Bloch's "Effective Java" is out! (That is a tough nut to crack. Save it for later.)
15  Game Development / Newbie & Debugging Questions / Re: Java 'this' syntax on: 2015-02-27 19:11:16
Neat solution from ClaasJG!

What I've done in the past was this:

class MyClass implements MyInterface {

    private final MyClass thisInstance = this;

    private Runnable runnable = new Runnable() {
        public void run() {
            SecondClass klass = new SecondClass(thisInstance);

class SecondClass {
    SecondClass(MyInterface i) {

It seems to me that the possible benefit is that it's the specific instance that is now passed. But if there are problems with what I'm doing, I'd be happy to hear about them! Off the top of my head, I can't remember if the "final" modifier was requirered or not.
16  Game Development / Newbie & Debugging Questions / Re: Java Swing / AWT Sounsd on: 2015-02-20 01:22:37
The suggestions from both KevinWorkman and nsigma are good.

Many posts on TinySound can be found here on JGO (via a local search).

For a javax.sound.sampled.Clip, to expand on what KW wrote: the data for the Clip should be loaded only once, and well before the calling of the play command. After the play command, you can use setFramePosition or setMicrosecondPosition to get the Clip ready for an additional playback. As your code stands, you are unnecessarily reloading the complete file into memory before commencing the play start.

If sounds are too large to hold in memory, playing back via a SourceDataLine is better than a Clip. The SourceDataLine will start processing the file data as soon as it gets the data rather than waiting for the entire file to load to memory before being able to play. It is very responsive but uses a slightly larger amount of cpu than Clip playback.
17  Game Development / Game Play & Game Design / Re: How to be a more creative writer? on: 2015-02-10 06:17:58
My top recommendation is to liberate and feed your curiosity. No matter how weird or "boring" (boring to others, that is) something might seem as a topic, it you feel the slightest tweak of interest, check it out. It may well become a useful resource or reference down the road.

Of books on creativity, one of my favorites is called "Impro" by Keith Johnstone. It is about improvisational acting, but I think there are interesting observations pertinent to other artistic endeavour. The second-to-last chapter has some really interesting thoughts on creativity, including shooting down lame attempts to achieve creativity by being affectedly quirky. The last chapter on mask/trance work is scary-neat, and may help uncover some inner resources you might not have expected to be there.
18  Game Development / Newbie & Debugging Questions / Re: I want to make a bullet hell game on: 2015-02-04 23:35:27
I still wouldn't use LWJGL alone for game development. I believe Libgdx is based on LWJGL but makes game development a lot easier as you don't have to focus on many low-level details. The Libgdx tutorials seem more beginner friendly and easy to follow in my opinion.

Libgdx is based on LWJGL, as are several other libraries, as far as I know. princec's work is outstanding.
19  Game Development / Newbie & Debugging Questions / Re: I want to make a bullet hell game on: 2015-02-03 19:07:18
Would a series of tutorials that go from pure Java (using Java2D) to Libgdx , all recreating the classic Space Invaders be of interest? I don't know if Space Invaders counts as bullet hell, but when the bombs are raining down, it can feel like that. If so, you might check out CokeAndCode's tutorials, by jgo's kevglass.
Are these still considered up-do-date?
20  Discussions / Miscellaneous Topics / Re: Java Certificates on: 2015-02-02 20:31:49
@ags1: did you learn anything new?

I learnt loads of stuff, but forgot most of it immediately after passing the exam. The certifications remind me of driving theory tests - masses of fiddly details, but no substitute for practical experience. I studied english literature at uni, so I'm happy to take anything that gives my a little credibility in programming.

I can appreciate that. I have a degree in music. At least, I did manage to take a few programming courses "for depth" (logic & design, assembly programming, Pascal--wanted to hit it at each tier). In terms of learning things, I had only a loose understanding of the rules for overriding & subclassing and such and how they affected class and variable scopes. It was enough to get my programs to work. The test study forced me to clarify this, get a more precise understanding of these relationships, and has contributed to better program design and a slightly smaller window for "floundering about" errors.

I'm thinking about trying my hand at some Java tutoring to fill in some "down" hours and am pondering once again whether or not to go ahead and take it, in order to add to the resume. Maybe showing off some programs will be enough, and mentioning how "awesome" I'm rated at JGO.
21  Discussions / Miscellaneous Topics / Re: Java Certificates on: 2015-02-01 07:54:30
I did when studying for them. Practise tests are helpful that way. But I didn't follow through and pay to get the cert.
22  Game Development / Newbie & Debugging Questions / Re: Collision and movement in Java2D on: 2015-01-30 19:40:28
Still, graphic libraries like awt and java2d can be helpful for collision detection. For example, one might use a shape for its contains or intersects function, or a point for it distance function.
23  Game Development / Newbie & Debugging Questions / Re: Experienced game developers opinions needed! on: 2015-01-23 21:54:37
By all means, jump in and create a game!

If you consider yourself a rookie, it might make sense to copy a vintage 2D game. If you have ideas on a variant or a new game, by all means go for it.

My thinking is that it is good to have some passion and fun in the process. This is most likely to be the case if you are working on a game that excites you.

No single game is going to require every game-programming technique. Might as well wait to come to those bridges before crossing them.

For hurdles along the way, this forum is pretty great for addressing challenges. Also, with a book like "Killer Game Programming" or "Developing Games in Java" by David Brackeen, one can consult IF they are relevant to your game. Yes, a lot of the code is obsolete, but not all of the concepts.
24  Discussions / Miscellaneous Topics / Re: Ian Allen, my good friend and top "tester" died and is becoming famous! on: 2015-01-23 18:07:25
Thank you!  Cry

As soon as I can get it together, I will post a few of the music/sound pieces he made or that we collaborated on. I'm also trying to locate the first image I have of him, an awesome/scary self-portrait he made that I have filed away somewhere--making very creative use of a photocopier.

It is so weird seeing this publicity now, after so many years of struggle and obscurity. If only there was some way to have harnessed this while he was alive. I wish he (and his mother, who died this last summer) could see this. I feel like there are any number of lessons to be learned here, but I am feeling kind of dense.
25  Discussions / Miscellaneous Topics / Ian Allen, my good friend and top "tester" died and is becoming famous! on: 2015-01-23 01:31:43
On the 17th, my long time friend Ian Allen died, after complications to a heart valve surgery at Stanford Hospital. He was only 56 years old. My last visit was in the early hours of the 17th--it seemed like he could have fought on, but the odds had just kept mounting: a treatment resistant hospital bacteria, internal bleeding (it had finally scabbed, though), organ failure.

Over the last few years, he had been my best "tester," always willing to check out and comment the projects I was working on, whether musical or programming. He tried to learn Java, then Python, then other languages but despite having been top of his class in first year Physics at UC Berkeley, and successfully game programming with FORTH at Unison Kyocera with me back in the 1980's, his current state of health (cancer survivor, dealing with bipolar, other issues) left him in a state where I think it was just too fatiguing to hold everything in his head all at once.

Regardless, he still had a great perspective, with sharp, honest and unique insights that made him a valuable source of feedback as well as a true friend willing to give me his time like that.

Before he went in for the operation, he was talking about aiming for projects with a time line of about a week to complete. Many of his sound-compositions that were most successful were accomplished in this sort of time frame. We were optimistic, though I was also preparing myself for the worst as a possibility. Am so sad/angry/disappointed that he wasn't able to get through this!

I am really proud that he is getting some recognition in the press. I wish he could have seen this! Rolling Stone, Billboard, Pitchfork, lots of other news feeds! This tribute from negativland (Ian always insisted the proper spelling was lowercase) has been picked up by the press at large. He really was big on the culture jamming concept, right from the start, and as far as I know, introducing those ideas to members of negativland.
26  Discussions / General Discussions / RESOLVED: am thinking of getting this PC, for both gaming and developing on: 2015-01-22 14:33:01
New computer built from parts is up and running!

I'm using an AMD FX 6300 CPU (6 cores). There is an 8-core available for a future upgrade.

I'm using a Saphire Radeon R7 260X GPU. It was listed as a good low-cost option for gaming PCs in a Toms article. (Ah, Phased recommended this GPU in an earlier post.) Upgrading to a 750 Ti can wait for a bit.

I found the process stressful and time consuming. Worst point: I case I bought (from Antec) came in with the back panel kind of misshapen, with the slots slightly skewed. Ended up forcing things in, and am hoping the angled video card doesn't get damaged connections as a result. Was too impatient to send it back for another. Overall I like the model I got. Rookie mistake: bought the DVD drive after having installed everything else, and there was not enough clearance to put it in. Had to take out the MOBO to put in the DVD drive. Annoying. (I was hoping to use my existing DVD/CD drives, but they were not compatible.) Also, the CPU came with a fan, so the separate fan I purchased is going back.

Still, it is pretty cool having it actually up and running now. There is still the process of moving my software and files over, as well as setting up the Linux/Windows dual boot. So far, have downloaded Java and Eclipse but haven't installed them yet. Much to do still.

I should try installing one of the games I have that wouldn't run on the old PC. Also, have a coupon for two games from AMD according to a coupon that was sent with the Radeon GPU.

High on the agenda--figuring out how to kill all the ads that are popping up on the new browser.

Thanks, everyone!
27  Discussions / Suggestions / Re: Ability to Remove a Medal on: 2015-01-21 01:14:06
Besides there's a bigger picture too, it's not like someone will get more medals by accident than someone else, in general everyone will get the same amount of accidental medals compared to everyone else based on the ratios of their posts. Meaning in the end, generally speaking, no one gets a "leg up" on anyone else really.

Actually, some people do get a "leg up" (aka random outliers).  Wink

But I think we should just leave it as is. I've given a couple by accident as well. I've probably received a few that way, too. Not a big deal.
28  Discussions / Suggestions / Re: Font for code blocks on: 2015-01-21 01:07:05
Mine is monospaced. Seems like it always has been. Did you mean that serifs were recently added? I hadn't noticed.
29  Java Game APIs & Engines / Tools Discussion / Re: Eclipse - Export jar with including libraries on: 2015-01-04 22:26:12
I don't know the best answer. Ant is quite cool, but I've only made use of it in a limited way, kind of cook-book plugging into existing examples. It seems like a very useful tool, and have only been held back by the learning curve and my tendency to forget how to work with things I don't use often, and the Eclipse tools work for 98% of what I need to do (so far).

Here are two additional suggestions:
(1) Eclipse has a responsive forum for questions.
I've always had good luck at the Newcomers area. Please do post the answer here if you get it solved at that site!

(2) JarSplice is quick to download and easy to use and can very likely handle your issue.
I was initially resisting going here, but was very pleasantly surprised when I finally gave it a try.
30  Game Development / Newbie & Debugging Questions / Re: Multiple Threads and their interaction on: 2015-01-04 04:27:54
Hi guys, a complete n00b in game dev here. I just tried making a simple game using swing. I made the game loop (the one that iterates over pressed buttons) in a separate thread. But I have a serious problem, I really lack skills in multithread programming. In the end of the loop I used Thread.currentThread().wait(20) so the picture would have time to get repainted.. but something tells me that it is not a good way at all. Could you guys tell me how to make it the right way or how to improve my knowledge in multithread programming?

Having a game loop that takes the same amount of time every iteration is probably more valuable than having the fastest possible throughput.

A common practice is the following: at the start of the game loop, store the current time in a long. Then, at the end of the game loop, read the time again and calculate the delta. Then, sleep as much as is needed to reach your chosen target loop time.

For 60fps, you will want a loop that consumes about 16 millis. That seems to be a good practical target, as there are quite a few screens that refresh at 60 fps, so going faster than that can be kind of pointless. You are currently consuming the elapsed time for the code + 20 millis, so you can probably expect to see some improvement if you implement this plan.

Re Swing and multi-threading: I try to avoid the EDT for the game loop, as it is already going to be busy with the repaint calls (rendering). There are numerous strategies for preventing multi-threading related crashes, including using synchronization. But it is also possible to do quite a lot, without problems, if you make sure you store changes to game state in a "model" layer, and not in the Swing control itself (which would be considered part of the "presentation" layer). For example, if you have a button that is part of your game, store the state of the button in a separate volatile variable, and if you need to consult the button state, do it by consulting that variable, not the button itself.

"Loose coupling" goes a long way to circumventing potential multi-threading problems.
Pages: [1] 2 3 ... 37
Riven (24 views)
2015-04-16 10:48:47

Duke0200 (39 views)
2015-04-16 01:59:01

Fairy Tailz (28 views)
2015-04-14 20:13:12

Riven (30 views)
2015-04-12 21:36:37

bus hotdog (47 views)
2015-04-10 02:39:32

CopyableCougar4 (50 views)
2015-04-10 00:51:04

BurntPizza (49 views)
2015-04-06 22:06:58

ags1 (52 views)
2015-04-02 10:58:48

Riven (50 views)
2015-04-01 18:27:05

ags1 (68 views)
2015-03-31 10:55:12
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27 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!