Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (707)
Games in Android Showcase (206)
games submitted by our members
Games in WIP (781)
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]
Galdo (236 views)
2017-01-12 13:44:09

Archive (404 views)
2017-01-02 05:31:41

0AndrewShepherd0 (863 views)
2016-12-16 03:58:39

0AndrewShepherd0 (800 views)
2016-12-15 21:50:57

Lunch (937 views)
2016-12-06 16:01:40

ral0r2 (1165 views)
2016-11-23 16:08:26

ClaasJG (1268 views)
2016-11-10 17:36:32

CoffeeChemist (1305 views)
2016-11-05 00:46:53

jay4842 (1389 views)
2016-11-01 19:04:52

theagentd (1207 views)
2016-10-24 17:51:53
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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!