Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (427)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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]
1  Game Development / Newbie & Debugging Questions / Re: Design Choice Explanation - Point vs ints on: 2013-09-03 19:43:17
Quote
I think he's asking why not use java.awt.Point instead of defining your own class OR just using your own x and y.

Yes, that's what I'm asking. I am just not sure what best practices are. I figured you might want to use things like setLocation and distance methods or something for movements and such.

Quote
If you have a lot of objects, its a lot of overhead, with little to no benefit.
But most of the time people are using floats (much better looking movement).

Fine, my questions remains for Point2D as well.

Wouldn't it make sense to just have a base class such as Mobile that had a Point member and then everything that had a location would extend from it to have that location data as well in a well encapsulated object?

Again, I just wanted to know what best practices were. It may be popular to use x,y as separately tracked values but is it right?
2  Game Development / Newbie & Debugging Questions / Design Choice Explanation - Point vs ints on: 2013-09-03 15:59:33
Can you guys please explain why you want to use int x,y type mechanics instead of the Point class for your coordinates? I see this code everywhere on here and I just cannot figure out why you don't prefer using the Point class.

Maybe I'm missing something here. I am very new to java and not very experienced with games in general. I just figured that since the class is there, why not use it?

Please help me understand this design choice that is so prevalent in java game programming.
3  Game Development / Game Mechanics / Re: Car Physics Problem on: 2013-09-01 05:41:29
I want you to take a week off from programming this and come back to it. When you come back, make note of how little sense this code makes to you. From this lesson, realize what you can change about your code so that it is more readable after taking a break. Now imagine never having seen the code and this is what you're presented with. I see why this has almost 100 views and no input.

So, I took the red pill and decided to see what this was all about. Some things impressed me - some things scared me.

Anyway, whenever there is weird behavior in a program, I immediately try to find out where all of the pertinent divisions are. Why? Because divisions are difficult and error prone. I do not know much about your domain here. I do however believe that when you getBackTireLoad, it should never be passed a value like this: -6.943892E-4. Let's just look at how that code is done since you didn't include it:

1  
2  
3  
4  
public float getBackTireLoad(float a) 
{
    return 4.905f * mass + (shape.getCenterOfMassHeight() / shape.getAxleDistance()) * mass * a;
}


What in the world is 4.905? Where did you get it? What does it mean? When we explore the Car Physics page you presented, it *can* be located as: a = 7350 N / 1500 kg  = 4.9 m/s2  (=0.5 G)  but why not just put it in a comment so I know what's going on?

So, to get the Wr we do this:

4.905f * mass + (shape.getCenterOfMassHeight() / shape.getAxleDistance()) * mass * (Flong.lengthSigned(dir) / vehicle.getMass() / (vehicle.getMass() * 9.81f))

(I just combined the formulas)

You need to do error checking on your division results. I'm going to keep looking at this and toying around with it to see how it ticks but I suggest that if you want to move forward for now, you start there.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (76 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (80 views)
2014-04-14 17:39:50

UprightPath (66 views)
2014-04-14 17:35:47

Porlus (81 views)
2014-04-14 15:48:38

tom_mai78101 (105 views)
2014-04-10 04:04:31

BurntPizza (165 views)
2014-04-08 23:06:04

tom_mai78101 (261 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!