Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (649)
Games in Android Showcase (181)
games submitted by our members
Games in WIP (700)
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: design pattern to avoid exponential number of extensions on: 2016-01-27 19:50:38
Sadly, the complexity of the coding involved, with my modest skills, would likely set me back several months, maybe even a year or more.

I think you're massively overestimating the complexity of this.  If you're looking for a design pattern for this particular use case, the Unit Generator one is fairly standard.
2  Game Development / Newbie & Debugging Questions / Re: design pattern to avoid exponential number of extensions on: 2016-01-27 11:47:18
Better to message me if there is more you want to say more about the getNote() process, unless it involves composition/functional interface aspects.

No.  Other than be wary of adding in too many method calls / overridden methods on per-sample code.  Sometimes real-time audio code is ugly!  Wink

I'm not sure why you're worrying about these calculations happening at per-sample level, or even with 32 sample period, though.  Neither why you're looking at interfaces with multiple implementations in that way.

Ideally, I'd suggest you want a series of concrete operations (potentially functional interfaces, though many will be stateful) that work on a float[] buffer and you chain those together in whatever order is required for the synth output.  A chain of simple operations on a float[] will generally be faster than complicated logic per-sample.

eg. to get a synth envelope, one operation fills a float[] with the synth source (oscillator), another fills a second float[] with the envelope (0 .. 1), and another operation multiplies the two together for output.

Oscillator -----\
                         multiply -> output
Envelope -----/

This incidentally gives you sample accurate output internally.

Then you need to look at external events, in which case you either process events on a per-buffer basis (eg. every 64 samples), or alter your operations to take a size parameter too and not rely on the array length.

eg.  You should know at the start of processing every soundcard buffer at what point during that buffer any event happens.  You may be working with a 512 sample buffer, but know that an event happens at sample 365.  In which case you pass through the 512 sample float buffer through your chain of operations, but tell them to only write up to sample 364.

Hope that makes some sense.
3  Game Development / Newbie & Debugging Questions / Re: design pattern to avoid exponential number of extensions on: 2016-01-26 10:03:57
Here is an example. The synth has a premade pool of SynthNotes, which match the polyphonic capability of the synth. The default implementation searches through this collection of notes for one that is flagged 'isAvailable".

An alternative implementation defines the pool of SynthNotes by creating one per each permitted pitch. When a new SynthNote is needed, the search pulls the SynthNote for that specific pitch, and restrikes it (whether the note is playing or not).

A comment on your specific use case - most polyphony code I've seen does both these things.  They use a fixed pool of SynthNote, and search for an available note in the following way.

  • If there's a SynthNote playing the same pitch, return it.
  • else, if there's a SynthNote not playing, return it.
  • else, find the SynthNote that's been playing longest (note stealing), and return it.
4  Game Development / Game Mechanics / Re: Gradle game modding system? on: 2016-01-19 16:42:47
Do you really need the JDK, or just javac?  It's possible to rip out just the bits of the JDK you need.  I actually ship a refactored version of javac inside Praxis LIVE -
5  Game Development / Newbie & Debugging Questions / Re: What type of rendering should I use? on: 2016-01-18 10:37:33
or (browser based) environments like Processing,

nit-pick - Processing isn't a browser-based environment (although it can target JS in the same way libGDX can).

Otherwise .. good point!  Grin
6  Game Development / Game Mechanics / Re: Blending hex colors for 2D pixel lighting on: 2016-01-14 09:19:54
This old thread on blend modes might be useful for what you're doing.  For best performance, if not most accurate result, I'd think you want to stick with doing this all without double conversion.  Mind you, something to benchmark!  Also, know when you need to clamp and not - multiply blending is self clamping.

My code that's referred to has moved - it's here and here.
7  Discussions / General Discussions / Re: Android to move to OpenJDK????? on: 2016-01-12 12:43:28
@bobjob - there is already a thread on this -
8  Java Game APIs & Engines / Java 2D / Re: 2D Graphics Libraries on: 2016-01-08 09:17:03
You should also check out Processing.  It has a richer feature set for 2D graphics than libGDX (at least the last time I checked), and supports both Java2D and OpenGL rendering.  It can also convert code for JavaScript use.  And, it now supports the option you missed out in your original question, which is JavaFX.
9  Discussions / General Discussions / Re: Android moving to Java 8? on: 2016-01-04 10:39:20
Java 7 was EOLed back in April last year or something and Java 8 really moves the language along a lot.

While I don't disagree with the latter bit at all, Java 7 was not EOL'd - Oracle stopped releasing free public updates for its JRE.  They are still supporting paid customers, and there are still paid and free supported Java 7 JRE's.  Hell, OpenJDK 6 is still being updated!  Wink

None of that is a reason not to move on to Java 8 if you can obviously, just that I've seen that EOL statement used to try and push Java 8 features into libraries too early.
10  Discussions / General Discussions / Re: Android moving to Java 8? on: 2015-12-30 19:50:01
Can but wonder why they didn't make this move years ago (the OpenJDK bit, not the Java 8 bit) and save themselves a big headache?!  Roll Eyes
11  Game Development / Newbie & Debugging Questions / Re: Is it worth to use nashorn ? on: 2015-12-30 13:06:39
Who needs enums and runtime annotations for handling an
event Pointing

I needed runtime annotations for what I wanted to do, which is admittedly more complicated than your example.  The annotations are used to define behaviour and / or inject variables into the "scripts".  It can lead to much simpler user code.  Imagine you've got 10's or 100's of such onXSomething() style hooks, and the user wants to run a fragment of code on a subset of them - you can define annotations to filter the conditions such code is run and help the engine manage scripts more easily.

It depends on the level of flexibility around connections / maintaining state you require.  Simple example of how I'm using annotations is here -
12  Game Development / Newbie & Debugging Questions / Re: Is it worth to use nashorn ? on: 2015-12-30 12:37:14
Well, by definition an infinite loop won't finish in 1 more cycle!   Wink  However, I understand your point.  But, who cares?  If we're talking in the context of a game, or any other real-time situation, you want code with a maximum bounded execution time?  In that situation code that exceeds that contract is invalid and should be disabled.  But how to do that without potentially leaving invalid state and/or making the code run substantially slower - eg. one thought I'd had was a monitoring thread and injecting a check on a volatile flag into every loop. 
13  Game Development / Newbie & Debugging Questions / Re: Is it worth to use nashorn ? on: 2015-12-30 12:22:28

Thanks for the link!  Bear in mind @Riven said "handling" though.  Handling the possibility is not the same as proving it will occur!  Wink
14  Game Development / Newbie & Debugging Questions / Re: Is it worth to use nashorn ? on: 2015-12-30 11:59:01
I agree with @Riven about using Java.  You may potentially find Janino somewhat limiting though - it's missing some useful language support (eg. enums and runtime annotations).  In the Praxis LIVE repositories you can find a forked version of Janino and a refactored javac should that be useful.

The compiler is Java 7 currently - will be adding Java 8 version in the new year.  Fairly easy to refactor though - it's mostly changing package declarations, some in strings IIRC.

Setting up the classpath is a little more complicated than vanilla Janino though.

... how do you expect to handle, say, an infinite loop? ...You can use Java's bytecode transformation library ASM to validate the generated bytecode (validating plain sourcecode is too complex), by whitelisting method calls (not blacklisting them).

Personally I'm dubious about using ASM to do security management in this way.  If it's for the user's own use, why bother with the complexity.  And if you're expecting users to share scripts then I think it's probably better to assume caveat emptor than set up expectations that you've closed every loophole.

@Riven - I would be interested in your thoughts on handling an infinite loop in this situation though.
15  Game Development / Game Play & Game Design / Re: Is a Binaural Sound Engine in Java possible? on: 2015-12-28 17:25:06
Granted my interest is rather involved having a 32 speaker hemisphere to work with for high order Ambisonics with a bunch of multichannel convolution reverb and real time synthesis potentially running in addition to loops / one off samples. for picts. Now if only audio / music-tech could actually pay SF rents; :: sigh ::

Yes, I'd had a look at your website already.  Interesting stuff!  In fact, reading your TyphonRT synopsis shows we have some fairly similar shared concerns.

Our audio interests are actually not that different either, particularly multi-channel (done a variety of projects there, and I'm the developer of the JACK bindings for Java) and real-time synthesis (eg. )

I simply was pointing out that working with SuperCollider server as a headless audio engine grants this out of the box. Take it or leave it...

No issue with that!  You seemed to be saying that running audio in a separate process was beneficial / the only way to make best use of multi-core, without really saying why processes rather than threads.  It's a more complicated way of working which can offer benefits in certain cases, sure, but not sure I'd advocate it as the go-to solution in all cases.  I am genuinely interested in your reasoning.

Incidentally, I guess working with JACK is in some ways midway between those two options.

SuperCollider.... It really has been "the" most advanced open source audio engine for many years now.

Possibly!   persecutioncomplex  I'm not sold on it being the best solution in all cases.  I'm definitely not sold on it being the OP's solution!

Would you agree libraries like nanomsg are pointless given that scaling is done through sockets and multiple processes coordinating?

No, why?
16  Game Development / Game Play & Game Design / Re: Is a Binaural Sound Engine in Java possible? on: 2015-12-28 14:42:38
If you're making a game engine especially one that is taxing in graphics, physics, AI, etc. then it's clear splitting off audio to a separate process is _potentially_ beneficial definitely if one is also doing heavy audio processing; like anything else measure and adjust if necessary.
I think you're just pulling my leg...

No, I'm not pulling your leg.  I'm trying to understand why you said running audio in a separate process is to do with multi-core?  There are reasons for running audio in a separate process if it's written in Java and you want very low latency because you can better control GC effects, etc.  My environment is not a game engine, but it is that taxing, and it will run Java audio fine in process at higher but usable (in this context) latency.  I'm not sure having a native bound audio engine in or out of process would make much difference?

Incidentally, the reason I personally work with Java is to support JIT coded / compiled DSP.  Nothing against working with native libraries for this.

What do you think is better than OSC for audio control data and such?

OSC is great - I currently use it for inter-process / inter-device communication.  I am questioning why you'd want to code with it when you can make use of a native library with proper Java bindings.  Nothing against things using it under the hood, but that wasn't really how it came across above.

Yeah.. Too bad JCollider is GPL and in a seemingly defunct state.... Glad to see the fellow continue w/ ScalaCollider, but all of his stuff looks to be under GPL.

JCollider is LGPL!

Whether you launch a separate VM or have an audio engine running in a separate process the benefit is reducing the work done in main game engine / VM process. Let the OS figure it out.

Why?  This is the bit I'm confused about in your statement - leaving aside Java-side GC or other VM locking, why is running code in multiple processes better than multiple threads?
17  Game Development / Game Play & Game Design / Re: Is a Binaural Sound Engine in Java possible? on: 2015-12-28 12:03:38
@philfrei - you rang!  Wink

Despite what some others have said, Java itself is great for coding real-time audio processing, learning DSP, etc.  I've been doing real-time Java audio work for many years now.  However, unless you have a particular desire to learn about the principles underlying binaural sound, I'd agree with @Spasi about using OpenAL for this.

If you do want to learn principles, then there's a huge range of other options, both pure-Java and native (by pure-Java there I mean the DSP code itself is in Java and can be hacked on).  Having a look at libraries used with Processing is interesting, including Minim (really not sold on its per-sample UGen processing!) and Beads.  Interestingly, Processing v3 has switched to a binding to the native Methcla library, which looks interesting even if the way it's bound is a bit dubious.  Alongside SuperCollider there are actual Java bindings for both libPD and CSound - JCollider unfortunately seems defunct, although there's Overtone and ScalaCollider - why the hell anyone would prefer OSC I don't know!  persecutioncomplex

This has the benefit of running heavy audio loads in a separate process from any game engine which is great in the multi-core world of today.

Trying to work out if that sentence makes any sense?!  Wink  Praxis LIVE supports running audio in a separate VM, so independent process, but this to do with managing GC pauses when doing very low latency audio.  I don't see why this statement has anything to with multi-core?  It's perfectly possible to run pure-Java or native audio DSP and a game engine in the same process.

Why do so many people think Java is slow??  Emo
18  Game Development / Game Play & Game Design / Re: Fatigue as a design element on: 2015-12-28 11:30:48
I think most agree that as we get more tired, it often becomes harder to focus or concentrate. Introducing additional distracting elements or just making the background noise louder relative to more important sound content could simulate the effect of being tired.

Where sound is essential to gameplay, as opposed to just atmospheric, this could be really interesting.  I think there is more to making this "feel" right than just adjusting volume though, perhaps filtering and otherwise affecting sounds as well to make them more difficult to distinguish, or playing with panning effects to make it more difficult to distinguish where sounds are coming from? Where a player needs to listen carefully for particular sounds, introducing similar sounding fragments to simulate auditory hallucination brought on by fatigue?  Lots of possibilities with this!  Smiley
19  Game Development / Networking & Multiplayer / Re: What I need to host a java server on: 2015-12-17 12:25:54
Cheap 5$/month VPS are a dime a dozen you can start to get your hands dirty with.

Get a cloud server from Digital Ocean - $5/month - they're awesome!  Wink

Slightly surprised that Tomcat isn't one of their one-click install options though.  Still, lots of documentation from them on how to set it up.
20  Java Game APIs & Engines / OpenGL Development / Re: Netbeans GLSL editing mode? on: 2015-12-15 16:00:33
There are plugins but for older versions. For example a syntax highlighter:

I'm using that plugin for GLSL support in Praxis LIVE, which is based on NetBeans 8.0, so you should be alright there.  At some point I'll look at extending the somewhat limited feature set, and will either contribute back or possibly release as a fork.
21  Discussions / General Discussions / Re: SMF is falling apart. on: 2015-12-08 10:29:48
We need something more modern, although there will always be a culture shock when new styling is applied. People might revolt, before lovin' it Smiley

Make it responsive and we'll all be lovin' it from the get go!  Grin
22  Discussions / General Discussions / Re: SMF is falling apart. on: 2015-11-20 10:45:36
Works for me. Which browser are you using?

Well, can't answer for @CodeMason, but @basil_ and I have both mentioned this earlier in this thread as an issue on Firefox.  Hope that helps.  Happy to test anything / attempt debug if necessary.
23  Discussions / General Discussions / Re: SMF is falling apart. on: 2015-11-17 12:58:56
maybe it's just me but ...

the post-preview works when using the quick reply - once, then it's stuck at showing Fetching preview...


What browser are you using?  I've found it never works at all in Firefox, but seems OK in Chrome.
24  Game Development / Newbie & Debugging Questions / Re: Cannot run a program by clicking on its icon whereas it works in command line on: 2015-11-09 17:54:46
nsigma, as far as I know, the Java packager you quoted is unable to create Linux packages under Mac OS X and Windows unlike my own tool Smiley

No idea, don't use it!  I was just demonstrating that the script fragment posted earlier, used in both the NetBeans and Praxis LIVE launchers, is used in lots of other Java tools too.
25  Discussions / General Discussions / Re: Library Performance vs. Stupid Mistake Friendly on: 2015-11-08 22:18:11
You need to learn what Java assertions are!
26  Discussions / General Discussions / Re: Library Performance vs. Stupid Mistake Friendly on: 2015-11-08 11:20:39
For your specific example, caching and passing the current thread id through underlying calls would all but remove the overhead.

Requiring the user to pass the current thread whenever they want to set the size of the window seems a little messy.


This doesn't seem the sort of thing that should be polluting your API.  What about using assertions instead?  These sort of checks sound like the sort of thing that should be switched off in "production" code anyway.
27  Game Development / Newbie & Debugging Questions / Re: Cannot run a program by clicking on its icon whereas it works in command line on: 2015-11-02 17:17:43
I understand your position, I use Stackoverflow with OpenID. I'll mention it.


The script you suggest uses dirname which doesn't work everywhere too :s

Really, where?  I thought dirname was part of POSIX?
28  Game Development / Newbie & Debugging Questions / Re: Cannot run a program by clicking on its icon whereas it works in command line on: 2015-11-02 15:39:06

That would involve me having a stackoverflow account ... sign up ... question is locked to people without "reputation" ... give up on the whole pointless exercise  Emo

Feel free to mention it yourself - not like it's my code anyway!  Wink
29  Game Development / Newbie & Debugging Questions / Re: Cannot run a program by clicking on its icon whereas it works in command line on: 2015-11-02 10:05:37
This script is nice, mine works under OS X too by the way.

Ah, yes, sorry - obviously some uses of readlink don't work on OSX.

Have you passed checkbashisms on it?

No, but bear in mind this bit of script is also used every time someone uses NetBeans on Linux, OSX, or any other Unix.  And if you Google it you'll find it in use in lots of (particularly Java) projects, eg. -
30  Game Development / Newbie & Debugging Questions / Re: Cannot run a program by clicking on its icon whereas it works in command line on: 2015-10-31 12:11:47
You may want to have a look at this "hideous" bit of script.  It's from the launcher code in NetBeans, which is also used in Praxis LIVE and that definitely works from a DEB in Ubuntu 14.04.  If you search for it you'll find it in use in various other places too.  It has the added benefit of working on OSX.


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"`

btw - I don't think the warning message is relevant to your issue, and "no such file or directory" seems fairly self-explanatory.
Pages: [1] 2 3 ... 37
KaiHH (164 views)
2016-01-31 23:15:29

sci4me (158 views)
2016-01-23 21:47:05

sci4me (141 views)
2016-01-23 21:46:58

KaiHH (175 views)
2016-01-19 13:26:42

theagentd (261 views)
2016-01-05 17:10:00

ClaasJG (277 views)
2016-01-03 16:58:36

chrisdalke (266 views)
2015-12-28 06:31:21

Guerra2442 (278 views)
2015-12-25 03:42:55

Guerra2442 (281 views)
2015-12-25 03:27:21

theagentd (301 views)
2015-12-21 14:43:24
List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48 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!