Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
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 ... 19
1  Game Development / Newbie & Debugging Questions / Re: Which is the "better" practice on: 2014-12-27 00:50:23
Good habits like:  Never try to solve potential future problems which cannot exist.

I'm a big fan of the idea that premature optimization is the root of all evil. But this isn't like implementing your own custom parallel sorting algorithm to sort a collection of 10 Strings. This is a pretty low-cost-now solution that *will* save you a ton of headaches in the future.

Different strokes for different folks, and different problems require different solutions, but the OP asked if there was a better practice than misusing statics to give lazy access to class members. There is a better practice: don't misuse the static keyword to give lazy access to class members.
2  Game Development / Game Play & Game Design / Re: Does this work on: 2014-12-26 21:20:03
You also might want the source of the blood to come from, well, the source of the blood. Currently it looks like it's coming from the bottom of the sprite, so it's just bleeding from its foot?
3  Game Development / Newbie & Debugging Questions / Re: Which is the "better" practice on: 2014-12-26 19:05:14
assuming you have access to and control of all the impacted source code, the the refactoring will be trivial regardless of the project scale.

I respectfully disagree with this.

I work with a lot of code that was written by people with assumptions similar to those in this thread. My job has been, on multiple occasions, to take an application that was originally written as a singleton and modify it to work as a non-singleton.

These applications have been written by many people over many years, all using code that misuses static references under the assumption that they'll never need to be non-static. Refactoring them is not trivial.

Step one to avoiding these kinds of situations is to encourage people like the OP to get into good habits from the outset.
4  Game Development / Newbie & Debugging Questions / Re: Which is the "better" practice on: 2014-12-26 18:44:17
Exactly... Whatever you do, it should be trivial to refactor, so who cares?

Another problem I have with this misuse of static is that it sets a bad precedent and encourages pretty bad designs overall.

Sure, it's trivial to refactor a little hobby game. It's also easier to make assumptions about your context.

But what happens when you get into bigger projects and bring this style of coding with you? Next time you need access to a class member and say "well, I'll just make it static, it doesn't look like I need multiple instances anyway", then fast forward 5 years just to find out that WHOOPS, you do need multiple instances after all. Now the refactoring is no longer trivial, and welcome to headache-land.
5  Game Development / Newbie & Debugging Questions / Re: Which is the "better" practice on: 2014-12-26 18:17:34
The correct answer is the easiest for you to read, write and maintain.  Everything else is someone else's wishful thinking.

I don't disagree, but the crux here is the "maintain" part. These static approaches are NOT easy to maintain.

What happens when your design changes and you need to have multiple instances of these classes around? And I know the reaction is "but I know I'll never need that", but no, you don't.

This is a misuse of the static keyword, in an attempt at making it "easier" to get at the members of a class. This is going to come back to bite you eventually.

Use OOP the way it was intended, and just pass around an instance when you need it. It might feel like "more work" in the short term, but it will definitely save you (or anybody else who has to deal with your code) a ton of time and headaches in the future.
6  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-26 17:33:06
You haven't really posted a lot of info about what you're doing with JWrapper, so it's really hard to help you.

You might want to post a zip file of your example directory, JWrapper XML file, etc. That way we can try it out.

You also might want to post on the JWrapper forums. They've been pretty helpful for me in the past.
7  Discussions / General Discussions / Re: I no longer use Google Play and I block ads on: 2014-12-26 17:30:29
I may get some flak for this opinion, but;
Who cares they're tracking you? I mean seriously? Does it really matter? Aside from the "Evil" targeted advertising where they show products I might actually be interested in, I don't see the problem. Wink

As for ads in general, my opinion is simply if a content provider decides to put ads on their site, we as the user have absolutely no right what so ever for any reason period to block them. If we don't like them, tough. Show them your lack of support by not using their service/product.

The internet isn't free. Blocking ads is the same as piracy, you're getting content and no one is paying for it. So if you don't like the content enough to put up with their price (the ads) then don't use it.

I agree with most of this, or at least the sentiment of it.

I get that I *should* care about how I'm being tracked. I understand the concerns with privacy and the ability to opt out (or opt in). I understand the need for more transparency with who is tracking what, why, what kind of data, etc.

However, I also can't really take seriously the people yelling "facebook is selling our personal information to private companies!" because, uh, they don't understand how advertising works. (Note: I am not a facebook expert and maybe facebook is indeed doing nefarious things, but it ain't the things most people are complaining about.)

I also don't use ad block, mostly for the reasons you outlined- if I'm getting something out of using a site, the least I can do is allow their ads. I also stand by the inverse: if a site has intrusive ads or click-bait tactics, I refuse to use that site.

But I also look forward to a future where we have all of this figured out: maybe there is an alternative to the ad-based model. Maybe as costs go down and the number of people on the internet go up, the relationship between creators and viewers will mature. Or maybe not, and the vast majority of internet uses will stay in the walled gardens of facebook, google, etc. I don't know- but I'm curious to see where it all goes.
8  Game Development / Newbie & Debugging Questions / Re: How to properly distribute a LWJGL application without JarSplice on: 2014-12-26 17:13:04
I guess, for now i start to learn the java path stuff when i've got time, and eventually when i have time do some work on the rest, try out your suggestions Smiley

Yeah, exactly. Step on is understanding what the java.library.path argument is doing. Any other solutions are going to set this argument somehow, so it's the most basic building block of any more complicated solution, even one you write yourself.

Well i wanted to structure my final game the way i wanted

That's understandable. I don't really remember how JarSplice organizes its natives, but I can tell you how JarMatey organizes its natives:

First, the output jar contains a directory called JarMateyNatives.
Inside that directory, you can put directories for any OS you want to include natives for: Windows, Mac, Linux, for example.
Then inside those directories, you can put native files for those specific operating systems. You'd put dll files in your Windows directory, etc.
You can also put subdirectories for specific architectures inside the OS directories: Windows/amd64, for example.
Then inside those subdirectories, you can put native files for those specific OS/architecture combos.

When JarMatey runs, it detects what kind of system it's on, then extracts the native files from the corresponding directories. They are extracted to a temporary directory, and the java.library.path is set to that temp directory. Then when the program closes, that temporary directory is deleted.

You can also include external resource files in JarMatey if you want, and the process is pretty much the same: JarMatey extracts these files to a temporary directory, then sets the "current directory" to that directory, so any code you write can assume those files or folders are next to the jar.

You can use whatever organization you want for the external files.

Anyway, I'm not trying to "sell you" on JarMatey, just using it as an example for how things might work.
9  Game Development / Newbie & Debugging Questions / Re: How to properly distribute a LWJGL application without JarSplice on: 2014-12-26 17:03:34
You've never seen games package libraries outside of the executable?

Again, I really don't want to bicker- but the examples you've shown are of *installation directories*, which is an option I already brought up, using JWrapper.

What I *don't* see is a game that consists of a single executable (not installable) file that requires a data directory next to that executable. That's too easy for users to mess up, so even though it would be easy for a developer to implement, it's not something that many "real" games do.

The examples you've shown of an installation directory aren't really what I'm talking about. That's certainly another option, but it involves using something like JWrapper to create an installer.

Sorry if I should have been more clear, but I think we're talking about two different things at this point.
10  Game Development / Newbie & Debugging Questions / Re: How to properly distribute a LWJGL application without JarSplice on: 2014-12-24 20:20:07
Almost every game with libraries ever has them in a folder next to the application; There is no "problem" with it :x.

I'm not trying to argue, but I've never seen that. Then again, most "real" games are bundled up as a platform-specific executable, not as a jar.

Your approach will certainly work. It just depends on how simple you want to make it for the users. Easier for you = harder for the users. Easier for the users = harder for you. It's a trade-off. I generally go the "hard for me, easy for users" approach, but your way certainly works too.
11  Game Development / Newbie & Debugging Questions / Re: How to properly distribute a LWJGL application without JarSplice on: 2014-12-24 19:59:19
The problem with that approach is that your user then needs to keep the natives directory next to the jar.

The wrapper applications we've been talking about keep the files inside the jar and then extract them to a temporary directory when the jar runs.

It all depends on your context and who your users are. It's usually a good idea to assume most users are lazy and computer illiterate though, haha.
12  Game Development / Newbie & Debugging Questions / Re: How to properly distribute a LWJGL application without JarSplice on: 2014-12-24 19:27:22
But i though that the application only has to know about the natives delivered with LWJGL in the natives folder?

I'm still not totally sure what that means. If your application uses native libraries, you have to tell Java about the natives for your system- how are you running your program on your machine? If you're running it from eclipse, you have to tell it about the natives by attaching the native library to the jar. If you're running from the command line, you have to set -Djava.library.path command line option.

The user of your game has to do the same thing- but that can be pretty annoying for an end-user. That's why we use a wrapper like JarSplice or JarMatey to do it for them.

To reformulate my 'question', what do i have to learn, to understand the process of exporting and 'hook up' the needed references (LWJGL jars/) and natives,
in order to have the game running on a certain OS. (Either in EXE/DMG etc.)

First: understand the above, the java.library.path stuff. Try running a LWJGL application via the command line.

Second: Putting together a platform-specific executable can be pretty annoying. If that's really the route you want to go, you'd have to google "how to create a Windows executable", "how to create a mac app", "how to create a runnable file on linux", etc. I don't think it's very complicated, it's just annoying to have to handle yourself.

Furthermore, do you see any advantage of putting the natives (Windows/Linux/OSX) together in one app? I though i was better of including the right natives for a certain 'port'.

I'd personally put them all in one self-extracting jar using JarMatey. The benefit to this is that I only need to worry about sending people one file- no worrying about making sure I give them the right version. The only downside is that the download size might be a little bigger, but that's really not a concern to most people.

To put it this way, i guess i 'want' to know how your program(and JarSplice) put these projects together.

All of my source is available on GitHub:

But basically, all I'm really doing is detecting what type of system we're running on, extracting the correct natives, then running the application with the -Djava.library.path set using a ProcessBuilder.

Also with JarSplice etc. i dont know how to order folders in any way... which is a real problem for me!

I'm not really sure what that means either. Why do you need to order the folders?

I do NOT, like the fact that a little program puts my project together, and if it works, it just works..., i prefer knowing whats up Smiley

That's understandable. If you want to dive into my code a little deeper, the "meat and potatoes" of what I'm doing is here:

That's the "launcher" class that runs when the exported jar is run on the user's computer. It extracts the correct natives and then runs the real program after setting the native library path. That's what JarSplice is doing too.

Also, it's worth noting that JOGL and libGDX both have these kinds of "self-extracting" mechanisms in place.

Edit: Nice website, a lot of info on there Smiley

13  Discussions / General Discussions / Re: I no longer use Google Play and I block ads on: 2014-12-24 16:47:54
I don't say that it's a simple problem to solve.

Exactly. You're proposing that we change how every single person uses the internet. That would definitely be nice, but it ain't gonna happen. Might as well try to make the best of a bad situation?

The success of Adblock (especially Trueblock and later Adblock Edge) shows that lots of people don't want to see ads.

Okay, but the percentage of people on the internet using adblock is very small. Especially compared to the percentage of people on the internet who use sites like buzzfeed where the entire site is basically one big advertisement.

How do you get the vast majority of internet uses (who don't mind ads) to switch over to a pay-for-content system?

Moreover, some ads are used to track people, it gives me another reason to refuse them all.

Yes that's creepy, but how should ads become more relevant without knowing anything about the people they're advertising to?
14  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-24 16:43:36
Simply through the command line. I'll have a look.

In that case, you're just looking for the -source and -target options. See this for more info:

How small can I make the JRE?

You might also check out JWrapper:

JWrapper gets the JRE down to 7MB, and it also includes an option to only download a JRE if the user doesn't already have the correct version.
15  Game Development / Newbie & Debugging Questions / Re: How to properly distribute a LWJGL application without JarSplice on: 2014-12-24 16:41:03
I'm not really sure what you're asking. What specific problem are you having? But I'll try to give you more details:

The most difficult part about LWJGL deployment is that it requires native libraries. These native libraries give LWJGL access to your hardware, such as your graphics card, for OpenGL. That's what makes it so awesome.

The problem is that you have to tell Java where those native libraries are located. You *can* do this as a command line argument, but no users want to run games via the command line.

Tools like JarSplice do that for you: they wrap your LWJGL program in another program that tells Java where the native libraries are located, then runs your LWJGL program. There really isn't a lot of "magic" involved.

I've written an open-source program similar to JarSplice (but with other features for Processing developers) called JarMatey available here:

You could also use something like JWrapper to create a packaged executable, but the idea is the same.
16  Discussions / General Discussions / Re: I no longer use Google Play and I block ads on: 2014-12-24 14:30:30
Personally, I want no ad.
In my humble opinion, there is no acceptable ad.

Then what's the alternative? Having everybody pay for content?

I write tutorials and post them on my site, and I put up ads to hopefully eventually make some money from them- or at least cover the cost of hosting. My target audience are mostly teenagers who don't have credit cards, and certainly don't want to pay for content. But they don't mind a couple banner ads here and there.

What do I do as a creator? I'm not trying to bicker, I honestly want to know what the better solution is.

The truth is, most people would rather see ads than pay. There is a point where the ads become too much and people would rather just not use the site at all, but sites like buzzfeed prove that the threshold for most people is pretty high.
17  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-24 14:26:08
What version of Java are you using? What version of Java are your friends using?

You can set the Java compiler to output code that's compatible with older versions of Java. How you do this depends on how you're compiling your code.

Google "java compiler compliance level" for more info.
18  Discussions / General Discussions / Re: Bring back 1HGJ? on: 2014-12-23 18:52:47
Also don't forget that the Global Game Jam starts in exactly a month. You can get your game jam fix from that.
19  Discussions / General Discussions / Re: Bring back 1HGJ? on: 2014-12-23 18:47:06
Very well said my friend. But it is a great learning experience.

I can agree that game jams can be a great learning experience. I'm a big supporter of Ludum Dare and One Game a Month.

But in the last couple years, game jams have become so popular- look at or Compohub or any of the other game jam organizers.

And that's great- if people want to do them, awesome.

But on the other hand, I've also seen people get stuck just constantly doing little throwaway projects instead of ever completing something bigger.

And, again, whatever floats your boat is cool- I'd just like to see people graduate from game jams and onto bigger and better things. I agree that they can be great learning experiences- but the whole point of learning experiences is to grow and move on to the next level.
20  Discussions / General Discussions / Re: Bring back 1HGJ? on: 2014-12-23 18:41:31
Doesn't the world have enough game jams? They're great to get people interested and as a once-in-a-while thing, but I feel like a lot of people focus too much on throwaway games and not enough on "real" projects.
21  Discussions / Miscellaneous Topics / Re: Looking for nice RPGs to check out (online/offline) on: 2014-12-23 18:19:07
You might want to check out Legends of Yore or the upcoming Legends of Fore, both by JGO's own lovely and talented KevGlass.

They're rougelikes rather than strict RPGs, but definitely worth checking out.

22  Discussions / General Discussions / Re: I no longer use Google Play and I block ads on: 2014-12-23 18:09:48
At the risk of hijacking this thread, we've got a bit of a paradox here:

We want less annoying, less obtrusive, more memorable, more applicable, just in general *better* advertisements. They are a necessary evil in our world, so we should make them as un-evil as possible.

However, the way to do this is by tailoring advertisements to specific types of people. The ads on this site promote games by the people on this site, for example, and that doesn't seem half bad.

But, in theory, that's what google/facebook/microsoft/amazon/everybody is doing when they "sell your information" as it is sorta misleadingly called. But we don't like that either!

So, what's the solution?

I like ad networks like Project Wonderful, who usually seem to show pretty decent advertisements (and they're site-wide, not specific to a user), and hopefully the bigger ad networks get better at showing ads in a non-obtrusive way.

Is there a "good" way to do ads? Or are we all just waiting for the "ad bubble" to burst? What comes after that?
23  Game Development / Newbie & Debugging Questions / Re: NullPointer with basic LibGDX. Following examples. on: 2014-12-23 15:19:17
Well, when is the onAssetsLoaded() function called? Try adding print statements to find that out as well.
24  Game Development / Newbie & Debugging Questions / Re: NullPointer with basic LibGDX. Following examples. on: 2014-12-23 15:13:13
What are the values of playerModelInstance and environment when that line of code runs? Add print statements just before that line to find out.
25  Discussions / Miscellaneous Topics / Re: Markus bought a new house on: 2014-12-23 14:04:06
tl;dr: what Ray said.

I "love" all the sanctimonious posts here (and here) from people who are quick to swear that they'd never "sell out" (ugh) when they inevitably become rich, all while denying the privilege that they already enjoy.

It's almost funny: Notch started out as "just a dude" on JGO. Then he became successful and became "the hero" of JGO. And now that many of the old-timers have been replaced by kids (most of which were probably inspired to try Java after learning that Minecraft was made with it), Notch is now "the sell-out" of JGO.

You don't get to call anybody a sell out until you move out of your parents' house and have to start paying your own bills. It's easy to say what you would do with your billion dollars, but most people here swearing that they'd never sell their games are, at best, lying to themselves.

Good for Notch. People speculating about his true level of happiness and whether or not he's a sell-out or whatever: get back to work making your own games. :p This kind of obnoxious speculation is exactly what drove him away from the spotlight in the first place. It's a shame that even JGO craps on him now, mostly because kids are jealous and still naive enough to be self-righteous about what they'd do in his shoes.
26  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-23 13:54:38
Is there some code I can add to record the stacktrace?

Not really- the error presumably happens before any of your code actually runs.

You could wrap your jar in another main class that runs your actual main class... but you'd have the same difficulty of defining the main class then.

Just post a link to the jar for us to try.
27  Game Development / Newbie & Debugging Questions / Re: Starting with 3D in Java, Where should I begin? on: 2014-12-23 13:50:19
I have always liked LibGDX; So I wanted to use it for this, but I can't find ANY TUTORIALS on 3D development.

28  Game Development / Networking & Multiplayer / Re: Open World Multiplayer Game on: 2014-12-22 19:06:32
This really isn't a question that anybody can answer.

The only way we can answer "should I do this or that" type questions is with "well, what happened when you tried each approach?"

If you don't know how to start, then you shouldn't be trying to take on a project of this magnitude.

And if you haven't tried anything yet, worrying about what would be the "fastest" is just premature optimization at this point.

Get something working first. Then worry about getting it working better.
29  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-22 13:39:13
You might also consider posting a link to your jar for us to try out ourselves, that way we can see the error directly.

Do you not see the error when you run the jar?
30  Discussions / General Discussions / Re: Weird Math.max() behaviour. Math.max(0f, Float.MIN_VALUE) is Float.MIN_VALUE?? on: 2014-12-18 15:02:12
There's no upside as it bring no additional information to the table.

I mentioned a use-case where a second variable comes in handy. My only point is that there are multiple ways to solve this problem. I don't really want to bicker about it.

Chalk it up to us solving slightly different problems with slightly different requirements.
Pages: [1] 2 3 ... 19

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

The first screenshot will be displayed as a thumbnail.

Elsealabs (11 views)
2014-12-28 10:39:27

CopyableCougar4 (17 views)
2014-12-28 02:10:29

BurntPizza (21 views)
2014-12-27 22:38:51

Mr.CodeIt (14 views)
2014-12-27 04:03:04

TheDudeFromCI (19 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (58 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (94 views)
2014-12-09 22:41:13

BurntPizza (115 views)
2014-12-08 04:46:31
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

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

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50 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!