Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (555)
Games in Android Showcase (148)
games submitted by our members
Games in WIP (601)
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 ... 25
1  Game Development / Newbie & Debugging Questions / Re: What should i use to develop multiplayer game online in browser ? on: 2015-02-27 21:33:02
Also, I should note that multiplayer is NOT trivial, so you should really start much smaller and work your way up.
2  Game Development / Newbie & Debugging Questions / Re: What should i use to develop multiplayer game online in browser ? on: 2015-02-27 20:05:57
LibGDX is great, but you should know the basics before you try to dive into it.

If you're a novice (and it sounds like you are, which is cool- that's how we all started out), then you might want to check out Processing.

You can use its Processing.js to deploy as HTML and JavaScript as well.
3  Discussions / Miscellaneous Topics / Re: When things go too far on: 2015-02-27 19:10:08
Comparing DLC to terrorism?

Click to Play
4  Game Development / Game Mechanics / Re: Making GUIs on: 2015-02-27 19:08:21
It seems like it wasn't thought out very well by the Sun swing engineers.

This is a pretty presumptuous statement. Can you name any other thread-safe gui libraries?

Recommended reading: https://weblogs.java.net/blog/kgh/archive/2004/10/multithreaded_t.html
5  Games Center / WIP games, tools & toy projects / Re: Flight, Mobility Emphasis Platformer WIP on: 2015-02-26 23:27:37
Looks interesting. Give the dude a parachute and you've got Just Cause 2D.
6  Discussions / Miscellaneous Topics / Re: Drawing a Minimap on: 2015-02-25 19:10:30
Do you mean another camera with a different projection? That is what I am already doing unless you mean something different.

No, that's not what I mean. I'm talking about creating your mini-map without using your full-sized images directly.

I know the tiny image way would really increase performance but that means we start diluting the classes with extra data that imo, should not be necessary.

I would argue that this data is necessary, but you don't really need to add anything new. Just cache the resized images used for the mini-map instead of recalculating them every frame.

Do you mean essentially take the pixel information of the finished batch call and store it somehow? I have no idea how to do that lol.

It doesn't really have to be that fancy. Just store the small images to be used by the mini-map. Whether you do them by hand ahead of time or try to calculate them when you load the full-sized image is up to you.
7  Discussions / Miscellaneous Topics / Re: Drawing a Minimap on: 2015-02-25 19:00:28
Why don't you just create another view?

Presumably, currently every tile Object contains an image to be drawn. You then draw that image twice- once at full size, and once at tiny size.

Why not have each tile Object contain another tiny image (or color) that you then draw to the minimap?

Alternatively: base the tiny image off of the full image, but cache the result instead of redrawing it every single frame.
8  Game Development / Newbie & Debugging Questions / Re: LibGDX:How to create Key Value pairing holding info for different datatypes on: 2015-02-25 15:29:02
Thing is i have about 50 of those "book" objects. That about 350 lines of code copy/pasted if I'd do it like this:

That's why I initially tried to put all the info for one book (painting in my case...) into individual Arrays of Strings (only need ~50 lines of code) and then with a for loop a could automate the key value pairing for the HashMap.

So my question is using Kevin's code how do you get all the info into 50 objects and still have great code (I assume you are not a big fan of copy/pasting it (7 lines of code * ) 50 times like the example above or are you)?

Like I said in my post, you'd probably use a constructor in real code. Something like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public class Book{
   String author;
   String title;
   int year;
   String subTitle;
   Texture image;
   Texture button

   public Book(String author, String title, String subTitle, int year){
      this.author = author;
      this.title = title;
      this.year = year;
      this.subTitle = subTitle;
   }
}


Then you can do the initialization of each book in a single line:

1  
2  
Book myBook1 = new Book("Dr. Seuss", "Green Eggs and Ham", "and other stories from the Necronomicon", 2015);
Book myBook2 = new Book("Robert Kirkman", "The Walking Dead", "home", 2015);


This is pretty basic OOP, which is why I suggested you might want to go through a few basic tutorials before going further.
9  Game Development / Newbie & Debugging Questions / Re: LibGDX:How to create Key Value pairing holding info for different datatypes on: 2015-02-24 14:40:17
You're using parallel arrays to keep track of your data, which is considered a pretty horrible approach by most people, for a lot of reasons.

It can be hard to "think in OOP", but this is exactly what OOP is useful for.

Of course, it's entirely up to you and what fits in your brain the best- but I think as you become more familiar with OOP, you'll lose the parallel arrays and go with a simple Object.
10  Game Development / Newbie & Debugging Questions / Re: LibGDX:How to create Key Value pairing holding info for different datatypes on: 2015-02-24 14:17:40
That seems like a lot of work to just avoid creating a single class.
11  Discussions / Miscellaneous Topics / Re: Make the simplest code unreadable on: 2015-02-24 13:25:47
I've seen worse in production.
12  Game Development / Newbie & Debugging Questions / Re: LibGDX:How to create Key Value pairing holding info for different datatypes on: 2015-02-24 13:23:07
Hi,

I would like to create something like a hashmap, but in my case I want the key to hold different values with different data types.
Or to be specific:

I want to appoint a KEY to a set of data like:

{
Author: String author;
Title: String title;
Year: Int year;
Sub-Title: String subTitle;
Image: Texture image;
Button: Texture button}

And then I want to be able to get the data by doing something like KEY.getImage / KEY.getAuthor etc.

I'm just not sure of how to do this (best). Can you point me in the right direction?



It seems to me like you aren't thinking with Objects. Like other people have said, you can just create a new class that holds that data:

1  
2  
3  
4  
5  
6  
7  
8  
public class Book{
   String author;
   String title;
   int year;
   String subTitle;
   Texture image;
   Texture button
}


Then you can create instances of that Book class to group your values together:

1  
2  
3  
4  
5  
Book myBook = new Book();
myBook.author = "Dr. Seuss";
myBook.title = "Green Eggs and Ham";
myBook.year = 2015;
myBook.subTitle = "and other stories from the Necronomicon";


And then you can use those instances in whatever data structure you want, including a HashMap:

1  
2  
3  
4  
5  
6  
Map<String, Book> bookMap = new HashMap<String, Book>();
bookMap.put("key", myBook);

//...

String bookTitle = bookMap.get("key").title;


You can also update these Book instances after you add them to the Map:

1  
bookMap.get("key").year = 2016;


I'm using the Book variables directly for simplicity, but real code would probably use constructors and getter/setter functions.
13  Game Development / Newbie & Debugging Questions / Re: LibGDX Random Coin Placement on: 2015-02-23 19:43:17
What happened when you tried to use a Rectangle?

Like I said, a simple Point class would do the trick. Either use the Point class provided by whatever library you're using, or create your own basic class:

1  
2  
3  
4  
class Point{
   int x;
   int y;
}


However, it seems strange to me that you don't already have some kind of data structure in place to represent cells.

Yet another approach would be to just choose a random point until you find one that's not null, and then place the coin there. Which approach you should take depends on which you have more of: nulls or not nulls.
14  Game Development / Newbie & Debugging Questions / Re: LibGDX Random Coin Placement on: 2015-02-23 19:30:20
I mean, a simple Point class would do the trick.

But you presumably already have an Object that represents a Tile or Cell. What class are you currently adding the coin to? Can you show us any example code?
15  Game Development / Newbie & Debugging Questions / Re: LibGDX Random Coin Placement on: 2015-02-23 19:25:23
It depends on your setup. You said you have some kind of data structure of tiles or cells. Some of those tiles or cells are null, some aren't. You want to do something to a random not-null tile or cell.

One way to do that is to create another data structure (like an ArrayList) that contains only the eligible tiles or cells, then just choose a random index from that data structure.

How exactly you do that depends entirely on how your code is stuctured. Can you post an MCVE?
16  Game Development / Newbie & Debugging Questions / Re: LibGDX Random Coin Placement on: 2015-02-23 19:13:38
Loop through your tiles. If each cell is not null, add it to an ArrayList.

Choose a random cell from that ArrayList, and add the coin to it.
17  Game Development / Newbie & Debugging Questions / Re: I'm trying to make a shotgun and this is happening on: 2015-02-22 17:35:11
Rename it to "spiral gun" and call it a feature, not a bug. Problem solved.
18  Game Development / Newbie & Debugging Questions / Re: Picking Blocks with mouse on: 2015-02-22 02:16:03
Can you post an MCVE showing the basics of what you're trying to do?

We don't even know if you're using Java2D or libGDX or something else. HeroesGraveDev gave you the basics, but anything more specific than that will require more information than we have.
19  Game Development / Newbie & Debugging Questions / Re: bounds.contains() problem on: 2015-02-21 13:32:44
You'll have much better luck if you post an MCVE that we can actually run. As of now any answers you get will just be guessing.
20  Java Game APIs & Engines / Java 2D / Re: 2D game engine. on: 2015-02-21 04:01:59
Processing is built on top of Java. It shares Java's syntax- so by learning Processing, you're learning Java.

You can write Processing code in Java, and you can write Java code in Processing.

What makes it different is two things:

1- Processing, at its core, is a Java library that does a ton of visual stuff for you. Out of the box you have access to an OpenGL wrapper, a 60 fps game loop, and a bunch of methods that do some pretty cool stuff for you.

2- The Processing IDE is designed to make it super easy to write Processing code. You don't worry about the JRE, compiling, the classpath, etc. You hit play and your code runs. I can't understate how awesome that is, especially for a novice.

If you're just starting out, Processing, imho, is definitely the way to go. Even if you aren't just starting out, it's worth checking out.

If you know a little bit of Java, then stick with Java2D and make a few simple games before moving on.

If you're an experienced Java developer, then libGDX is a game changer, no pun intended.

It's also worth noting that you can export Processing applications (in the Processing vernacular, they're called sketches) as JavaScript using Processing.js.
21  Java Game APIs & Engines / Java 2D / Re: 2D game engine. on: 2015-02-20 13:44:22
I also second the Processing suggestion.

Shameless self-promotion: I've written tutorials on writing games in Processing available here.
22  Java Game APIs & Engines / Java 2D / Re: 2D game engine. on: 2015-02-19 21:41:46
Shortest answer: libGDX.

Longer answer: If you're just starting out, it wouldn't hurt to just use basic Java2D to get your hands dirty. Try making Pong or something very simple. You should really understand collections and OOP before trying out libGDX, but once you make the switch to libGDX, you'll never go back.
23  Game Development / Newbie & Debugging Questions / Re: Java Swing / AWT Sounsd on: 2015-02-19 16:14:22
Load all of your sounds ahead of time, when the game is loaded.

Then just play the already-loaded sound whenever you need to.
24  Discussions / General Discussions / Re: Too complicated? on: 2015-02-18 14:34:24
Im not asking if it would work as in the code would work , what I mean is would it be an enjoyable playing experience.

And again- how would we know that?

More to the point: what does it matter what we think? The important thing is: do you think it would be enjoyable? Does it sound fun to code? Then stop wasting time and just put together a little prototype! Then we can tell you whether the prototype is fun or not.

I'm not trying to be critical or discouraging: quite the opposite, I'm trying to tell you to just go for it, try it out, see if it works, then post your results here. Taking the time to ask us what we think about a theoretical game mechanic seems like time that would be better spent just creating the darn thing.
25  Discussions / General Discussions / Re: What's your day job? on: 2015-02-18 14:09:53
Teachers are not compensated based on their teaching, they are promoted according to their research output, and fired if they don't perform: publish or perish.

As somebody who would like to get into teaching for teaching and hates the "academic research" side of things (which seems to favor quantity over quality instead of real passion), this is the terrifying part.

I'm hoping that movements like Code.org, or its smaller regional siblings like Black Girls Code, Girl Develop It, etc, change how computer science education works. A shift away from universities and into outreach programs is really exciting. Or that's just wishful thinking on my part.

The teachers are not idiots, they're rationally responding to the incentive system they operate in which puts no value on teaching.

Thanks for this. I cringed quite a bit at the people blasting teachers. There are plenty of amazing teachers out there.

Another side of this is that college/university isn't supposed to be high school. You're supposed to want to learn. You get what you put in, so if you're just waiting for a teacher to come along and hold your hand the whole way, you're going to have a bad time. That doesn't mean that person is a bad teacher. It means you're a bad student.

Sure, some teachers are only there to squeeze coauthored papers out of students. Some should have retired 10 years ago and are just there thanks to tenure. But saying "all teachers are incompetent" is pretty offensive, and probably a sign of the type of student you are rather than the types of teachers you've had.

(I also know that some of you were just kidding, so calm down!)
26  Game Development / Newbie & Debugging Questions / Re: Adding chunks to world for large maps? on: 2015-02-18 13:50:01
I dont realy know what that means.... a tree structure?

If you don't know what a tree structure is, then you probably shouldn't be worrying about creating infinite terrain.

I'm not trying to discourage you, but you really might want to take a step back and start with something smaller- you'll be more likely to succeed by taking smaller steps instead of trying to bite off more than you should be chewing.
27  Discussions / General Discussions / Re: Too complicated? on: 2015-02-18 13:46:17
What do you think , by this I mean that the entire system would operate under correct laws with different circuit setups acting differently.

I'm not sure what you're hoping to get from us here. What does it matter what we think? How would we know whether your implementation will work?

If we say we think it will work, does that increase the chances of it actually working? If we say we think it won't work, are you just going to give up?

Instead of wasting time worrying about what we think, put together a little prototype. Prove to yourself that it works. It really doesn't matter what anybody else thinks.
28  Game Development / Game Play & Game Design / Re: What's The Best Way To Define Items? on: 2015-02-18 13:43:36
Really, the answer is that it depends entirely on you, your preferences, your programming style, etc. There are probably a hundred different ways to do this, and none of them is "right". That's the beauty of programming. It's also part of what makes it so frustrating!

But I will say that one thing you should look into is the idea of favoring composition over inheritance.

Basically, your approach with the 1000 classes uses inheritance, and it would go something like this, where you inherit from a base class to create different items:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
abstract class ItemParent{
   public String getName();
   public int getAttack();
}

class ItemOne extends ItemParent{

   public String getName(){
      return "Item One";
   }

   public int getAttack(){
      return 10;
   }
}

class ItemTwo extends ItemParent{

   public String getName(){
      return "Item Two";
   }

   public int getAttack(){
      return -1;
   }
}


But all of that could be simplified by using composition instead. You would create an Item class that is composed of the different aspects of an Item:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
class Item{
   private String name;
   private int attack;

   public Item(String name, int attack){
      this.name = name;
      this.attack = attack;
   }

   public String getName(){
      return name;
   }

   public int getAttack(){
      return attack;
   }
}


And then to create a specific item, you would just create an instance:

1  
2  
Item itemOne = new Item("Item One", 10);
Item itemTwo = new Item("Item Two", -1);


Like I said, there are a hundred different ways to do this, even if you do try to favor composition over inheritance. This is just something you should keep in mind before you create 1000 mostly identical classes.
29  Discussions / General Discussions / Re: 2015 state of the art of packaging a java game with private JRE on: 2015-02-18 13:32:16
princec is probably the most professional among us, so his answer is probably what you're looking for.

But at the risk of summoning the JGO demons, there are several other options: you might want to look into JWrapper, or Launch4J. Doing a search on the forum for either of those will give you a ton of discussions where we debate this exact topic.

If you use something like libGDX, you can also deploy as JavaScript, which is probably the best option, imho.
30  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [libGDX] Semi-transparent mouse cursor on Windows on: 2015-02-17 15:32:44
Googling "java windows cursor transparency" returns a ton of results explaining the problem, so I'm surprised your googling didn't turn any of them up.

Java doesn't support transparency in cursors on Windows. The workaround is to set the cursor to invisible and then draw your own, as mentioned in the first result of the above googling here: http://stackoverflow.com/questions/13326256/implementing-cursor-in-java-with-some-transparency
Pages: [1] 2 3 ... 25
 
BurntPizza (20 views)
2015-02-27 06:09:35

BurntPizza (19 views)
2015-02-27 05:56:17

Riven (9 views)
2015-02-27 02:34:15

Riven (16 views)
2015-02-27 01:47:26

Riven (16 views)
2015-02-27 01:46:04

BurntPizza (11 views)
2015-02-27 00:52:04

BurntPizza (14 views)
2015-02-27 00:50:29

Riven (33 views)
2015-02-26 23:38:45

Riven (10 views)
2015-02-26 23:37:24

BurntPizza (27 views)
2015-02-26 21:13:04
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

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
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!