Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (754)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
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 17:43:17
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.

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 13: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 03: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:

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]
DesertCoockie (20 views)
2018-05-13 18:23:11

nelsongames (68 views)
2018-04-24 18:15:36

nelsongames (65 views)
2018-04-24 18:14:32

ivj94 (748 views)
2018-03-24 14:47:39

ivj94 (79 views)
2018-03-24 14:46:31

ivj94 (555 views)
2018-03-24 14:43:53

Solater (94 views)
2018-03-17 05:04:08

nelsongames (168 views)
2018-03-05 17:56:34

Gornova (338 views)
2018-03-02 22:15:33

buddyBro (998 views)
2018-02-28 16:59:18
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 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!