Featured games (81)
games approved by the League of Dukes
Games in Showcase (488)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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 ... 29
1  Game Development / Newbie & Debugging Questions / Re: BufferedImage to Texture [solved] on: 2014-06-25 07:48:27
Or to get away from all the bit-swizzling in Java, you could try this -
2  Game Development / Performance Tuning / Re: Pixel Array Manipulation vs. Multiple DrawImage Calls on: 2014-04-07 08:51:22
Second, the two different methods serve different purposes: if you need to blit (draw) and image onto another (or the screen) drawImage is the way to go, and the fastest thing there is.

If you're blitting onto another BufferedImage then that statement isn't true. Direct pixel manipulation is at least as fast and often faster - it's exactly what the Graphics2D will be doing, but with less overhead. If you're rendering to the screen or VolatileImage then drawImage will be much faster. The answer to the question depends on where the images are being drawn to.
3  Discussions / General Discussions / Re: JDK 8 is released on: 2014-03-26 18:02:33
- LOTS of people use Java for advanced concurrency.
very, very few Java developer actually grasp advanced concurrency theory and behavior in the JVM.

Unfortunately those two statements aren't mutually exclusive!  persecutioncomplex
4  Discussions / General Discussions / Re: Scripting Language on: 2014-03-26 13:12:44
Most likely if you need scripting, java would be just fine.

+1, and if you need live compilation of user scripts, check out Janino

Or, alternatively, I've recently repackaged javac and the Janino bindings for that if it's of use to anyone - - more heavyweight than the Janino compiler, but I need some extra functionality.
5  Game Development / Performance Tuning / Re: Game is fast in eclipse yet slow on desktop on: 2014-03-24 12:17:24
The best way to deal with someone calling you an idiot is to show them how incredibly clever you are by way of counterattack  Kiss

vs Mark Twain

It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt.


@opiop65 I read the "idiot" comment as not meant seriously.  At least I hope so, with his username and avatar!  persecutioncomplex
6  Discussions / General Discussions / Re: JDK 8 is released on: 2014-03-24 10:15:48
What about planned obsolescence? I'm not a fan of Microsoft Windows XP but I consider that its user base is large enough to go on taking care of it.

Planned obsolescence?  Windows XP has been through enough extensions of planned obsolescence (eeek, people are selling NetBooks with Linux on it  Wink ).  It officially dies in two weeks - why would any company wish to support it beyond that?  It's not even like Java 8 will be the recommended consumer release in anywhere near that time.
7  Discussions / General Discussions / Re: JDK 8 is released on: 2014-03-23 20:39:06
invokedynamic is cool, rest is a bunch of fluff. Disclaimer: I haven't looked at any of it because I don't really care. Lambdas are neat but don't make a big difference for me.

hmmm .. a) isn't invokeDynamic actually from Java 7?  b) so I presume you've missed the link between lambdas and invokeDynamic and the significant performance gains therefore over earlier options (ie. inner classes)?
8  Game Development / Newbie & Debugging Questions / Re: Looking for 'professional' indie game-code to read. on: 2014-03-22 11:40:07
Not a lot of big indie developers tend to release code, especially if it as original game.

But luckily we have people like princec!  Grin
9  Games Center / WIP games, tools & toy projects / Re: audio dsp on: 2014-03-22 11:12:26
Are you suggesting that eventually using all those delicious CPU cores for fancy real-time audio processing will never really work and we'll be stuck in single-threaded land forever?  persecutioncomplex

I've read the "Time Waits for Nothing" article and wondered the same thing. It is difficult for me to understand how having one thread do the work of two is more performant than having the two threads that work in parallel but just occasionally have to synchronize.

I'm not saying that multi-core audio processing isn't doable, and there is obviously software already that does it.  I would say it shouldn't be done naively, lots of core library stuff in the JVM is probably unsuitable, and it requires a deep understanding of what's going on and whether it's worth it.  In particular don't assume that having multiple threads will instantly make things more performant than being single threaded considering the overheads of managing that.  Also don't assume that performance (throughput) is what matters most - the point of that article is that guaranteed execution time is essential.  eg. Praxis LIVE always runs with the incremental garbage collector, and a few people on here recommend it for stable video framerates as well as doing audio - this GC has less throughput.  We are basically trying to get close to real-time semantics (and AFAIK there is not much in the way of hard real-time stuff that supports multiple cores!).

Don't assume that sharing data between threads requires synchronization in the synchronized / blocking fashion either - there are various lock-free / wait-free ways of doing that too.

(3) but also making use of synchronized collections when interacting with the main audio thread: e.g., the collection that holds the Event schedule is a ConcurrentSkipListSet which allows me to add to it without danger of throwing a ConcurrentModificationException);

This collection is not synchronized in a typical Java sense - it is non-blocking.  I would question whether you need to order events within the same collection that handles cross-thread communication.  I'm generally in favour of a single access point to the audio thread using something like ConcurrentLinkedQueue<Runnable>

(4) making use of volatile variables for all "instruction" or "settings" changes to the various effects and synths;

Volatile is non-blocking but there are problems with using it like this (as opposed to passing in Runnables as above).  While non-blocking, they are a memory barrier which means caches may be flushed when hitting one, and certain optimizations regarding reordered instructions may not happen.  They also suffer from a lack of atomicity (you can't guarantee two instructions happen together), and they reduce some possibilities for optimization (eg. makes it harder to switch off elements off a processing graph that aren't required).  I wrote some more about this with regard to Praxis LIVE architecture here if you're interested.

One thing I'm interested in trying with the audio mixer: fork/join for the separate tracks.

This seems to be similar to the way some pro-audio software approaches this.  The important thing in parallelizing would be ensuring that the different cores do not rely on data from each other, so separate mixer tracks would be a logical way to do it.  You'd probably want to write a specialized fork/join mechanism that tracks the processing time required for each mixer track to try and spread them across available cores, and not have more threads than cores running.  You'd probably want to look at an efficient non-blocking communication model from the worker threads, and probably have the processing threads aware of time in the stream - thinking that if processing completes close to the time the next audio buffer is available you'd want to spin-lock rather than let the thread be descheduled.

@erikd - apologies if this is diverting your (forum) thread somewhat.   persecutioncomplex  With specific regard to this project, I'd recommend sticking with what I said earlier about running everything off of the primary callback thread.  If you get to look at running multiple DSP graphs at once (ie. without dependencies except on final mix) then splitting on to worker threads might be worth it.  Be aware of one JVM specific issue though, which is probably a consideration with ASIO (it is definitely the case with JACK), in that the callback thread into the VM has priority settings that are not possible to achieve from within Java without resorting to JNI.  It would be important that any worker threads also gain those priority settings - I haven't tried creating a Thread from the callback yet to see if the settings get inherited.
10  Games Center / WIP games, tools & toy projects / Re: audio dsp on: 2014-03-21 14:21:18
Then there is a thread that updates the Context. This was fine for blocking I/O such as javax.sound, but with Asio this needs to be synchronized with Asio's thread.

Yes, don't do this!  Run everything off the callback thread.  It's possible to wrap a blocking API to provide a callback API.  It's not possible to do the opposite without adding overhead, and potential threading issues.  You'd be better building a callback system on top of JavaSound.  Feel free to have a look at this code which does just that, and has a few other tricks to improve performance (timing loop, etc.)

On the other hand, it works fine as it is now so I'm not exactly in a hurry there Smiley

At low CPU usage you might get away with it, but it will eventually bite you!  Wink
11  Games Center / WIP games, tools & toy projects / Re: audio dsp on: 2014-03-21 11:02:32
I have experimented with band-limiting the oscillators, but I've obviously been on the wrong track there.
The oscillators use pre-calculated wave-forms, and what I did was simply pre-filtering them. Sure it helps with aliasing at higher frequencies, but of course it also made it all sound quite dull.

The problem with doing that is that you'd need multiple wave-forms (possibly one per octave), otherwise when you pitch the table up you'll bring in aliasing, but when you pitch down you're missing more and more of the harmonics that give the sound its richness.

I think the best solution there is to do real-time oversampling of the oscillators instead.
It might be a bit more expensive, but then again I haven't gone beyond ~2% CPU load of a single core yet (and that is while the CPU was running at about half speed), so I probably shouldn't worry too much about performance yet.

Oversampling and filtering is definitely an approach among many.  As well as the BLEP approach @BurntPizza mentioned, I've been wondering about BLIT (band-limited impulse train).  I know those approaches are related in some way, but not sure of the pros and cons of each.  What I do know is that The Synthesis Toolkit has implementations of a BLIT Saw and Square wave algorithm in C++, which shouldn't be too hard to port.  There is also some related code within the Music DSP archiveThis article (using Reactor) seems one of the easiest to understand the approach - it's not exactly in my comfort zone!  Grin

I've also seen a few posts suggesting that suitably optimized real-time generation of waveforms might beat wavetables, again on the basis of cache misses - not sure how that pans out in practice.

I'm using JAsioHost on Windows because unfortunately javax.sound has way too much latency there. Asio uses a pull-mechanism rather than blocking I/O, so it was a little bit more tricky to properly synchronize things

I'm intrigued by why you find a callback API trickier than a blocking one?  Also slightly concerned what you're meaning by "synchronize" things - I'm assuming not in the sense of locks!  Either way, one article I'd highly recommend reading around low-latency audio programming is  He's written a few other interesting articles around communication with real-time audio that might be worth a read too.
12  Game Development / Newbie & Debugging Questions / Re: Game development with Swing: Using threads. on: 2014-03-17 14:25:15
Active rendering in Swing is where you run the EDT at 60Hz.

That's not what's usually meant by active rendering.  I've yet to see a tutorial, including Oracle's (well Sun's!  Wink ) own on this, that talks about doing it in the EDT, and the same for the BufferStrategy JavaDoc.  I'd also be highly suspect about what the OP means by "Swing".  Are we talking actual UI components, or just drawing on a big canvas?

Usually I'd recommend ignoring the Swing stuff, and use a Frame and a Canvas from the awt package.  Create a BufferStrategy from the Canvas, and directly draw into that from your rendering loop, outside the EDT.  You can also get a BufferStrategy direct from the Frame / Window, but I prefer the flexibility of using Canvas.  It's also best to set to ignore repaint requests (setIgnoreRepaint()) to avoid any possible conflict with the EDT, and beware of any events fired by the window, etc. which will still be in the EDT.
13  Game Development / Newbie & Debugging Questions / Re: What excactly is a FloatBuffer? on: 2014-03-17 13:39:32
Try reading the JavaDoc, it's what it's there for!  Wink

Essentially, a direct buffer exists (or behaves as such) outside the main Java memory heap, and in a consistent memory location.  This makes it possible for native code to read/write to the buffer without extra copying overhead.  (There are ways of pinning array memory for native calls (JNA does this) but it's much more limiting).
14  Games Center / WIP games, tools & toy projects / Re: audio dsp on: 2014-03-17 11:02:34
I do plan to redo the wavetable synth sources to eliminate the aliasing

That reminds me of a question I was going to ask erikd -

Are the oscillators you currently have just sin waves, or have you implemented square, saw, etc?  If so, are they band-limited?  I was having a look a while back at (fast) options for generating band-limited oscillators, either real-time or table lookup - lots of algorithms around though haven't found anything in Java, or yet had the chance to try porting something.  That might be some code that would be useful to share thoughts on around here?
15  Games Center / WIP games, tools & toy projects / Re: audio dsp on: 2014-03-14 17:12:09
Stop it!  You're making me dither again.  Wink

Seriously, there were not major arguments for me either way, and I ended up actually going for what the majority of people were doing as much as anything else.

Hm good point about memory usage, I haven't considered that yet. But what sort of memory usage are we talking about here that made you go back to float?

Partly as I said around sample banks, etc.  If you're using a range of samples stored in memory, ideally you want them loaded up and ready to play instantly (ie. probably in the data format of your pipeline).  Doubling the memory overhead here can be a problem.

Other than that, and something I'm less sure of the issues around, would be processor memory throughput / caching.  I'm not sure what I read at the time, nothing I can remember being that conclusive an argument, but things like this (which I just found)

My consideration for using doubles is not necessarily for sound quality, but sometimes you need doubles in algorithms where high precision does make an audible difference (for example when there's a lot of feedback involved).

I think I know what you're getting at, though it sounds slightly like two opposing things.  I found the CSound reference I referred to (somewhat incorrectly I realise) earlier -  The audio accuracy arguments should be correct, though the performance assertions are probably irrelevant.  Be interesting to benchmark a few of your algorithms at both precisions, though a full pipeline is probably more accurate (from a caching, etc. point of view).
16  Games Center / WIP games, tools & toy projects / Re: audio dsp on: 2014-03-14 14:18:38
One basic thing is that currently all signals are floats, but I'm considering making it all double. I think it shouldn't negatively impact performance on a 64bit system, and in fact it might even improve since I already use doubles in various places where precision is important so there's already quite some casting going on.

LOL  Grin I actually went the other way, and switched the pipeline from double to float, though I also use doubles in places where precision is important.  Performance should be practically the same - AFAIK it doesn't actually make a difference to the FPU(?)  However, the thing that swung me was memory usage, particularly because of using things like in-memory sample buffers.  Also the IO that offers floating-point is likely to be 32-bit I think (not sure on ASIO).

I remember reading somewhere (think CSound docs) that around 6 chained DSP operations can lead to audible differences between 32bit and 64bit signal paths, though depending on the algorithm the number of operations might be higher.  To me it justifies double precision where necessary, but not necessarily double precision throughout.

RasmusDSP (an old project by the author of Gervill in the JRE), is the only Java audio project I'm aware of that uses doubles throughout.
17  Games Center / WIP games, tools & toy projects / Re: audio dsp on: 2014-03-14 11:31:54
Well, funnily enough, I love these sort of environments.   Wink

Be interested if you do open this up - there may be some potential for code sharing here.

Also, if you're interested, take a look at the JAudioLibs AudioServers project.  I've just had a code contribution to review with a direct ASIO backend, but this would also give you access to JACK - low latency audio and inter-application routing on Windows, Linux and OSX.  This would for example allow you to route any other ASIO program through your DSP environment.
18  Discussions / General Discussions / Re: SteamOS, SteamMachines, Steam Controller on: 2013-12-16 14:38:52
There is lots of needless stuff, that obviously is not allowed to be removed.

If you use OpenJDK you can remove whatever the hell you want!  Wink

Mind you, I'm with kappa and princec in that it's probably not worth the effort.
19  Game Development / Newbie & Debugging Questions / Re: My Game have creative commons Resources ( images/audio) ,Can i still sell it? on: 2013-11-26 18:48:37
The right to de-compile the code is equivalent to granting a right to access source code.

That's just so wrong!  OT - love to see you try and use that excuse in a GPL violation case.  Grin

You do realize that as a creator of an engine you have the right to forbid such things as many pieces of software does.

That seriously depends on what jurisdiction you're under, for private use at least.  It's not actually relevant to my argument ...

The problem is that the notion is being put forth that you forfeit those rights when you use CC assets and it's not backed up by anything I've seen from the CC license or anybody connected to it.

A "game" as a whole is a derivative work of the asset - that is explicitly mentioned on the CC wiki.  The CC-BY-SA license protects your right to freely distribute and modify the derivative work as a whole, hence that includes fiddling with any compiled code that is distributed.  It does not include the right to access or modify the source code if that is not shared with you, hence my position above.

Asset is to game engine what data set is to database engine.

Aside from the obvious failure in that analogy that data sets are often not subject to copyright due to lack of creativity (facts cannot be copyrighted), there is some support for your position on the wiki page linked to.  It's generally down to where the derivative / adaptation line is drawn between code and data.  If the code is only designed to work with the assets, ie. has hard links to the assets, then the whole is probably covered, particularly if the code creatively manipulates the assets.  If you have a generic game engine, that can work with any assets / scripts, then it is possible that the CC license only covers all the specific assets and scripts that make that specific game work.  This is all a seemingly grey area, and one that the CC people seem to be looking to elucidate better.
20  Game Development / Newbie & Debugging Questions / Re: My Game have creative commons Resources ( images/audio) ,Can i still sell it? on: 2013-11-26 00:38:36
@CodeHead Danny02 is right, nothing I've said has claimed "must open source", this is all about the end product - that which is shared.

And the argument that a game is a collection is both ridiculous (might as well say a music track is a collection of samples), and rebutted on the CC wiki.
21  Game Development / Newbie & Debugging Questions / Re: My Game have creative commons Resources ( images/audio) ,Can i still sell it? on: 2013-11-25 21:34:35
You're completely misunderstanding what I'm saying.

As I said earlier, there is no agreement that I'm aware of between the organizations behind CC and the GPL that says you can only consider data and application as two separate entities as long as you're using a GPL license on the software or as long as the software is given away for free.

There is nothing that says you can treat them as completely separate entities.

The requirement that the software be "free" isn't by requirement of the CC.

I said that earlier!

You miss the point that the source and assets live under different licenses at that point no matter if ID owns it all or not, demonstrating that the two are separate entities, not a monolithic whole.

That doesn't support that position at all because as the copyright holder I could release my own work under multiple licenses.  The copyright holder is not bound by any restrictions in the license, just the people the work is distributed to.

It's not a limited separation, it's a complete separation.

Completely disagree, but I guess I'm not going to convince you!  Grin  At some point maybe you'll find a link that actually supports that position.

Can you show me anywhere that CC claims their licenses apply whatsoever to code that use the assets as opposed to the assets themselves?

The CC code applies to the derivative work - you have yet to point to anything that proves that the code is not part of that derivative work.

If the license doesn't mention source or object code, how then do you arrive at the conclusion that it suddenly extends to it?

Again, you're repeating things I've said to try and back up your own argument.  Software licenses specifically mention the distinction between source and object code because without them they don't (easily) allow modification of compiled code.  CC licenses don't, which means the share-alike applies to the distributed bundle as a whole.  In this case, that means the compiled object code.
22  Game Development / Newbie & Debugging Questions / Re: My Game have creative commons Resources ( images/audio) ,Can i still sell it? on: 2013-11-25 18:21:33
The point to be taken away from the statement is more that the assets and code can be under separate licences thereby allowing the code to remain closed source while letting the CC's resources remain open and available to anyone.

How the hell you get to that conclusion from that statement from GNU about free software I have no idea?!  It specifically talks about assets being shipped with a free game engine not having to be under the same license, as long as they are made available in a way that allows free copying and distribution.  The ID software argument is also bogus in that they owned the copyright on all the material, so could do whatever they wanted.

This argument has nothing to do with GNU software licenses, it is to do with CC asset licenses.  Just because GNU see a (limited) separation between code and assets, do not assume it works in reverse.  Please refer me to any link that suggests that the conditions of the CC-BY-SA asset license do not cover all derivative work, including the compiled code, as per my previous post.

If my game have a folder called resources and i made that folder avaiable to change.. And distribute it. And the source code, i would obfuscate and sell it and make with another license......
Is that what i should do?

No, if you think that putting them as two separate folders stops you from having to follow the license.  Just having things split up doesn't take away your need to follow the license, particularly if your code only works with those assets.  In that case it would be hard to justify that they're distinct works.  Show some respect to the original author's wishes, stop trying to fudge some dubious legal workaround, and ask whether they're happy with what you want to do .. it'd be quicker than arguing on this thread, unless they've already said no, in which case, tough!  Wink
23  Game Development / Newbie & Debugging Questions / Re: My Game have creative commons Resources ( images/audio) ,Can i still sell it? on: 2013-11-25 11:55:27
Except that even doesn't make things clear.

No kidding!   Grin

the Free Software Foundation has clarified that the game code and game media are separate entities and do not need to be released under the same license, provided those licenses allow you to copy and redistribute the work for both commercial and non-commercial purposes.

That bit's important, but also the problem in reverse.  That's about what assets you can distribute with GPL code, and note that this basically amounts to making sure that the assets can always be distributed with the code.

The OP's question is however the opposite.  He's not looking to distribute GPL code, he's looking to distribute CC-BY-SA assets.  Therefore the question is what code license satisfies the CC-BY-SA conditions?

Creative Commons Attribution-Share Alike 3.0
This license requires you to release the source your entire project under the same license or one with similar terms, such as the GNU GPL.

That statement is not backed up by the license at all.  CC licenses are not designed for code, and specifically don't make a distinction between source and compiled code.  Therefore, you can almost certainly distribute only the compiled code.  However, you would also need to satisfy the share-alike portion of the license, which means that anyone you distribute the game to would be allowed to distribute it further and/or decompile and modify it, as long as they retained attribution and shared it in a like manner.

The OP's question is fundamentally flawed.

Can you sell CC-BY-SA (or GPL) projects? Yes.
Can you stop other people selling or giving away your CC-BY-SA (or GPL) projects? No.

IANAL - blah blah blah.

I agree with the point made by a number of people in this thread.  Respect the copyright holder, don't try and find loopholes around their wishes, and if in doubt, ask them.  There's a good chance they'll be fine with it!  Wink
24  Game Development / Newbie & Debugging Questions / Re: My Game have creative commons Resources ( images/audio) ,Can i still sell it? on: 2013-11-24 09:51:51
i just want to show some people that making games isnt just Fun ... Theres work needed and it does generate money.

Funnily enough, music and graphics take work too. The artist has decided the "cost" you must pay is to follow the licence. If something you wanted cost hundreds of dollars would you just steal it?

Seriously, I find it pathetic that you value your time and effort more highly than that of others. If the assets are that good, they're worth it. And if they're not, find something else!  Wink

25  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LWJGL 3 - Wiki and a progress update on: 2013-11-19 15:01:30
libffi ... is there for users that would like to call native functions for which LWJGL does not provide bindings out of the box. So it is indeed meant to be optional/advanced functionality. If static linking causes trouble, it can easily be refactored to dynamic linking.

OK, thanks for the info.  I'll do some testing when there's an alpha build.

If it's purely meant for optional / advanced functionality, are there advantages to doing this above suggesting JNA?
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LWJGL 3 - Wiki and a progress update on: 2013-11-19 13:50:09

Is this purely an optional binding, or is LWJGL shipping with / dependent on libffi?  If the latter (excuse my lack of understanding of linking!) then is this done in a way that wouldn't conflict with other loaded versions of libffi?  Thinking particularly that I know various applications (my own included) that use LWJGL and JNA.
27  Game Development / Newbie & Debugging Questions / Re: Differences in extends JComponent, JFrame, JPanel, & Canvas (mega noob question) on: 2013-11-18 11:56:55
JComponent/JFrame/JPanel are part of the Swing gui system, which is newer than AWT, the old gui system

Swing is built on top of AWT!

Canvas is a special AWT component that has some support for double buffering.

More important feature of Canvas is that you can get a BufferStrategy from it and therefore use it for active rendering.
28  Game Development / Newbie & Debugging Questions / Re: Open License on: 2013-11-13 20:02:17
I've used GNU All-Permissive, such as in the JAudioLibs AudioServer API.

* Copyright 2013 <YOUR NAME>
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
* notice and this notice are preserved. This file is offered as-is,
* without any warranty.

29  Discussions / General Discussions / Re: Java's built in Scripting engine on: 2013-11-13 14:13:35
Another thing, why is it an issue for you if your user breaks his own program by making an infinite loop?

Simply that it isn't very user friendly!  Praxis LIVE is a graphical patcher / dataflow environment where you can add fragments of code (Java, GLSL, etc.) to the processing graph at runtime.  The idea is that you can incrementally change and back out code as it runs.  Entering an infinite loop would completely stall the media pipeline, forcing a restart and losing some changes.  If someone writes a while(true) loop without thinking, they get what they deserve - as you implied, some infinite loops are more subtle.

I may consider a protected environment, probably as Roquen suggests using AST manipulation rather than byte-code manipulation, if I can get it to run without losing too much performance.  It's not a high-priority though.

Janino is slowly adopting more recent java language specs

Slowly is unfortunately the word though. 

Great, I didn't know that Janino had security features. I tried searching about it and found this:, java.lang.Class[])

In the current sources I was playing with yesterday this is marked deprecated, and is also a no-op.  JavaDoc comment says "Auxiliary classes never really worked... don't use them."  Wink
30  Discussions / General Discussions / Re: Java's built in Scripting engine on: 2013-11-13 11:13:34
Sounds like a cool piece of software you built.

Thanks!  Grin

It made me think of the eclipse IDE on the floy compiler, would it also be another way of doing what you want?

Possibly, except for a (*&%£* license incompatibility.

I'm not sure I could achieve quite what I want without the boilerplate that Janino provides anyway.

I want to run code on my server that the client submits, so I'd like a way to restrict what they can do. I ws reading about SecurityManagers but they seem to restrict the whole JVM. I'll have to look into Roquen's suggestion of using ClassLoaders.

Ah, I see you like playing with fire!  Wink

The Janino ClassLoader already has the ability to provide a ProtectionDomain for classes compiled through it.  That would appear to be the way to do this, but I've never tried.

About the problem of infinite loops, I was reading a while back that it can be mathematically/logically impossible to tell if a program will ever stop. But I guess by having a timer you could just terminate a thread that ran for too long.

Exactly.  The timer issue is that you then need a second monitoring thread, which potentially brings in thread switching issues - in particular one thing I'm looking at doing at the moment is live coding audio DSP.  Extra threads could be an issue there.

The bigger thing is what to do with a thread stuck in a loop.  Call stop() on it?  That would have to be very carefully thought out if anything's shared.  Would have thought that would be even worse for you - could have more serious effects on a server!
Pages: [1] 2 3 ... 29

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

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

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

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

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

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

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

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

BurntPizza (36 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08 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!