Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (748)
Games in Android Showcase (226)
games submitted by our members
Games in WIP (834)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3 ... 10
 1 
 on: 2018-02-20 07:24:53 
Started by RyanAlbano - Last post by RyanAlbano
New Version Released Today

RECENT CHANGES:

Decimal support added for all text data (including vehicle coordinates, for example '1.5').

New parameters for the tornado, including size, how high, and how far it can travel from the center of the map.

New Track! (Tsunami Express)
Music for the new track comes by default (see last section of the documentation to get the rest of the music)

-----------------------------------------------------------------

FUTURE ISSUES:

Continuing work on Vehicles/Tracks

Adding more hypercars (a Ferrari is probably next). E-mail me at RyanAlbano1@gmail.com to suggest cars.

Adding a new factor in scoring? (will be referred to as a 'bonus')

Adding extra game modes (if they make good gameplay)

Damage Dealt and Kill counter not always accurate. This sometimes gives incorrect scores to teams.

 2 
 on: 2018-02-20 06:55:08 
Started by Alletarchus - Last post by Alletarchus
After your comment, philfrei, I went back and looked more closely. Since I started out with a tutorial, I didn't understand all of what was going on. Probably should've made sure I grokked it before messing too much with it.

I'm not adding the player object to the Pane, but adding the Node associated with it, which explains why I couldn't call those methods; a Node doesn't have them.

Still not totally clear on what's happening here, but a Player object "player" is instantiated at the beginning of the Application class (the most outer class), then within a function that sets up the initial content in the main Pane, I go:

1  
player = new Player();


I have no idea why this works. It's already an instantiation of Player. Yet if I comment that out everything breaks. Clearly I have no concept of the life cycle of an object in Java.

I also found that instead of the above code I had:

1  
Player player = new Player();


This diverges from how the tutorial did it, and seems to have caused most of my woes. This sort of crap happens when I write code after midnight after a long day. Reverting it fixed most of the issues; the program launches, enemies and asteroids spawn and behave as they should, et cetera. Still some issues, but it beats an endless stream of exceptions and a blank white window.

I know your advice was basically "make sure you're doing what you think you are and proceed slowly", but it made a big difference.

 3 
 on: 2018-02-20 05:03:14 
Started by Alletarchus - Last post by philfrei
I can't figure it out from your description. I'm going to make a guess this has more to do with issues pertaining to the different forms of classes (static inner classes versus using a regular class in its own file), than to JavaFX.

If you are getting a null on your example in line one, I'm assuming it is the "player" instance that has not been initialized yet. That would be a normal (happens all the time) cause of a NPE. Can you show where your player instance is initialized? Can you also show that you are not attempting to access any of its properties before the constructor code has finished?

Also, are we sure the variable that you initialized is the same as the one being referenced later?

A general notion (probably you already know, so more a reminder): when making changes, it is helpful to not try and do more than one or two things with each update, and test. That way one finds problems more quickly, and there is a narrower range of theories to test and investigate. For example, if you were able to go back to all inner static classes, and made just one of the classes its own file, that might be easier to troubleshoot.

 4 
 on: 2018-02-20 04:29:27 
Started by BurntPizza - Last post by delt0r
Well i shave, and yea it works a bit. Then i got a part time job driving buses. I have to cycle 8km to work. So 16km a day. And now i\m loosing weight. But went to a rave in a cave in the weekend. Was the oldest person there by over 5 years, out of 100 ppl... shesh.

 5 
 on: 2018-02-20 03:27:31 
Started by Slyth27272 - Last post by Slyth27272
Below is a message that was supposed to be a PM for Riven, however the PM page seems to be broken... the verification image doesn't show up and the audio data is messed up somehow. So no pms for me. So here we are.

Hey,
I'm having trouble accessing my email account for my account (Slyth2727) in order to reset the password. I cleaned my browsers and deleted the cookie, can't remember the password for either account for the life of me. Any way we can work this out? I know you can't exactly trust a message from a random account but I can give details on the account a rando wouldn't have.
Cheers

 6 
 on: 2018-02-20 02:15:34 
Started by Alletarchus - Last post by Alletarchus
I'm new to JFX, so this question probably has an obvious answer.

When I started my game I was following a tutorial. The source is at https://github.com/AlmasB/FXTutorials/tree/master/src/com/almasb/asteroids.

The developer who wrote it had different objects within the game represented by private static classes declared in the main Java file, each of which extended a single broad "Game Object" class written in another file. When I needed a new method or member variable I added it to this Game Object class to avoid cluttering the inline class declarations in the main file. Eventually I decided that that didn't make sense and it shouldn't be the case that every single game object has various data and methods it will never use. So I started splitting these private classes out into their own files and giving each only what it needed.

As a result, in many of my function calls to various objects, I can't access those methods. This wasn't a problem when these classes were private static classes of the Application.

For example:

1  
2  
Text currentHealth = new Text(0, 20,"Health: " + player.getHealth());
        dataPane.getChildren().set(0, currentHealth);


In this case the IDE lets me attempt to run the program, but when it launches there's a null pointer exception at that first line.

I tried something like:

1  
actionPane.getChildren().get(0).somePlayerClassMethod();


It also doesn't work. Though index 0 of that list definitely is the player object, I can't access any methods related to the Player or Game Object classes (player is both).

I'm just not clear on why moving these classes into their own files made it difficult to access their instantiations' methods. Each of them is a child of a Pane, which may or may not be relevant.

Again, the only thing that seems to have changed is that these classes are no longer private static classes within the Application class. Any ideas?

Edit: fixed typos.


 7 
 on: 2018-02-19 21:40:53 
Started by mudlee - Last post by KaiHH
What you are doing is called "per face" normals. Sure, normals are always assigned to vertices, but you want each vertex of the same face/triangle to have the same normal direction. Therefore, you cannot use indices like you did, because vertices with the same position cannot share the same normal anymore, since the normal depends on the face/triangle that vertex is part of.
That means, we have to duplicate multiple uses of the same vertex position and compute a face normal for all the vertices of the current triangle.
Try this (based on this code, not tested):
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  
27  
28  
29  
30  
31  
32  
33  
34  
35  
/*
 * We have to duplicate same vertex positions
 * because they need multiple normals depending
 * on which face/triangle they are part of.
 */

float[] vertices = new float[] {
  0.0f, 0.0f, 1.0f, // 1
  1.0f, 0.0f, 1.0f, // 2
  0.0f, 0.0f, 0.0f, // 0
  1.0f, 0.0f, 1.0f, // 2
  1.0f, 0.5f, 0.0f, // 3
  0.0f, 0.0f, 0.0f, // 0
  1.0f, 0.0f, 1.0f, // 2
  2.0f, 0.0f, 0.0f, // 5
  1.0f, 0.5f, 0.0f, // 3
  1.0f, 0.0f, 1.0f, // 2
  2.0f, 0.0f, 1.0f, // 4
  2.0f, 0.0f, 0.0f  // 5
};
/*
 * Compute per face normals.
 */

float[] normals = new float[vertices.length];
for (int i = 0; i < vertices.length; i += 3*3) { // <- 3*3 = one triangle/face per iteration
  Vector3f v0 = new Vector3f(vertices[i + 0], vertices[i + 1], vertices[i + 2]);
  Vector3f v1 = new Vector3f(vertices[i + 3], vertices[i + 4], vertices[i + 5]);
  Vector3f v2 = new Vector3f(vertices[i + 6], vertices[i + 7], vertices[i + 8]);
  Vector3f n = v1.sub(v0).cross(v2.sub(v0)).normalize();
  // Assign that normal to all vertices of the current triangle/face
  for (int j = 0; j < 3; j++) {
    normals[i + 3*j + 0] = n.x;
    normals[i + 3*j + 1] = n.y;
    normals[i + 3*j + 2] = n.z;
  }
}

 8 
 on: 2018-02-19 19:49:00 
Started by orange451 - Last post by orange451
Unfortunately JFXGL has speed issues.

Creating about 50 node objects (trees, panes, anything really) brings it down to a crawl on a powerful desktop computer. So it's not useful for practical applications.

 9 
 on: 2018-02-19 16:49:50 
Started by NuclearPixels - Last post by NuclearPixels
Yes I never do, but in this case shouldn't it also accumulate the counts on the PC? Because on PC the counts remain constant after I start the application..

 10 
 on: 2018-02-19 16:22:46 
Started by Jakibah - Last post by DesertCoockie
But if you want to continue using the old immediate mode: you afterwards have to call glEnd() Wink

Pages: [1] 2 3 ... 10
 
xxMrPHDxx (316 views)
2017-12-31 17:17:51

xxMrPHDxx (97 views)
2017-12-31 17:15:51

xxMrPHDxx (148 views)
2017-12-28 18:11:33

Ecumene (320 views)
2017-09-30 02:57:34

theagentd (494 views)
2017-09-26 18:23:31

cybrmynd (531 views)
2017-08-02 12:28:51

cybrmynd (471 views)
2017-08-02 12:19:43

cybrmynd (448 views)
2017-08-02 12:18:09

Sralse (407 views)
2017-07-25 17:13:48

Archive (1314 views)
2017-04-27 17:45:51
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
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!