Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (564)
Games in Android Showcase (151)
games submitted by our members
Games in WIP (605)
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  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
2  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
3  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
4  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
5  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.
6  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.
7  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.
8  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
9  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
10  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
11  Game Development / Newbie & Debugging Questions / Re: Java Swing / AWT Sounsd on: 2015-02-19 19:14:27
12  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.
13  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
14  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.
15  Discussions / Miscellaneous Topics / Re: Git GUI tools for Windows on: 2015-02-08 17:06:06
In the spirit of @ags1

Erm... NetBeans?

16  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
17  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
18  Java Game APIs & Engines / OpenGL Development / Re: Fill Ellipse from a fragment shader on: 2015-01-18 14:22:23
If you want to do this in a fragment shader, wouldn't you be better using texture coordinates rather than gl_FragCoord and your uniforms?
19  Java Game APIs & Engines / Java 2D / Re: Draw BufferedImage to panel on: 2015-01-03 17:24:28
Also, you probably don't want to be loading the image in every call to paintComponent()!  Wink  To start with, make the image a field and load it once (eg. in the constructor).
20  Game Development / Newbie & Debugging Questions / Re: Using enum, how does this work? on: 2015-01-03 12:57:07
It looks like you're thinking of bitflags, but have it all garbled up.
or to use an EnumSet. But I don't know of any magic wildcard enum trick.

Yes, use EnumSet, which is already backed by bitflags underneath.


EnumSet<Day> mwf = EnumSet.of(Day.MONDAY, Day.WEDNESDAY, Day.FRIDAY);
EnumSet<Day> weekdays = EnumSet.range(Day.MONDAY, Day.FRIDAY);
EnumSet<Day> all = EnumSet.allOf(Day.class);

mwf.contains(Day.TUESDAY); // false
weekdays.contains(Day.TUESDAY); // true
all.contains(Day.TUESDAY); // true

21  Game Development / Newbie & Debugging Questions / Re: String in the Middle off player Depending on String Length! on: 2014-11-30 11:00:34
Try having a look at font.getStringBounds() and use half of the width to offset your position.
22  Discussions / Miscellaneous Topics / Re: How memory works? on: 2014-11-15 13:04:31
AFAIK, the escape analysis is there and it is possible to determine whether an object could be stack allocated, but I am yet to see a JVM that actually does it.

Am I missing something?  I was under the impression that this was enabled by default since 2009!  persecutioncomplex  OK, technically this is scalar replacement not stack allocation, but in this context (not user defined) what would be the difference?  What benefits are missing?
23  Discussions / Miscellaneous Topics / Re: simplifying getter/setter classes on: 2014-11-07 23:09:28
If your setters are doing that much stuff you are doing it wrong.

Yes, better file a bug, 'cause there's loads of classes in the JDK doing all those things! Tongue

In fact, firing events and validating values are kind of a key part of the JavaBean standard - see PropertyChangeListener, VetoableChangeListener, etc.

JFTR, it's not that I'm a great fan of the JavaBeans getter / setter pattern - I prefer fluent interfaces - but just using public fields unless we're talking proper value objects .. yuck!  Wink
24  Discussions / Miscellaneous Topics / Re: simplifying getter/setter classes on: 2014-11-07 12:09:07
public fields.

a good IDE can track write access, so it's as good as tracking the "usage" of a setter.

Did you read my second paragraph?!  Tongue  This is about run-time tracking changes, which an IDE ain't much use for.  Wink
25  Discussions / Miscellaneous Topics / Re: simplifying getter/setter classes on: 2014-11-07 11:25:15
Or better yet, since you're not writing a long lifetime public API used by thousands that are hampered by API changes...don't use getter/settters.

This is getting a lot of medals!  Wink I'm intrigued what your suggested replacement is?

There seems to be an assumption here that setters just set a variable and getters just return a variable.  The majority of uses of setters in my code do much more than that - validate values, fire listeners, invalidate caches, etc.  Even for those minor cases that it is a 'pure' setter, I'd rather leave the option open to add these things in without massive refactoring - even in a private codebase that's still more of a PITA than writing a few setters!

2c  Grin
26  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env on: 2014-11-06 21:18:15
Sick. I really need to invent a project to do that involves the use of this.  Pointing
Thanks!  You seen this?  It's what I use it for, anyway.  Grin

And hey, I have that lenovo too!
Awesome laptop, and means I can test on Intel and Nvidia easily.
27  Discussions / Miscellaneous Topics / Re: simplifying getter/setter classes on: 2014-11-06 21:11:18
Still quite a lot of front-end Java work around as far as I can see, though not as much.

Judging from NetBeans RCP mailing lists, etc. there's no shortage of enterprise desktop applications being developed.  I assume other platforms (Eclipse?) may be similar. (my usage of the NetBeans platform for Praxis LIVE is definitely atypical usage. Wink )
28  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env on: 2014-11-06 16:10:24
A slightly belated update that a new alpha release is now available, which finally brings distributed hubs into Praxis LIVE.  There are two primary reasons for this - running pipelines in different local processes to reduce GC timing effects (eg. on low-latency audio), and running and working with pipelines running on different machines across a local network.  Read more about it in this blog post.

Here's me editing Java & GLSL code on one laptop while it runs on another laptop.

 .. which does give me one idea that might be useful around here - live-coding GLSL shaders on multiple machines at the same time to test on different graphics cards / OS?

Get it while it's hot,
Praxis LIVE v2.0a3-141101 Download | Release notes
29  Discussions / General Discussions / Re: Give me a topic.. on: 2014-10-23 10:41:03
Avoid strawberries.

(just checking changelog for latest OpenJDK release - Avoid strawberries in LogRecord - WTF?  Clueless )
30  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Announce Pure Java HIDAPI on: 2014-10-22 13:43:24
And of course it uses some native libraries, there is no other way AFAIK, but the native libraries are included in your favourite OS.

JNA is not included in the OS though!  That was the crux of my issue before (not the stoopid "pure" argument  Wink ), but making sure people were clear it needs JNA, which is a native library.  Just linking in the JNA jar works most of the time, but there can be issues with the automatic extraction of the native libs.  Don't get me wrong, I like JNA and have made some minor contribution to it, but it's not always headache free to bring into a project.

Incidentally, on some Linux (eg. recent Ubuntu's), installing things like VisualVM will bring in an old version of JNA to the OS that would stop your code working unless it's setting jna.nosys.  OTOH, forcing extraction won't work on some systems.  NetBeans actually uses a renamed JNA native lib to get around both those issues.
Pages: [1] 2 3 ... 32
theagentd (9 views)
2015-03-27 23:08:20

wxwsk8er (52 views)
2015-03-20 15:39:46

Fairy Tailz (45 views)
2015-03-15 21:52:20

Olo (28 views)
2015-03-13 17:51:59

Olo (30 views)
2015-03-13 17:50:51

Olo (35 views)
2015-03-13 17:50:16

Olo (41 views)
2015-03-13 17:47:07

ClaasJG (40 views)
2015-03-10 11:36:42

ClaasJG (39 views)
2015-03-10 11:33:01

Pippogeek (47 views)
2015-03-05 14:36:23
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!