Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (582)
Games in Android Showcase (163)
games submitted by our members
Games in WIP (632)
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 ... 32
1  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-25 11:30:10
I use some Java code to convert images into ico format

Interesting.  May have to look at that.

I'm using libicns.  Judging from that page, this is in use on iConvert Icons - which seems to include a free online converter.

Don't reinvent the wheel, you're gonna solve once again the same problems than some developers including me had in the past, i.e with BASH_SOURCE:

Agree with the sentiment, obviously, but you may want to check the comments below it - a) caveats on cd usage, and b) some bits don't work on OSXWink

Bear in mind the script code I posted above is called every single time someone launches NetBeans on Linux or OSX.  Which reminds me, it has a GPL w/CPE or CDDL header in NetBeans, though nothing in the platform build harness - either way it should be fine to use, just you might want to credit it!  persecutioncomplex

@rwatson462 - does swapping out the HelloWorld script for this also work?   Nothing like coding blind, but I think this should achieve the same with symlink resolution and not using cd.  Undecided


while [ -h "$PRG" ]; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
    if expr "$link" : '^/' 2> /dev/null >/dev/null; then
   PRG="`dirname "$PRG"`/$link"

progdir=`dirname "$PRG"`

"${progdir}/jre/bin/java" -jar "${progdir}/game/helloworld.jar"
2  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-24 07:29:38
I... have no idea what that script is supposed to do... or how it does it...

Can't remember much of the how ... did work it out when I first saw it.  Wink

Obviously didn't explain the "what" very well, though  Emo

This isn't a whole script, it's a fragment that goes at the top of your launcher script so that it can find out where it is.  Your problem on OSX and Linux is that the working directory is not set to the location of the launcher you click.  Once this fragment has run, the progdir variable will contain what you want to be the working directory.

So, if after the fragment you call
cd "$progdir"
, your working directory would then be like Windows - the location of the script.  However, it is better (more robust) to call things with absolute locations as the example at the end of my previous post.

The loose how - $0 contains the full path called (eg. your launcher).  The naive approach would just use dirname on this to get the directory.  The while loop handles the fact that if you or your user has created a link to the launcher script, $0 will be the location of the link instead - the while loop handles dereferencing through links to find the actual launcher location.
3  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-23 14:38:11
IIRC the working-directory on Mac OS X is the user-dir, not the directory of the double-clicked file / app.
Hmm. Any way of overriding that or getting the path of the double-clicked file? Sounds rather useless otherwise.

It's the same on Linux - it's Windows that behaves oddly!  Wink

You have potentially two things to deal with - finding the directory of your launcher and traversing symlinks to the actual executable script.

Sigh. This would be so much easier to figure out if I actually had a Mac... Is there any significant difference between how shell scripts behave on Linux and Mac?

Like I said, the NetBeans launcher script works on both.  I just looked for an old shell script launcher I had to handle this and it has an identical start to the NetBeans launcher script (pretty sure I got it from a website somewhere), but anyway ...


while [ -h "$PRG" ]; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
    if expr "$link" : '^/' 2> /dev/null >/dev/null; then
   PRG="`dirname "$PRG"`/$link"

progdir=`dirname "$PRG"`

At the end of that, progdir contains the directory holding your actual launcher script.  My old script called cd "$progdir", but you would probably be better working with absolute paths from then.

eg. something like IIRC

"${progdir}/jre/bin/java" ARGS

4  Game Development / Newbie & Debugging Questions / Re: Java2D fillRect() memory leak on: 2015-04-23 08:12:29
Past experience is that writing your own/stealing pixel-pushing routines in a bufferedimage can beat SunGraphics2D, although good luck with alpha compositing.

Or check out this thread with code for fast software blend modes.
5  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-22 22:31:00
Is it reasonable to expect Linux users to be less sensitive to stuff like icons?

Probably not, but it's reasonable to expect there'd be less of them!  Wink  Know your audience - go with the easiest approach until you know putting extra time in is worth the effort.

Do you think the average user would be okay with just a generic no-extension executable file?

Getting it all in a single executable is probably more work than creating the package file.  Just stick a folder with a shell launcher in an archive.  If you're clever about it you should be able to use the same launcher and structure for OSX and Linux.

Oh, the bin/ folder doesn't have javaw. -_____- I wonder why that is...

AFAIK javaw is a Windows-only concept.  I don't have OSX to test, but I noticed your app bundle has a somewhat different structure to mine, and I know mine works!  Wink  As Praxis LIVE is a NetBeans RCP application, it uses the build process from that, which seems to handle this well.  It might be worth having a look at the Praxis LIVE app bundle - IIRC the Contents/MacOS folder just contains a symlink to a folder in Contents/Resources, which has the same structure as the application folder in the zip bundle and .deb package.  All use the same shell launch script, which is part of the NetBeans RCP build, and is used for both OSX and Linux.

Also, I wonder if you're being bitten by issues with working directory, which behaves differently on Windows?  That shell launcher script also has logic in it to find absolute paths to resources based on its own location.
6  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-22 19:56:10
What kind of executables are Linux users used to? Simply making a shell script and not giving it an extension at all and somehow marking it executable (?) seems to be the way to go here. Is it possible to give such a file a custom icon? Is a desktop entry (.desktop) the way to go to get a custom icon?

Bear something in mind - Linux isn't an OS - Ubuntu (for example) is an OS.  If you want something that's going to properly integrate with icons, etc. you're likely going to have to make a package suitable for the OS.  I've seen a pure-Java RPM builder before, but not sure if there's a .deb builder.  You should be able to make packages very easily in a Linux VM though.

Not sure if you looked at the somewhat hidden link in my reply above - it's a blog post I wrote on how the Praxis LIVE package is built - Packaging as a .deb
7  Discussions / General Discussions / Re: Need halp (help) testing native binaries on Mac and Linux on: 2015-04-21 12:37:50
Hello. I am looking for people who happen to have a Mac and/or a Linux computer to test some simple native binaries.

Out of interest, how are you making them?

.. making our game look more professional with native binaries.

Have you looked at binary packaging (mainly .deb) on Linux too?  It's easy enough, and tends to give better OS integration.

I've got a range of machines, all currently running Ubuntu.  No Skype though!  PM me if you need to.
8  Discussions / General Discussions / Re: What do you think of Greenfoot? on: 2015-04-20 22:11:03
I personally prefer Processing to fill that role ..

You should check out Praxis LIVE too - it's a hybrid visual IDE that can be used for interacting with Processing, including live code editing.  Not primarily designed for teaching, but can be used as an easy entry point.

Said without the slightest bias Wink
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Animated graphics formats in OpenGL Java on: 2015-04-01 09:42:35
Right now I am switching to the latest gstreamer ... I doubt there will be problems

I don't!  If by latest GStreamer you mean v1.x then it won't work.  As mentioned above, we're working on v1.x support, but there's been significant API changes from the 0.10 series.

@Topic so yes I GUESS you can use that for simple short animations, but its heavy weight overkill

Oooh, there's a topic?!  persecutioncomplex

Sorry, kind of dived in to reply to @theagentd without fully reading your original post.  Yes, I'd agree for this purpose it's possibly overkill.

Of the options you mention I quite like MJPEG.  It's pretty easy to decode in pure Java.  I used some code years ago to read from an IP camera, but no idea where that came from.  There are a few options if you Google though (eg. jAVIlib - not tested it!)

We use MJPEG a lot with GStreamer too in projects like this, where we used motion tracking and had faces following people around a room.  Because all frames in a MJPEG are effectively keyframes, it makes it easy to seek back and forth as you want seamlessly.

Also, I guess you could look at 3D textures for short animations.  All depends on your use case.
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Animated graphics formats in OpenGL Java on: 2015-03-31 18:46:54
Well, the video playback libraries I've seen so far haven't exactly been crossplatform. Having more 3rd party dependencies isn't really a good thing, and native code seems to be a lot more tricky to get right.

GStreamer is cross platform, and work is ongoing to get the Java bindings supporting v1.x, though v0.10 works well (try out Praxis LIVE!  Wink )

VLC is cross platform, though Java bindings could be a license issue.

FFMPEG / libAV is cross platform, and there are various bindings, including ... ^^ thanks for the link @basil_ - that looks really interesting.  EDIT - And AGPL!  Emo
11  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Animated graphics formats in OpenGL Java on: 2015-03-31 14:46:59
Mind you, if you're using OpenGL, why would you want to do video decoding in Java?!
Hmm? Why not? I want prerendered cutscenes, tutorial movies, etc.

That's not the answer to my question!  Tongue

If you're using OpenGL, you're already using native code.  So, why not use a native video library?  A native video library running on the CPU is likely to perform better, and also not bring all that data into Java memory if you're uploading directly to OpenGL.  And given the right library, you might even be able to get GPU video decoding.

So, my question was not why you might want to play videos, but why you want the decoding done in pure Java?
12  Discussions / General Discussions / Re: Concurrency Library on: 2015-03-31 09:44:26
Also, since the blocking version uses the same locks as ArrayBlockingQueue it doesn't improve on the garbage generated ...

Could you elaborate on this, seen as I haven't profiled either - what garbage is generated?  And why?

To the OP - Disruptor has been mentioned a lot on this forum, though almost always by @Spasi  Wink
13  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Animated graphics formats in OpenGL Java on: 2015-03-31 09:37:01
Well, I was Googling for the link to a part-complete VP8 decoder I saw a few years ago, and this came up.  Despite not being included in the README it does seem to have code for VP8.

Mind you, if you're using OpenGL, why would you want to do video decoding in Java?!
14  Game Development / Newbie & Debugging Questions / Re: Going to build 2.5d Game on Facebook by JavaFX , your advice? on: 2015-03-16 11:27:08
Frankly I dnno more about the news in HTML5 , but i know that you can build simple game using it , but what i'm talking about is online network game with lot of motions and effects .

Maybe you should check out some of the three.js examples before saying "simple"??  Wink
15  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env on: 2015-03-15 18:54:21
Now to get on with all those other pesky things, like release notes ...

Well, release notes are up!

I've also put up a (currently hidden) OSX app bundle.  If you're intrepid and fancy testing it, it's here.

I'm quite pleased with the new live-code / Fork All support, which makes heavy use of annotations.  Here's a fork of the built-in core:math:add component (just added range so you get the slider)

And the code for this is just -

    @P(1) @Type.Number(min=0, max=10) 
    double value;
    @Out(1) Output out;
    @In(1) void in(double x) {
        out.send(x + value);

Which is all compiled and configured on the fly.  Of course it gets more fun when you throw video, GLSL, etc. into the mix!  Grin
16  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env on: 2015-03-13 22:09:56
And finally ... Praxis LIVE v2.0.150313 is ready for download.

This is the first full release of v2, and adds the remaining major piece of the jigsaw - Fork All - most built-in components have been rewritten to use the custom coding API, meaning if they don't do exactly what you want, you can edit them on the fly.

Now to get on with all those other pesky things, like release notes, new examples, custom component repository, updated manual ... but that's for another day, for now I sleep.  Cheesy
17  Discussions / General Discussions / Re: New feature: mentions in posts on: 2015-03-12 18:54:34
Currently celerating the big three-oh ...
I hit the big two-nine in exactly a week ...

You two make me feel really old!  Emo

Happy Birthday @Riven  Grin
18  Discussions / Miscellaneous Topics / Re: Android Studio comedy of errors on: 2015-03-09 09:04:59
Hey Phil, having fun there?!  Grin

Rather than tying yourself in knots over this, it's worth looking to see if anyone has done the job for you (the latter looks like it might be better) -

If you're new to Ubuntu and what you want isn't in the official repositories, it's worth checking out what PPA's are available before going with manual install.  There is also a PPA for Oracle Java, which will install it in the right place for you!

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.

This statement is wrong, btw - Ubuntu has both Java 6 and Java 7 (OpenJDK, obviously!) available in the standard repositories.
19  Game Development / Game Mechanics / Re: Making GUIs on: 2015-03-04 09:12:34
nsigma at least understands the problem and offers some directions to the solution. The run-your-game-loop-on-the-EDT solution is obvious and isn't the solution I'm after which is painting the GUI in my own thread.

And I say this in the friendliest way (eyeballs @Riven Wink ) - What's so damn special about your own thread?  Do you complain that main() doesn't run in your own thread?  Now, I'm not 100% sure this is the way to go, or that AWT wouldn't kick up a fuss about it, but it would be the simplest way - just make sure to manually drain and dispatch the event queue!

public static void main (final String[] args) {
  EventQueue.invokeLater(new Runnable() {
    public void run() {

If you're stuck with using another thread, I have doubts, as you do, about active rendering from another thread while the EDT is still processing events - not just on the paint() thing, but also because models aren't thread-safe.  So, custom queue ...

How do you push your own EventQueue? I note that there is Toolkit.getEventQueue but no Toolkit.setEventQueue()?
I would like to see your EDT-event interception idea work. As I said, no-one has demonstrated this being done that I have ever found.

Try some Google-fu on "extends EventQueue"!  Cheesy  There are lots of projects using event queue interception for various reasons - the one I'm most familiar with is in NetBeans because I work with the RCP a lot (this doesn't re-dispatch to another thread, but times and warns on long running events)

The method you're looking for is called push(), but it's on EventQueue itself.  You don't replace the Toolkit queue, you push another on top of it.
20  Game Development / Game Mechanics / Re: Making GUIs on: 2015-03-03 12:05:33
pretty much what CommanderKeith says :

  • Expose a hook to let us see the OS event queue in our game loop thread if we want so we can take the events we want to consume and make game logic updates
  • Let us call an update method on the Swing components with any relevant events for them given as an argument which would happen in our game loop thread,
  • Let us call paint on the Swing components from our game loop thread and repeat.

You can do all that already!  To paint, you could use active rendering, or if you're running your game loop in the EDT you could control the default Swing paint mechanism.  For the other two, use Toolkit.getSystemEventQueue() to get access to the queue.  If you're running your game loop in the EDT, just pull events and dispatch (see component.dispatchEvent()).  Otherwise, push your own EventQueue implementation on top of the existing and override EventQueue.dispatchEvent() to filter / pass to your game thread.  The latter might have an issue if anything was using EventQueue.isDispatchThread() though.

Shocked setting a proper BufferStrategy makes EDT not call paint() on a component and allows painting the whole component-tree in custom thread ?

Not exactly!  Read the link @princec gave, in particular the second point under programming tips -

Use the setIgnoreRepaint method on your application window and components to turn off all paint events dispatched from the operating system completely, since these may be called during inappropriate times, or worse, end up calling paint, which can lead to race conditions between the AWT event thread and your rendering loop.
21  Game Development / Game Mechanics / Re: Making GUIs on: 2015-03-02 23:05:49
Modal dialogs do not cause a new Thread to spawn. They create a new Event Queue and Event pump, right on top of the current queue/pump. Think of it as recursion. A stack of queues and pumps, where only the top of the stack is active.

hmm .. OK, that's me misreading some ambiguous JavaDoc  Roll Eyes - to me, that doesn't count as "block the execution of the current thread".  Has that always been the case?  Vague recollection of seeing new event threads spawned from dialogs in the long distant past, but guess that might be the other reason you mention.

Still doesn't mean I like this (fake) blocking behaviour, but it's a bit better than I assumed.

the only thing that sun did not do well is to give us proper control over polling and flushing queues - which is done by the EDT for us.

What exactly do you want by "proper control" above what EventQueue or a custom subclass gives you (assuming you can re-appropriate the dispatch thread)?  Not that I don't agree with all of your second sentence!  Wink
22  Game Development / Game Mechanics / Re: Making GUIs on: 2015-03-02 21:30:28
What would be the alternative? For the entire GUI to freeze up whenever a dialog was opened? Or for no modal dialogs to be supported?

You're blurring together threads and modality.  There's no reason for dialogs not to be done using asynchronous callbacks - eg. the approach something like jQueryUI uses.  Swing is mostly event driven, so it just seems weird to me that this isn't the approach here.

JavaFX does have an EDT- they just call it the JavaFX Application Thread. And they do have an invokeLater() method, they just call it Platform.runLater()! But it's interesting that they chose not to include a runAndWait() method.

That was what I was trying to say, possibly too cryptically! Grin
23  Game Development / Game Mechanics / Re: Making GUIs on: 2015-03-02 19:37:08
Important: At the moment we use a nasty hack to make event system work: Set dispatcher field of Container class with reflection. ... However we beleive event system can also be made work with a custom Toolkit and a dummy Peer. Indeed we seek help from AWT/Swing gurus about this subject.
I think this shows that the Sun programmers did not make the Swing library with re-usability in mind, they have designed the swing library to be used on the event dispatch thread only.

I was waiting to see what @KevenWorkman replied first, but there's probably another hacky (but less hacky than above!) way of doing this, without going as far as creating a new Toolkit - run the main game loop on the (well, an*) EDT.  The EventQueue will give you access to events which you can filter and dispatch as you like.

* Stupidest threading decision in AWT / Swing is blocking threads and pushing a new EDT / EventQueue when a modal Dialog opens!  Roll Eyes  The above suggestion would break if a Dialog opened.

Swing takes sole control of the operating system (OS) event queue in its event dispatch thread (EDT), forcing us to do all of our work on the EDT or making us do messy invokeAndWait's all the time.

Which is still doing the work on the EDT - invokeAndWait() - the ideal way to make hard to find bugs - there's a reason they left it out of JavaFX!  Wink
24  Game Development / Newbie & Debugging Questions / Re: Java Swing / AWT Sounsd on: 2015-02-19 19:14:27
25  Discussions / General Discussions / Re: Paint.NET alternative for OSX on: 2015-02-18 12:38:58
No idea if it's any good, but came across this last week.
26  Discussions / General Discussions / Re: Do you sometimes skip braces? on: 2015-02-08 18:03:41
I took a lot of line breaks away to make the post smaller, let me adjust and see if you still agree :p lol.


It's like asking a British English speaker (me) to read American English.  I mean, it kind of looks like it should make sense, but still ends up feeling like you're reading gobbledygook.  Tongue
27  Discussions / General Discussions / Re: Do you sometimes skip braces? on: 2015-02-08 17:15:47
Never, never, never, never, ... and never!   Grin  IMO, shouldn't even be valid syntax.

I do do what @Yemto mentions earlier, though, and use ternary operations fairly frequently.

Kind of avoided braces right?

Looks a lot nicer than:

And yet, I find your latter example easier to understand.
28  Discussions / Miscellaneous Topics / Re: Git GUI tools for Windows on: 2015-02-08 17:06:06
In the spirit of @ags1

Erm... NetBeans?

29  Discussions / General Discussions / Re: Old Forum Stuff on: 2015-02-03 17:22:53
I started the forum in 2001 ...

Yes, where's ChrisM at the top of JGO's most awesome members?  I mean, Markus?  Where would Minecraft have got without JGO?!  Tongue
30  Discussions / General Discussions / Re: Schemes to teach the masses to code on: 2015-01-29 17:30:16
I guess we have to agree to disagree, because I (respectfully) disagree with pretty much every point here.

I'm not saying we need to teach 6 year olds the intricacies of advanced computer science. I'm saying we should introduce some of the most basic, fundamental concepts, such as logic and problem solving ...

Absolutely on your side of that argument!  Wink

What's missing from your argument IMO is logic / problem solving and creativity - taking it beyond fundamental concepts and allowing young people to apply logic / problem solving to the creation of something that interests them.  The best of these schemes are all about getting beyond the abstract and making something fun - nothing beats applying knowledge to a real-world application, but that's what's missing in 95% of education.

There was a woman who brought her 9 year old daughter down to our hackspace a while back.  Her daughter had had her own Pi for a few weeks, and had been involved with one of these schemes.  She'd started off making stuff in Scratch, and by then spent the evening sitting in the corner programming a game in Python.  I'll argue with anyone who thinks that's not awesome, and it would not have happened without schemes like this.  Grin
Pages: [1] 2 3 ... 32
Ralphanese (16 views)
2015-05-28 16:52:52

theagentd (30 views)
2015-05-27 22:21:17

theagentd (35 views)
2015-05-27 22:21:08

CopyableCougar4 (24 views)
2015-05-27 19:24:50

MrMapcom (24 views)
2015-05-23 20:26:16

MrMapcom (32 views)
2015-05-23 20:23:34

Waterwolf (37 views)
2015-05-20 15:01:45

chrislo27 (44 views)
2015-05-20 03:42:21

BurntPizza (79 views)
2015-05-10 15:53:18

FrozenShade (64 views)
2015-05-07 09:11:21
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

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 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!