Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (731)
Games in Android Showcase (217)
games submitted by our members
Games in WIP (798)
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: I.T. professional: bored of being a tool - "Please Advise" on: 2017-06-22 03:14:07
It seems to me, if you don't take the time to write what turns out to be "crap" code, how do you grow?

Coding is a lot like a muscle--you have to engage in the problem solving activities in order to improve your ability to problem solve.

I agree with all of that.

To be clear, I wasn't telling the OP to avoid writing bad code- I was telling them to avoid writing bad code that they're planning on reusing, because the truth is that they won't actually reuse it. Write bad code, definitely. But that bad code should be a small game or app or demo that they can treat as a completed whole and move on to the next thing, instead of perpetually needing to go back and rewrite everything.

If you are just going to "template code" (and avoid any heavy lifting), might as well just use a builder tool and forego coding. Rewrites are both an inevitable and necessary part of learning. Hard to truly understand how important something is until you try and discover why the 'obvious' solution doesn't always work.

I think it's more important to learn "the process" behind programming: taking a big problem and breaking it down into smaller pieces. The only way to learn that is to do it, over and over again. With that experience comes all of the stuff you need to be a "real" programmer. Break a problem down, finish it, and move on to the next thing. Repeat that until it comes more naturally, then move on to more advanced stuff. I don't think it's super useful to constantly rewrite what you've already written. But maybe this comes down to personal learning style, so to each their own. Writing and rewriting engine code sounds horrible to me though!

If game-engines are a passion, why not? There is a lot to be learned there. I'm not saying it is any better or worse a career path than making games, though.

OP never said game engines are a passion. My guess was that they knew that games were made in engines, so assumed they needed to use one to make a game (you don't, by the way). Then they saw that a lot of people make their own engine, so the question becomes: do I make my own engine? Is that the "correct" way to make a game? And I think the answer to that, like most things in programming, is that there isn't a single correct answer. But I cant definitely understand how confusing it can be: do I learn an engine? Which one? Do I create my own? How do I get started?

And my personal answer to that is, don't do it that way. Work in smaller chunks until you have more experience with the process of programming. Get something that works, throw that up on your portfolio, and get the next thing working. Even if your end goal is to make games, you need to learn the basics first anyway.

Just my two cents though. Every person learns differently.
2  Game Development / Newbie & Debugging Questions / Re: I.T. professional: bored of being a tool - "Please Advise" on: 2017-06-21 01:42:53
With that said, should I go full tilt and learn how to design a LWJGL engine and gain deep programming experience, or should I use an engine and just worry about completing something?

Don't design an engine. Use an existing engine, like libGDX.

If your goal is to start building up a portfolio, the harsh truth is that nobody is going to look at a game engine. You've said that you're still a novice programmer, and that's completely okay! But that also means that most of the code you write right now is going to look like crap to you in 6 months- that's a sign of you growing, and it happens to all of us. But the point is that there really isn't a point in starting out creating an engine, since you'd probably end up rewriting anything you did right now anyway.

Start small. Smaller than you think is interesting. Don't think Call of Duty, don't even think Minecraft. Don't even think Angry Birds. Think Pong. Maybe Flappy Bird. Learn the basics of game development: game loops, user input, drawing, events, object oriented programming, etc. Work your way forward in small steps. Finish those small projects before moving on to the next one. A portfolio that contains 3 tiny but finished games is much more impressive than a portfolio that contains one half-finished big game or engine.

And at the risk of being accused of blasphemy, I'd also urge you to take a step back and look outside of games as well. Games are fun, but they aren't easy. Learning a framework like libGDX is very hard if you don't already understand the basics of Java, object oriented programming, events, etc. So I'd really advise you to take the time to learn the basics before trying to take on more advanced stuff. You might even find that you like something else more than games anyway: maybe app development, or server development, or data visualization, or even art.

For learning the basics, I really like Processing. It lets you play around with the basics in an animated and interactive way, without all of the boilerplate that more "advanced" game engines require. Shameless self-promotion: I've written a series of tutorials that take you from the basics in Processing to more advanced topics in Java, available at I'd be happy to talk more about that if you think it sounds interesting.
3  Game Development / Game Play & Game Design / Re: has map vs instaceof for determining object kind from an arraylist of arraylist on: 2017-05-24 04:44:54
I'm programming  an rpg where you have  many soliders  and horses and some soliders  can carry things as well as horses.

So wait... the soldiers can carry horses?

(As a side note, you might want to try using proper punctuation. It would make your post much easier to read!)

If I wanted to remove an item would hashmapping each class be better than checking instanceof class  with a  for loop to find the item?

Better in what sense? Chances are you aren't talking about thousands of items, so you probably won't be able to notice the difference. Does a particular approach make more sense in your own brain? Go with that. Not sure which one makes more sense to you? Try putting together a little example program that tests out each approach. Which one do you like better?

In programming, there is no single correct way to do anything. So you have to figure out what works best for YOU. We can't really help you with that. The only way to figure that stuff out is by trying things out for yourself.

That being said, I'm not sure either one of your approaches makes sense in my brain. Why do you need to do either one? Presumably you have an inventory that a player is choosing from. The player is selecting an instance, or an index, or a key, or something. Why can't you just use that?

For example, if the inventory is just 10 boxes on the screen, then maybe that's an array. If the player clicks on one of the boxes, then you know which index to remove. Or if it's an inventory of named objects, then you could use a Map from names to instances. But I don't think a Map that contains Classes makes a ton of sense. The Map would contain instances.

Honestly it sounds like you might want to try implementing something a little simpler first.
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Libgdx notable game repositories on: 2016-11-09 16:27:09
You might try searching game jams like Ludum Dare for libGDX games. Many of those are open-source.
5  Game Development / Newbie & Debugging Questions / Re: Creating a Button. on: 2016-11-09 13:22:12
Above is the working code (apart from the parts I can't test) , for the creation of a button that is drawn using  (g.drawImage(but.getSprite(), but.getX(), but.getY(), null)Wink  in a different class.

In the future, you might have better luck if you post an [MCVE]( that includes a main method and all the code we need to copy and paste it to run ourselves.

Above is the working code (apart from the parts I can't test) , for the creation of a button that is drawn using  (g.drawImage(but.getSprite(), but.getX(), but.getY(), null)Wink  in a different class.

The issue I'm having is setting an area for MouseListener to activate. To what I have read, for MouseListener to work, I need to have a JComponent attached to my Button class. Do I need to put something like a JLabel onto my class to give my button mouse input or is there a better way?

If you're going to use a Swing component like JLabel, why not just use a JButton instead of your own custom class?

How you do this depends on how you're drawing your button. If you're using a Swing component like JLabel or JButton to draw your button, then you'd just add the listener to that. JButton even has its own ActionListener that you can use instead of handling all the mouse events yourself.

But if you're manually drawing the button yourself, then the MouseListener needs to be on the component doing the drawing. For example if you're extending JPanel and overriding the paintComponent() function, then the MouseListener would go on that class.
6  Game Development / Newbie & Debugging Questions / Re: Multi thread Memory Visibility inside Synchronized keyword on: 2016-11-04 14:31:56
Synchronization has nothing to do with visibility.

The only thing your synchronized methods guarantee is that they can't be called by two different threads at the same time.

You aren't even using threads, so this is a non-issue.

By the way, a rhetorical question is a question that you don't expect an answer to. Maybe you meant hypothetical question?
7  Game Development / Game Mechanics / Re: What are the ways to render a 2d game? on: 2016-11-03 14:25:21
Can you please list down the ways 2d java game programmers do to render images for their games? What are the recommended way by Oracle? What are their pros and cons? There are just so many ways to implement this (rendering an image)! Can someone please enlighten me?

That's the thing about programming: there is never a single best way to do anything. There are always a million ways to do any one thing, and each approach has its own pros and cons. Many of those pros and cons depend on you more than anything. How you think, what you prioritize, what you've learned so far, etc.

So asking us to list every single way and all of their pros and cons is a little bit like asking us what you should eat for dinner. We can tell you what we eat for dinner, but that might not be what you should eat. The only way to figure out what is best for you is to try a million different things out and see what you like and don't like.

I will say that I personally love Processing, especially for novices.
8  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Generic Multiplayer Connector on: 2016-11-02 13:05:40
Now that it's multiplayer, that's all I need.

To be honest, I probably spent less than 10 seconds thinking about the maze generation.  Your game generates random mazes which is all I needed to create a nice simple game I can play against my kids.

Fair enough. Enjoy!

But you might want to play a few rounds against yourself and then use those likelihoods instead of the default, that way the mazes are actually interesting. Up to you!
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Generic Multiplayer Connector on: 2016-11-01 13:17:17
The game sends the maze data to the other players, so they have the same mazes.

I understand that part. I wasn't talking about your multiplayer version, I was talking about the generator itself. I'm trying to say that the seed has nothing to do with the difficulty of the maze, and it's all based on player performance. Your current multiplayer version will just end up with random (and probably pretty easy) mazes without any notion of difficulty.
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Generic Multiplayer Connector on: 2016-10-31 17:41:00
Regarding the maze complication, I think I just increased the seed that your function used, which I assumed made it harder.

Sorry, but this is not at all how it works. The maze generator is defined by a few likelihoods: likelihood that the path goes forward, likelihood that the path goes left or right, etc. There is no concept of harder or easier or more or less complicated in the generator itself. Instead, the generator uses how long the human players take to solve a maze to find the "hardest" maze and then uses that maze as the parent for the next generation.

Think of it this way: each "round" of the game is actually 3 mazes: one was generated with more likelihood for straight paths, one was generated with more likelihood for left paths, and one was generated with more likelihood for right paths. At the end of the round, the generator takes the maze that took you the longest to solve and uses that as the parent of the next generation, so subsequent mazes will be generated with similar (but still mutated) likelihoods.

After a few rounds of that, the mazes naturally evolve to be more complicated, but it's not based on any idea of complication in the code itself. It's based entirely on player performance, and in fact two players might get completely different types of mazes based on how they perform.

You could use the generator to evolve mazes based on both player performances (evolve mazes that would be easier for the loser? or more complicated for the winner?), but it's not as simple as modifying a seed value. That doesn't actually change anything other than the initial seed value used by the random generator.
11  Game Development / Newbie & Debugging Questions / Re: Texture Farm on: 2016-10-28 14:29:09
No problem. I'd be curious to hear about what you come up with.
12  Game Development / Newbie & Debugging Questions / Re: Texture Farm on: 2016-10-28 13:57:01
Well, you either need to pass it into the object as an argument, or you need to make it available statically.

But we're talking about two different things here: there's the overall "texture farm" that holds the texture ids and the images they map to, and then there's the individual ids for each object to tell it which texture to use.
13  Game Development / Newbie & Debugging Questions / Re: Texture Farm on: 2016-10-28 13:46:12
I'm not sure I follow. How do you expect the object to know which texture to use?
14  Game Development / Newbie & Debugging Questions / Re: Texture Farm on: 2016-10-28 13:29:05
Sure, anything is possible. It really depends on exactly what you want to do.

You could use a Map<Integer, Texture> that maps from id keys to Texture (or whatever class represents a texture) values.

Or you could use an enum that represents you textures, or objects, or... there are a million different ways to do this.

What have you tried so far? What exactly are you confused about? Where did you get stuck?
15  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Generic Multiplayer Connector on: 2016-10-25 12:55:42
Maybe it should handicap the winner or something?

Yeah that's what I was thinking. Although I like the idea of putting them in the same maze. Would it be possible to drop them into the same maze so they see each other? I don't know if that would work with the kind of mazes it generates though, since there's only really one main path.

I'd also be curious to hear about how you had it generate more or less complicated mazes. The generator is a little blind to that, using how long it takes you to solve previous mazes to make more complicated mazes. In other words it doesn't come from the programmer, it comes from the player. I'd be curious to hear how you programmed around that.
16  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Generic Multiplayer Connector on: 2016-10-24 13:54:43
Here's next project to retro-fit a game into multiplayer using GMC, this time MazEvolution written by KevinWorkman.  It's a maze game where each player gets the same maze, and the first to get to the exit wins.  And then everyone gets a new maze.

This is really cool to see. Wouldn't it make more sense to have the winner get a more complicated maze though?
17  Discussions / Suggestions / Re: Featured Open-Source on: 2016-10-20 14:43:46
I don't disagree with your desire to see more open-source Java games (that's part of why I started Static Void Games in the first place), but I also think you're overestimating the manpower we have here. The forum is run by one person, and we have a dedicated but pretty small user base. The stuff you're proposing takes time and interest. You could start by creating your own list, maintaining a thread of open source games you find, but that probably seems like a lot of work. If it seems like a lot of work for you, imagine how much work it feels like to other people who don't have as much of an interest as you do.

I actually like your idea, I just don't think it's going to get much traction.

If you're looking for open-source Java games, you might check out Ludum Dare, which is a game programming competition where entrants have to release their source. Do a search for Java and you'll get a ton of results. But please note that open-source does not mean no copyrights, so make sure you contact anybody before using their source.
18  Discussions / Suggestions / Re: Featured Open-Source on: 2016-10-20 14:24:27
finding something decent can be a challenge

Yep, exactly. To create this featured board, we (read: Riven) would have to somehow find these gems. It's a bit of a chicken and the egg problem.

You could help jumpstart this by coming up with your own list, but like you said, that isn't as easy as it sounds.
19  Discussions / Miscellaneous Topics / Re: Looking for simple but complete open-source game on: 2016-10-19 15:57:39
I haven't touched this code in years, but I can try to look when I get home.

But this is exactly what's going to make your approach difficult: it's one thing to try to write code and then add multiplayer to it. It's a completely different beast to try to wrap your brain around code written by other people. Even if the code works exactly like you expect (which it never will), you're still going to have to be comfortable going through code written by other people, which can be a very messy experience.

I would guess that what I did was comment out some stuff in order to create some screenshots of mazes without showing the player or exit, but that's really just a guess.
20  Discussions / Miscellaneous Topics / Re: Looking for simple but complete open-source game on: 2016-10-19 15:08:58
You can use Processing as a Java library and use plain old Java with them.

But if I remember correctly, these are all plain Java:
21  Discussions / Miscellaneous Topics / Re: Looking for simple but complete open-source game on: 2016-10-19 14:47:11
Ah, interesting. I'll be curious to see what you end up doing with this, so keep me updated!
22  Discussions / Miscellaneous Topics / Re: Looking for simple but complete open-source game on: 2016-10-19 13:36:45
I've got a few little open-source games available here:

This one is a puzzle game that might be pretty reasonable to make multiplayer:

But like others have said, what you're describing is not trivial. It might sound easier to take an existing game and make it multiplayer, but that's going to be much, much, much more difficult than writing your own game from scratch.

Start very small. Start with the bare basics. Maybe a chat room, or a multiplayer drawing application. Then move onto implementing a simple game, like tic-tac-toe or even rock-paper-scissors. Move on from there in small steps.
23  Game Development / Newbie & Debugging Questions / Re: [SWING] halving the screen with two seperate panes? on: 2016-10-17 12:38:59
Can you please post an MCVE that we can copy and paste to run on our own computers?
24  Discussions / Miscellaneous Topics / Re: AGB Programming on: 2016-10-12 17:50:40
One of the questions that I want to bring up is how come AGB can make fantastic games, such as pokemon, but the modern games we have today, which are 2D, have performance issues? (Keep in mind the AGB isn't the most powerful thing)

Poorly programmed games (or, games that chose to prioritize other stuff) have performance issues. Well-programmed games (or, games that prioritized performance) have better performance.

You seem to be saying that every game for the GBA outperforms every modern game, which is simply not true. There were plenty of poorly written games for the GBA, and there are plenty of well-written games today. That plus modern hardware means that we're doing stuff today that would be physically impossible on the GBA.

It's a bit like the people who say that today's music is terrible compared to music from [insert decade here]. A lot of that is selection bias, because you don't remember the 95% of songs that were terrible from your favorite decade, and you're ignoring the good songs from today. You're comparing one of the most famous games of all time to games that you see on Steam, which isn't exactly an apples to apples comparison.

By the last paragraph, I want to ask, how far have we abstracted? Along with this, in terms of shading, do we really need all the power we have today to represent our stuff?

Sure, one of the "problems" is that we have so much more available at our fingertips. Want a particle system in your game? That's a one-liner. Want physics? Here's Box2D. Want lighting? Here you go. So it can be easy for developers to shove a bunch of stuff that they might not need into a game, without worrying too much about performance or the hardware they're running on. They might design it for their $5,000 hardcore gaming PC, and you'll have issues running it on your 5-year-old Android phone.

But I would argue that's a good thing for the most part. As a developer, I don't want to have to worry about which hardware I'm running on, and I don't care about all the hardware-specific hacks that I could take advantage of if I limited myself like that. I also don't want to reinvent the wheel every time I sit down at the computer, so all these libraries and frameworks are great for me.

That being said, there is a big community around developing games for retro systems. It sounds like you've taken an interest in that, and that's great. Have fun with it. But it's certainly not as simple as saying that the GBA is better at games than modern hardware and software.
25  Game Development / Newbie & Debugging Questions / Re: Should the same objects be made in the same class? on: 2016-09-29 15:15:47
public class BadGuy {
    public BadGuy(){
        badGuy1 = new BadGuy();
        badGuy2 = new BadGuy();


Did you actually try that? Try putting together a little example program. You'll see that this code causes a StackOverflowException.

As opposed to option 1, which is this:
badGuy1 = new BadGuy();
badGuy2 = new BadGuy();

I was thinking about this initially because my game has about a million "brickwalls" that are just named brickwall1, brickwall2, etc, instantiated in my main game file, and I wanted to see how other people instantiate their objects in their games.

Sounds like you should just use an ArrayList or some other data structure?
26  Game Development / Newbie & Debugging Questions / Re: Should the same objects be made in the same class? on: 2016-09-29 13:27:11
Create 1 bad guy object in my main game file and have that object create the 5 bad guys with an array or something.

Can you be more specific about exactly what you mean by this? Can you put together a small but runnable example that tries this approach out?

This is as much for you as it is for us. Questions like this are best answered by simply trying both approaches out and seeing which one you like the best.

But it sounds like the first approach is "better" since I'm not even sure what the second approach really means.
27  Game Development / Newbie & Debugging Questions / Re: Point changing for some reason on: 2016-09-28 15:20:20
The thing that finally made it click for me was this article on variables:

And its follow-up on passing by value:

I highly recommend reading these (in order) for anybody who is still confused about passing by value.
28  Game Development / Newbie & Debugging Questions / Re: Point changing for some reason on: 2016-09-27 12:33:59
Heh, no problem. I like a simpler example anyway:

public class ReferenceTest{
   public static void main(String... args){
      Integer i = 1;

   public static void change(Integer i){
      i = 2;
29  Game Development / Newbie & Debugging Questions / Re: Point changing for some reason on: 2016-09-27 12:07:21
@Phased: You never actually called the test() function. I think you meant something more like this:

public static void main(String[] args) {
   MyObject ref = new MyObject();
   ref.a = "nope, not pass by reference";
   System.out.println(ref.a); //if pass by reference, this should print out "yep, pass by reference"

public static void test(MyObject ref) {
   ref = new MyObject();
   ref.a = "yep, pass by reference";

Note that the test() function also has to be made static to be called from the main() method.
30  Game Development / Newbie & Debugging Questions / Re: Advice request - Player Movement on: 2016-09-26 14:42:06
Are you using a framework like libGDX? Have you considered using a physics engine?
Pages: [1] 2 3 ... 37
Archive (337 views)
2017-04-27 17:45:51

buddyBro (535 views)
2017-04-05 03:38:00

CopyableCougar4 (979 views)
2017-03-24 15:39:42

theagentd (1015 views)
2017-03-24 15:32:08

Rule (993 views)
2017-03-19 12:43:22

Rule (974 views)
2017-03-19 12:42:17

Rule (973 views)
2017-03-19 12:36:21

theagentd (1072 views)
2017-03-16 05:07:07

theagentd (990 views)
2017-03-15 22:37:06

theagentd (761 views)
2017-03-15 22:32:18
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

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51 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!