Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (746)
Games in Android Showcase (226)
games submitted by our members
Games in WIP (827)
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 ... 43
1  Java Game APIs & Engines / Java 2D / Re: First time pixel artist on: 2018-01-16 10:46:02
Yup! In particular, I think the shadow of the cactus is off - is everything else fine?

To me, the building, person and bushes have the sun almost straight ahead; the cacti and two of the trees have the sun coming from the left; and one of the trees has the sun from 45 degrees (between left and ahead).  Everything with the shadow at 45 degrees might look better?

In fact, could you draw shadow and object separately?  Then you could play with different rotations / even move them during the game?
2  Java Game APIs & Engines / Java 2D / Re: First time pixel artist on: 2018-01-15 16:32:32
Looks great, particularly considering you've just started. Only one negative comment - decide where the sun is!  Wink
3  Discussions / General Discussions / Re: HappyNewYear! on: 2018-01-06 20:16:46
He sounds like a very interesting person. I'll try to find that book and give it a read. It's funny though, the reviews on Amazon are very extreme on both sides. This one is very negative:

https://www.amazon.co.uk/gp/aw/review/0753812770/RMJ0T732HD32T/ref=cm_cr_dp_mb_rvw_7?ie=UTF8&cursor=7

May be some good points in that, but they're not really who the book is aimed at, and it comes across as a bit of an arrogant rant from someone who's credentials are unknown and was still in junior school when this "game" was created.  For comparison take this NY Times article from 2002, and some of the people quoted in it (and I've seen various similar) - http://www.nytimes.com/2002/02/02/arts/man-who-would-be-god-giving-robots-life.html - eg.

Quote
The result dazzled both amateurs and experts. ''Very occasionally, somebody from outside academia comes along and shows us academics how to do something we've been working on for years,'' Rodney Brooks, director of the Artificial Intelligence Laboratory at the Massachusetts Institute of Technology, said of Creatures.

I have a soft spot for self-taught outsiders, particularly those who teach the establishment a thing or two - read of that what you will!  Grin
4  Discussions / General Discussions / Re: HappyNewYear! on: 2018-01-04 11:06:02
I'm probably the only one taking NetBeans editor into nightclubs, so it's a good niche!
Woah what? That sounds really interesting. Can you talk more about exactly what you do?

Mainly AMEN $ Mother Function (https://youtu.be/SgE9POc5BdA) - deconstructing a wavetable using a single live-coded Java pure-functional lambda (and demoing Praxis LIVE's ability to live code DSP).  Did this in various events, clubs, etc. last year, including an impromptu set at the JCrete BBQ - nothing like having Jaroslav Tulach bouncing around and proclaiming NetBeans to be "the loudest IDE in the world"!  Grin

There's also the cheesy shit techno I did in my JDD talk (in their promo vid - https://youtu.be/w7f9N-laVW0) to demonstrate functional reactive coding.  The FFT manipulated 3D spirals were partly live-coded earlier in the talk, and are Processing based.

@nsigma I hadn't heard about the Creatures games, what a great concept!

Yes!  Highly recommend the book he wrote about developing it - Creation: Life and How to Make It.  Just found this post from 2016 too which is interesting, and to quote "But all the computer power in the world is no help unless you know how to build a mind, and despite all the ridiculous hype surrounding AI at the moment, most people really don’t."  That kind of sums up my own feelings on the topic!  Smiley
5  Discussions / General Discussions / Re: HappyNewYear! on: 2018-01-02 18:02:55
I remember some jgo people were working on composing music using artificial intelligence, to react to fights by upping the musical intensity and so on. Have you ever tried that or thought about putting it together with praxis live?

Praxis LIVE might be an interesting environment to play with such things in that you get instant feedback, but I personally don't find a lot of the current creative artificial "intelligence" stuff that interesting, or intelligent!  Wink  I've heard the same phrase a few times this (last!) year - machine learning, yeah, we used to call it statistics.  I've made loads of self-generating/evolving things, but it's far more interesting when you throw a human into the mix, hence why I'm more concerned with exploring new ways of interacting with tech than the AI stuff per se.  The new coding interfaces stuff I'm working on, of which the music is a small part, stems from that.

The best use of A-Life / AI in computer "games" remains Creatures IMO.
6  Discussions / General Discussions / Re: HappyNewYear! on: 2018-01-02 11:29:58
Do you have any tips or suggestions?

haha, no!  At least none I'd be happy giving anyone else in case they blame me for it later!  Wink  I'm just in a lucky position at the moment that financial hardship isn't a concern for a year - though if it goes on much longer than that it might become one.  Mix that with feeling stuck in a rut work-wise, and the impending end of my thirties, and I'm generally in a mood of "feck it, let's have some fun"  If worst comes to worst, I'm fairly sure I can go back to what I was doing, suitably chastened, but with some good memories.

I imagine that having a date locked in to perform and speak in front of people is a (scary) motivator?

I used to perform a lot, so getting back into that isn't too scary - and I'm probably the only one taking NetBeans editor into nightclubs, so it's a good niche!  Workshops I enjoy, but on the other hand, talking in front of people scares the crap out of me.  Talking to 750+ Java developers at JDD was definitely a scary motivator!  Mind you a slight ignorance that I was a keynote speaker helped - conference intro "make sure you don't miss our keynote tomorrow at 9:30" - oh, that's when I'm talking .... oh my god, that's when I'm talking  Grin
7  Discussions / General Discussions / Re: HappyNewYear! on: 2018-01-01 19:14:53
2017 was fun!  Grin  My main resolution was to find a way to spend more time working on the things I love doing, which these days are open-source Java stuff like Praxis LIVE.  Having done non-Java-related web consultancy for the last 10 years I decided it was time for a change, sold off the stake in the company I was working in, and since June given myself a year to explore new things.  Amongst other things I've done a load of performances and workshops over Europe, went to JCrete (amazing!) and did my first Java conference keynote in Poland.

It's been a fun ride so far, and I'm looking forward to what 2018 throws up ... even if I'm still not quite sure yet where the next paycheck is going to come from in 6 months time!  Cool

Happy New Year everyone!
8  Java Game APIs & Engines / Java 2D / Re: How to have BufferedImages take up less RAM on: 2017-12-10 18:43:34
You're brave!  Grin  That's a very old document.  There's definitely code in the JDK source for GL to support non-power-of-two textures, it's even mentioned in that document.  I assume it's working?!  Undecided
9  Java Game APIs & Engines / Java 2D / Re: How to have BufferedImages take up less RAM on: 2017-12-10 18:02:55
Okay, you are right about that. But I don't know the dimensions of his game. It would reduce the BufferedImages drastically and he would only need to get dta from the tilesheet int[] and copy it to the main int[] (the one that is being drawn)

A BufferedImage is basically a thin wrapper over an array, usually an int[].  Doesn't really gain you anything, except the need to write a software renderer (which can be fun mind you, and faster than the software Java2D loops in some cases)
10  Java Game APIs & Engines / Java 2D / Re: How to have BufferedImages take up less RAM on: 2017-12-10 17:32:45
I'm sceptical that Java2D is using power-of-two surfaces, but either way I'd use a uniform size as it'll make things easier to deal with - 1024x1024 sounds like a good starting point.  Definitely fill unused bits with transparent pixels if the image has transparency - there's no difference in efficiency and no chance of getting any white pixels showing by accident.

This is what I would do.
-> load tilesheet into a BufferedImage and convert into to int[]
-> create a BufferedImage that will handle the drawings with, again, an int[]
-> with this way, you will have to create your own drawing methods, since all image data is handled through int[]

What for?!  For the purpose of ensuring there's no way at all any capabilities of the GPU are used?  Undecided
11  Java Game APIs & Engines / Java 2D / Re: How to have BufferedImages take up less RAM on: 2017-12-10 14:00:23
Also, would it be best to get the subImages when drawing each time (example two) or store them into BufferedImage objects and have them draw those without having to use the getSubImage() method any more times (example one)?

Neither! Don't create sub-images, use the variant of drawImage() that takes 8 arguments.
12  Game Development / Newbie & Debugging Questions / Re: Wrapping my head around Generics on: 2017-12-08 18:04:38
First; is there a way to enforce that the Class key and generic parameter in MonoCallback in the eventListeners map are the same?

Yes, in the way that you're doing it!  As long as you don't expose the Map so that only your registration methods can alter it, then you're achieving this.  You can't generify a value based on the key.

Second; when the callback is invoked, that the passed event parameter is ensured to be an instance of the proper Event subclass, not requiring instanceof checks and casting on the listener end? (SomeClass example)

Cast it on the dispatching side after you get it out of the map using Class.cast() with the key.  You may want to consider explicitly passing in the Class as a parameter for the push event method, or storing it in the event, rather than relying on getClass() - eg. gives you more flexibility with the class hierarchy later.

EDIT - by the way, what you're looking at is kind of a Typesafe Heterogeneous Container - https://gerardnico.com/wiki/code/design_pattern/typesafe_heterogeneous_container
13  Java Game APIs & Engines / Java 2D / Re: How to have BufferedImages take up less RAM on: 2017-12-08 11:47:49
There is no way around graphics taking up the amount of system RAM that they do. The best you can do is pack them all tightly into a single big BufferedImage and blit out chunks when you want.

My inclination is that a single BufferedImage might cause issues too?  I'd meet in the middle, create a series of BufferedImage with multiple images on (sprite sheets), trying to group images that are used together on the same image.  Maybe 1024x1024 (4MB) or 2048x2048 (16MB)?  You want to give the images used in the same frame the best chance of being managed and cached in hardware together.

I heard that VolatileImages are more efficient if you don't modify the image but draw them often

As @Abuse says, this is the opposite of the case.  You want a VolatileImage if you are modifying the image a lot.  If you don't use a Graphics2D obtained from calling image.getGraphics() much or at all, you don't need VolatileImage.  Where people often fall down is they assume that managed images mean the Graphics2D from a BufferedImage is hardware accelerated - it isn't!
14  Discussions / General Discussions / Re: would any of you guys be offended if on: 2017-12-01 22:53:41
Yeah but I remember that comic drawer that got shot because he portrayed Muhammad.

Yeah, that was kind of the point of my comment that kicked this off! Wink

I think the game idea is great, but people can get very touchy if they feel you're disrespecting their religion. There's fundamentalist nutcases in all of them! If you're not prepared for the possibility of a backlash, don't do it.
15  Game Development / Performance Tuning / Re: Java 9 GC on: 2017-12-01 08:46:48
Why not using adoptopenjdk.net instead?

Is Shenandoah in there? Website claims not but didn't find release notes quickly.

Thanks @Archive for the drive-by trolling!  Tongue
16  Game Development / Performance Tuning / Re: Java 9 GC on: 2017-11-30 16:49:35
@princec found an old launcher with this in it, which I think is similar/same as -incgc

1  
-J-XX:+UseConcMarkSweepGC -J-XX:+CMSIncrementalMode -J-XX:+CMSIncrementalPacing


However, it looks like while CMS is still there, they've also removed the incremental pacing flags.  Maybe just try the first argument?

We have apps in production capped to 512MB with SerialGC and pauses are indeed small enough that it's a good tradeoff.

That's a good point.  I've been using the SerialGC more recently.  If you can keep the heap from growing too much it's OK.  In Praxis LIVE I have the ability to split off pipelines into child VMs - I run audio in a separate VM with SerialGC and low heap size, but then I guess my "fps" is 10x what you need!  Wink
17  Discussions / General Discussions / Re: would any of you guys be offended if on: 2017-11-30 16:35:52
If you're going back to Noah you may as well bring in aspects of all the Abrahamic religions.  I look forward to the bonus level where you get to fight the prophet Muhammad.  Cartoons of Muhammad are a great way to get extra publicity!  Wink
18  Game Development / Performance Tuning / Re: Java 9 GC on: 2017-11-30 11:37:11
More good reasons to stick with the Java 8 LTS for a while!  Wink

Still, -Xincgc is kind of still there, if you can find documentation of what it actually translated to (got a note somewhere I'll see if I can dig out).  See https://docs.oracle.com/javase/9/gctuning/concurrent-mark-sweep-cms-collector.htm

I did read on the OpenJDK list a bunch of people (inc. Google and Red Hat people IIRC) talking about undeprecating and improving CMS - think Oracle are happy for that if they don't have to do anything.
19  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-16 21:18:42
For example you could share a String between annotations, which isn't possible in Java.

What makes you think you can't use String constants with annotations in Java?
20  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-16 11:04:24
a language shouldn't need a specific IDE to be adequately grokked (it's like there's a link between Kotlin and Intellij or something!  Grin )

I beg to differ. I started to look into building some small DSL with Kotlin, and I find it incredibly helpful to get that much assistance.

That noise was the point swishing past your head!  Wink  Yes, IDE's exist to make life easier, no doubt about that.

You never had, in the computer programming history, a brand new language with a first class IDE support.

a ha ha ha ha ... hubris ... Smalltalk comes to mind for a start, had this in the 70s!

... because Jetbrains has the whole pipeline under his hands: from the IDE to the language, that's really powerful and incredible if you think about it.

So does (did) Snoracle with Java!  But having other peoples' solutions around too is a healthy thing.
21  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-16 09:34:45
Man did I really not mention that virtual type rendering from the IDE? I should have.

@spasi did.  I personally like var / val, but I think you're missing the point others were making - a language shouldn't need a specific IDE to be adequately grokked (it's like there's a link between Kotlin and Intellij or something!  Grin )


Nice!  Does remind me of one thing I really dislike though - I hate removal of
new
22  Game Development / Newbie & Debugging Questions / Re: how to get artifacts built with Intellij IDEA to find included res directory? on: 2017-11-14 21:58:06
the path will resolve to the path where the JAR exists

Yes, but this bit is incorrect.  It will resolve to where you launch the JAR from (ie. if from terminal the pwd, not necessarily where the JAR is).  Add in the possibility of users setting up symlinks, etc. and relying on the relative path can be a bad idea.  See this old message with a bash launcher script that works around this issue (from the Linux / OSX NetBeans launcher) http://www.java-gaming.org/topics/cannot-run-a-program-by-clicking-on-its-icon-whereas-it-works-in-command-line/36811/msg/350522/view.html#msg350522


Or, as mentioned above, in your Java code you can use
1  
URL jarLocation = MyClass.class.getProtectionDomain().getCodeSource().getLocation();

see https://stackoverflow.com/questions/320542/how-to-get-the-path-of-a-running-jar-file
23  Game Development / Newbie & Debugging Questions / Re: how to get artifacts built with Intellij IDEA to find included res directory? on: 2017-11-14 09:22:02
You are passing a relative path to File so it's resolving that against the directory you're running the JAR from to get the absolute paths you posted.  This is what you're telling it to do!  What path are you expecting?

Using relative paths with a JAR is error prone unless you have a launching script (or use the getprotectiondomain().getcodesource().getlocation() workaround) - the path will be wherever you launch the JAR from, not the location of the JAR itself.

If you want to put the resources in the JAR you'll need to switch to getClass().getResource()
24  Game Development / Performance Tuning / Re: Simple way to show quickly-changing values on: 2017-11-13 17:33:17
One problem with the invokeLater() approach is you really want to coalesce all these values - there's no point in running a Runnable that's setting the text if you already have another Runnable on the queue.

An option might be to pass the strings into a concurrent queue, and drain it within your Runnable, only setting the last available String value (some Runnable will see an empty queue).

Another option, if you know the value is always changing, would be to poll from a Swing Timer.

If you have another thread you want to poll values from that are more complex (or just want to communicate with), it's also worth implementing an equivalent of invokeLater().  You can call with a Runnable that queries values and posts them back to the EDT.  Lock free and asynchronous ftw!

I'd stay away from invokeAndWait() unless you really need it - it's deadlock prone!  Notable that they didn't implement the same in JavaFX.
25  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-12 17:01:05
But I honestly don't get why people get excited about switching on types... since when is that considered good practice? OK, sucks when you have to do it without syntactic support, but if the support is there, it's a huge magnet for novice programmers writing shitty code. Much more so than local type inference.

Because structural pattern matching is great (and a bit more than just switching on types).  We've been fooled into thinking using the type system isn't good OOP, rather than the reality that it's currently error prone (compile-time safety isn't just syntactic support) and Java just isn't very good OOP!  Wink

- Now that @princec mentioned it, I would love to see a thread about Clojure and the practical pros and cons of using it. Also, any tips on how to get used to the alien syntax?

+1.  Now interestingly in the context of what I said above (Java not good OOP), I've been looking at the history of OOP a bit recently - I've read multiple people claim that Clojure is more in line with the original idea of OOP than Java is.  Grin
26  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-10 21:08:59
In Java, one would have to change the return type of the doSomething() method and return a wildcard type.

No, you wouldn't, you'd not create the wrong list in the first place (in your contrived example!).  Of course there are real-world examples where this feature is necessary, but they're thankfully quite rare, particularly with Streams, lambdas and better inference

eg. this works (peek is horrible, but so are side effects  Wink )

1  
2  
3  
List<SuperClass> doSomething() {
  return Stream.of(new SubClass()).peek(SubClass::subClassMethod).collect(toList());
}


Now, in the context of writing things like (reactive) stream APIs then this feature (JEP 300) would be great.
27  Discussions / General Discussions / FXGL (JavaFX Game Library) looks like it's coming along nicely on: 2017-11-10 19:42:33
I remember the author posting something a while back, but can't find any other mention of FXGL (pure JavaFX game library) on here?

Saw this video tweeted earlier -

<a href="http://www.youtube.com/v/N5cNqypBN4k?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/N5cNqypBN4k?version=3&amp;hl=en_US&amp;start=</a>

Not tried it, but the library is at https://github.com/AlmasB/FXGL
28  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-10 19:21:23
If you never had any issues with wildcards, then all the better xD I tried to say that there are cases where you need variant collections. ... May look like an artificial example for some

I didn't say I hadn't had issues with wildcards, or didn't understand the reasoning behind adding this (hey, I'm looking forward to JEP 300  Wink ) ... but that you were providing examples of doing things that are either not a problem to implement already or don't make sense to do (including your last example).
29  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-10 10:13:19
"Oracle is not Sun.  Oracle wouldn't have open-sourced Java."

I find that extremely easy to believe and it's part of the reason I don't like them.

I can dislike leisure-suit Larry and his yachts as much as the next person, but I'd rather have their blatant commercialism than Sun's token lip-service to open-source.  At least when Oracle does open-source it does it properly, even if it is in its own self interest (like the massive contribution to the Linux kernel, rather than Sun's licensing everything GPL incompatible so Linux can't "steal" it).  Java (and the JVM) feels in a far healthier position now than under the last few years of Sun.

And don't think that JetBrains' development of Kotlin is some sort of altruism - it's the same blatant commercialism to strengthen sales.
30  Game Development / Performance Tuning / Re: for loops on: 2017-11-10 09:56:46
There should be a good possibility the iterator is removed by escape analysis and so not be a GC concern.  Premature optimization is bad, relying on profiling to tell you what's happening can be worse - I refer you to this message from earlier this year where @spasi talks about this exact issue (and recommends JITWatch)

Of course, there's another option with collections these days -

1  
2  
3  
list.forEach(item -> {
  // do something with item
});


That uses an internal for loop.  Internal iteration has the potential to be faster than anything else.
Pages: [1] 2 3 ... 43
 
xxMrPHDxx (78 views)
2017-12-31 17:17:51

xxMrPHDxx (39 views)
2017-12-31 17:15:51

xxMrPHDxx (45 views)
2017-12-28 18:11:33

Ecumene (215 views)
2017-09-30 02:57:34

theagentd (313 views)
2017-09-26 18:23:31

cybrmynd (370 views)
2017-08-02 12:28:51

cybrmynd (401 views)
2017-08-02 12:19:43

cybrmynd (371 views)
2017-08-02 12:18:09

Sralse (336 views)
2017-07-25 17:13:48

Archive (1089 views)
2017-04-27 17:45:51
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org 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‑gaming.org
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!