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   
  Show Posts
Pages: [1] 2 3 ... 53
1  Game Development / Networking & Multiplayer / trouble reading from a NodeJS URL on: 2018-02-26 01:25:15
A JSON file of Motion Capture data is being broadcast from a URL powered by a NodeJS package called WS.
https://www.npmjs.com/package/ws

I've been given the URL and Port. I'm able to connect a Socket: socket.isConnected() returns true.

When I try to create an InputStream and an InputStreamReader, the isReady() function of InputStreamReader returns false. Attempts to read a single int hang.

I also tried DataInputStream just to see if there was anything and available() function of DataInputStream returns false. Attempts to read a single int hang.

I'm new enough at this that there could be something really basic that I am missing. Any thoughts? Also, I am at a loss as to how to proceed to troubleshoot this.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
      Socket socket = new Socket();
      InetSocketAddress socketAddr = new InetSocketAddress("192.168.1.189", 9100);
     
      socket.connect(socketAddr, 10_000);
      System.out.println("socked connected:" + socket.isConnected());
      System.out.println("             URL:" + socket.getInetAddress());
      System.out.println("            port:" + socket.getPort());
     
      InputStream inRT = socket.getInputStream();
//      InputStreamReader isrRT = new InputStreamReader(inRT, "UTF-8");
//      System.out.println("ISReader is ready:" + isrRT.ready());
//      int n = isrRT.read();
     
     
      DataInputStream disRT = new DataInputStream(inRT);
      System.out.println("DIS available:" + disRT.available());
      int n = disRT.readInt();
      System.out.println("n:" + n);
     
     
      socket.close();


Output:

1  
2  
3  
4  
socked connected:true
             URL:/192.168.1.189
            port:9100
DIS available:0



An elaborate work-around might be possible. It would involve tapping into the broadcast from the application that reads the MoCap data (Axis-Neuron). I can read data from this application if the motion data is sent out as text, but another user needs the data broadcast as binary, and only one broadcast is available. To use the binary, I would have to find and code from a spec--which maybe will be necessary if I can't connect to the location streaming the JSON data.
2  Game Development / Newbie & Debugging Questions / Re: JavaFX: How do I access the methods of an object owned by a pane? on: 2018-02-20 05:03:14
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.
3  Discussions / Miscellaneous Topics / Re: Is My Portfolio Frighteningly Underwhelming? on: 2018-02-17 00:59:23
Code reading is hard. Very few are going to attempt it. I can easily imagine a situation where a company is hiring to fill a need and they don't have the internal expertise to evaluate code that might pertain.

Recruiters are kind of pesky and rarely coders. If they could actually code, they'd probably be doing that rather than recruiting.

The code you write and present on GitHub is still important, though. And it can lead to work opportunities if the library is one that people actually download and use.
4  Java Game APIs & Engines / Java 2D / Re: Java2D game loop stuttering on: 2018-02-11 02:38:12
The way the code is written we could have either of the following two scenarios (depending upon the values of unprocessedTime and _updateCap):

  • multiple tick() calls without intervening render() calls
  • multiple render() calls without intervening tick() calls

Could this cause the stuttering? Seems like that would be the likely result if the two need to alternate in order to preserve continuity.

I'd try moving timing stuff to after the update and render. They should just be run directly in sequence unless there is a good reason not to.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
      while (this._gamePanel.isRunning())
      {
           tick();
           render();

           timeDiff = Systerm.currentTimeMillis() - beforeTime;
           sleepTime = PERIOD - timeDiff;   // I would imagine  PERIOD = 16 for just slightly better than 60fps?
           sleepTime = Math.max(sleepTime, 1); // even if lagging, sleep a little
           Thread.sleep(sleepTime);  // will need to be in try/catch or add exception handling
           beforeTime = system.currentTimeMillis();
      }

This code is slightly modified from "Killer Game Programming".

I happen to think using a util.Timer or an ExecutorService (even better is the AnimationTimer provided in JavaFX) is the best way to go in terms of setting a steady FPS for a "game loop" rather than manually handling sleep times. But a lot of people will disagree, and there is no need to argue about it. Just do what works.
5  Discussions / Miscellaneous Topics / Re: What I did today on: 2018-02-08 08:40:13
Been cramming Java Networking the last few days. My knowledge of the subject prior to this would have to be described as rather shallow. Had to buckle down and read, from the beginning, taking notes as if there was going to be a test, the first four chapters of this online text: Java Network Programming, before I was able to start skipping ahead to the stuff needed for this particular networking task.

A goal was achieved today: I coded a Java Socket that reads motion capture data being broadcast from an application called Axis Neuron. This is the tool/gear being used by KineTechArts (Meetup group of collaborating techies and dancers). The Axis Neuron program has broadcast capabilities. I was able to hook into its broadcast via an InputStream, receiving space-delimited, BVH format Strings.

Next step, parse the data (X, Y, Z, X-rotation, Y-rotation, Z-rotation) to the individual bones. Looks like there are a couple dozen sensors and the data is incoming roughly at 60 fps, but I don't know specifics on frame rates or capabilities yet. I was just thrilled to get readable data after a couple days of thrashing ignorantly and at best getting 501 error messages.

Next, next step: filter the data for use as control lines for various parameters of audio tools that will respond to the dancers' motions.
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2018-01-25 19:48:05
Last night, somewhat nervously showed off some of my Java audio to a Meetup group (Kinetech Arts, a group of dancers and techies interested in collaboration). Response was pretty enthusiastic. A favorite was the Shepard Chord, and the group did an improv with me running several Shepard Chords as sound accompaniment.

Coolest thing: several of the members are very strong developers, for example, working in data visualization field and with web coding. They are motivated to help with getting data from dancers (with wearable devices that track positions of hands/feet/etc, or even if just carrying phones) to my applications so that the applications can alter the sound output in response. When I was coding these Java tools to be on a scale that allows them to be responsive to "game state" I definitely had in mind the goal that could also be used live with incoming data streams as well, and was hoping some sort of collaboration like this would be possible.

It was a gamble, trying to focus on coding good sounds and leaving interconnection issues for later. One person only has so much bandwidth. Glad/relieved to find that others with complementary/needed skills are motivated to collaborate.

The day had some good coding results as well. I continue the long slog to make an application called "Tone Circle Drone" ready for commercial release. One of the issues has been trying to manage a JDialog/JPanel popup written for "Options" handling. Slowly, I had been figuring out how to deal with its position (keeping it relative to the main application when main was being dragged), and with not remaining "on top" when leaving app to look at web browser. The last straw was when I realized that the popup had its own slot in the Windows "Alt-Tab" list of running applications. At this point, I remembered the "CardLayout" and recoded the Options panel as a "card" that appears over the Main panel "card".

All behavior problems solved. Lots of code discarded(e.g., WindowListener, ComponentListener no longer needed). That combination is one of the most satisfying to have as a coder.
7  Java Game APIs & Engines / Java Sound & OpenAL / Re: How do I get frequency data from a .WAV? on: 2018-01-04 19:09:58
An excellent, free resource for learning about the FFT is the following eBook:

Scientist and Engineer's Guide to Digital Signal Processing

It starts with the basics, and also contains excellent info about various filtering methods.

The code examples are in BASIC, so you would have to get your Java implementation elsewhere, or build on from the BASIC examples. Perhaps someone at JGO (@nsigma?, @Catharsis?, @ShannonSmith?, others?) has a recommendation or code to share?

It you have difficulties with any part of the text, I've found that a good place to ask questions is the
Signal Processing section of Stack Overflow.

[When asked earlier in a PM, I recommended the OP make a public post, so anyone else that has a similar question could use the answers provided as a reference. We are also requesting this thread be moved to the Java Sound section, if that is not too much trouble.]
8  Discussions / General Discussions / Re: HappyNewYear! on: 2018-01-01 14:42:42
I failed on my first resolution made at the start of 2017: to complete Hexara.

I wrote a web article and it was published on the Georgia State University HyperPhysics site (about acoustics/physics of the oboe).

I managed to write and post AudioCue to help with coding sound for Java games.

Worked on various sound ideas, such as a wind-in-ears affect where the turbulence hits the two ears at different times depending on the direction the head is turned relative to the wind, and a program that slices and reassembles thunder samples to make unique thunder occurrences. The latter could use some improvements still.

Installed and got somewhat familiar with Unreal and basics of C++, but unfortunately the project/person that this was for didn't pan out. Learned a fair bit in process, can count it as "perspective".

Started taking JavaScript/HTML/CSS more seriously (working through web courses) and learning AFrame for doing WebVR. Unclear if the funding on this project is going to stay afloat or not. Learned enough that I have written a web app where you can jump around between various 3D/panoramic photos taken in and on the USS Hornet.

Am closing in on completing "Tone Circle Drone" in Java which I am targeting for being my first published commercial software on itch.io.

So, maybe even if the main resolution from last year was a bust, some useful stuff was accomplished. Even so, there always seems to be the feeling of spinning wheels and lack of traction. Maybe that has mostly to do with barely even achieving "ramen success" with all this, financially.
9  Game Development / Newbie & Debugging Questions / Re: Panel - Redrawing panel didn't seem to be working! on: 2017-12-28 20:55:43
If I understand what you wrote, it works with a single image, but not as a loop.

Have you stepped through the loop using a debugger?

Sometimes when loops seem to be where things break down, there is a problem such as the same object being used multiple times when you think you have a unique instance. This sort of thing usually pops out really quickly as an issue when you step through and verify the contents of the variables.

When I was doing graphics with Swing, I would normally use the Graphics2D object provided by the JPanel's paint or draw method (can't recall exactly which it was). When drawing images contained in other classes, I would provide that Graphics object to those images as a parameter, so everything gets drawn on the same Graphics object. It's just a thought, but if you are drawing to different Graphics objects, that could cause some confusion. Pure speculation on my part, and it doesn't account for a single image working but looped images not working.
10  Game Development / Newbie & Debugging Questions / Re: Panel - Redrawing panel didn't seem to be working! on: 2017-12-27 22:11:13
[Editorial comment: This would be so much easier to do with JavaFX, the newer GUI for Java. You just update the location properties of the items involved and drawing pretty much takes care of itself. It kind of hurts my head, trying to remember all the rules pertaining to managing redrawing with Swing.]

For those looking at the above code, it's helpful to know that at least some of it is quoted code is from here.

Also, the two classes mentioned are both extended JPanels.

I recommend to the OP trying to make a more simplified example that illustrates the problem, as a way of increasing the odds of getting a good solution (or finding one in the process).
11  Game Development / Newbie & Debugging Questions / Re: Mouse directed attack with 4 possible outcomes and animation based on attack. on: 2017-12-21 20:37:11
Slightly more compact form. Not sure if this makes intention clearer or not. For this sort of thing, performance differences are minute compared to the impact of code on readability, so coming up with easiest form for reading 6 months from now (i.e., "after you have forgotten what the code is doing") should be the priority.

    if (angle < -135) rightSlash()
    else if (angle < -45) downSlash()
    else if (angle < 45) leftSlash()
    else if (angle < 135) upSlash()
    else rightSlash();
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2017-12-20 22:20:35
Just swapped in OpenSimplexNoise for Gustafson's SimplexNoise implementation, for the few spots where I am using 3D. Thought it might be a good idea to test/do this before making the program commercially available.

It didn't noticably impact processing speed.

The animated clouds that resulted were a bit more soft-textured than before, but the softness is actually kind of nice. I made a slight adjustment mixing the higher octaves to greater relative amplitudes, and increased the increment which I am using to transverse through the space. It looks good.

I'm happy.

[EDIT: made a little video demo of the effect. But the result is kind of blurry. Didn't realize we couldn't go full screen--I should have made it larger. Video starts with a slow drone using a common tanpura pattern, and a night sky background. Then I switch over to the day background and load a more complex loop. I'm not attempting to show off any of the intonation-modification aspects in this vid. Just some twinkling stars and floating clouds.]
<a href="http://www.youtube.com/v/KDDi2D3yeYU?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/KDDi2D3yeYU?version=3&amp;hl=en_US&amp;start=</a>
13  Discussions / General Discussions / Re: would any of you guys be offended if on: 2017-12-06 05:04:21
just watched osakuros video trailer for "Fist of Jesus"

for some reason, I was reminded a bit of this one:<a href="http://www.youtube.com/v/I-hYq3Y9IoU?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/I-hYq3Y9IoU?version=3&amp;hl=en_US&amp;start=</a>
14  Game Development / Newbie & Debugging Questions / coming up on being ready to deploy a project on: 2017-12-05 20:49:09
I'm coming up on being ready to deploy a project (audio-based, a drone tool I started years ago, has undergone many GUI and performance improvements).

I know I've seen advice and links here about how to include a JVM in the file. I even tried out one of the tools ('jarsplice') years ago. Summary of what I found via doing some searching here:


Also came across the following from Oracle:
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
and javapackager

Was also checking around for anything Eclipse-based.

I'd appreciate hearing current suggestions for ways to distribute via itch.io that include the JVM.

Code makes use of Swing not JavaFX. Otherwise, nothing too fancy involved, just Java 8.

Before diving in too deep to these various articles, it seems like working with JarSplice will do the job. Do others agree? Seems like trying that should be my next step.

Thanks!
15  Java Game APIs & Engines / Tools Discussion / Re: Library for making games in java easier. on: 2017-12-05 06:49:01
On the theme of making games easier to program with Java, you might be interested in incorporating my GitHub project: AudioCue. The simplest use case is very similar to what you have.

    AudioCue cue = new AudioCue(url, n); // n=number of instances allowed that can play concurrently
    cue.open();                                       // allocates default resource, after which cue is ready to play
    cue.play();                                        // simplest way to play a cue, using default vol, pan and freq
    cue.close();                                      // deallocates resources, use when cue is no longer needed

The code helps make game-audio easier to code in additional ways: can play sounds back concurrently, and at different speeds, can also change volume, panning or pitch in real time, and can send messages to AudioCueListeners in the graphical or game-logic portions of the project. These capabilities are often useful in game audio, and can be quite a headache to implement with Java's Clip or SourceDataLine.

License is BSD. If you bring it in (there are just three classes and two interfaces involved in this library) it would be nice to have a link and credit for the code I wrote.

Good luck with your project!
16  Game Development / Newbie & Debugging Questions / Re: Newbie to Game Development on: 2017-12-02 07:36:28
Hi and welcome!

There are resources listed via a Java Gaming Resources link that is just under the Logo on the top left. That section hasn't been updated in a while, though.

I'd like to plug my tutorial Getting Started with JavaFX Game Programming. With JavaFX, the "game loop" structure is somewhat simplified as the loop timing (maintained at 60fps) and rendering are handled pretty much automatically. Coding mostly involves game logic and manipulating properties. I also like that the coding is closer to being able to take advantage of tech like CSS, given JavaFX's FXML.

We have many other good tutorials in that section (Game Development/Articles and Tutorials), like Eli Delventhal's Game loops! I remember that was helpful when I first started out about 8 years ago. The older tutorials will often be AWT, Swing, Java2D which are becoming more and more "legacy".

And the Wiki area is worth exploring.

Mostly, though, if you have a question, someone here will probably be able to steer you to something pertinent and helpful. Or else they will steer you to something that they are passionate about but which may be tangential. (I've been guilty of this, too.) Such is the nature of public forums!
 Cool
17  Discussions / General Discussions / Re: Gosh, it's quiet in here on: 2017-11-14 17:46:07
Quote
I got the dump imported into MySQL.

That was my thinking when I started inspecting the data, to load as many tables as possible into MySQL and go from there. The tools I have for inspection are not so hot: e.g., Notepad/Wordpad! Advice on a better way to inspect the dump would be appreciated.

Quote
After spending two hours to understand the tables and relations, wrote a script to migrate the categories and boards. The current output is like this:

Is this the view from within Flarum? (Is there a consensus that Flarum is a good target? Or a good intermediate step to something else?)

Looks good! I can see that the GUI should work well on small display screens.

The only thing I'm wondering about is the sub-categories at the bottom and how they relate to larger blocks.

I did peruse the dump file a bit, but was slow on the trigger to download MySQL, and haven't downloaded Flarum yet either. I'll do so, if we are going in this direction.
18  Game Development / Performance Tuning / Re: Simple way to show quickly-changing values on: 2017-11-13 16:14:58
You can use a timestamp and test for elapsed time before updating the JLabel.

If this were more than just a test, I'd consider polling the value from the game loop rather than using every change, unless you need to know each step.

For example, for a 2D area used for a virtual Theremin (y-axis = volume, x-axis = pitch) I poll the mouse position from the game loop rather than allow the mouse movement listener to drive the updates. The mouse is restricted to updating local variables which get checked by the game loop for current value. The synthesizer, upon receiving the new values every 16.6 millis or so (60fps), instead of sporadically and in clusters, employs smoothing based on the known time increment between updates. This works well. But of course it may not fit the requirements of your particular needs.
19  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-12 18:27:46
Would love to see (tutorials):

Getting started with game programming with Clojure
Getting started with game programming with Kotlin

and make both oriented for Java programmers.

Get a basic game loop going, and bounce a ball, with keyboard/mouse interaction (as I did with JavaFX).

Learning Clojure was very fun and weird. When I was looking at it, I also went through the first few MIT Structure and Interpretation lectures, and recoded them with Clojure. This was my first introduction to LISP-type structures and programming patterns. It is great help for getting your head around operations using function interfaces in chains. But I didn't see it through to where I could figure out how to make a game with it.
20  Discussions / General Discussions / Re: FXGL (JavaFX Game Library) looks like it's coming along nicely on: 2017-11-10 19:51:52
Neat!

Instead of hassling people interested in game engine work, telling them they should make games instead, we can direct them to consider contributing to this project?

I haven't checked it out, yet. Was compelled to write a bit of snark first.   Cranky
21  Discussions / General Discussions / Re: Gosh, it's quiet in here on: 2017-11-10 19:43:31
Maybe the Forum could draw more attention as JVM-Gaming.org  persecutioncomplex

That is an interesting idea. From the Kotlin thread, I was afraid we were going to provoke a new kotlin-gaming.org and it would be yet another brain drain from java-gaming.org.

A jvm-gaming does appeal to me, as it is inclusive. The concept of jvm gaming can also exist under the title or name Java-Gaming, can't it?

Yes the minecraft surge has probably peaked, but Java is still taught in high schools and colleges all over this country, and remains #1 on Tioga. This should remain a strong source for new members, if we are set up to welcome them.

Then, part of the process could be that many might go from first making a "pure" Java game to advance to something like Kotlin or libjdx. It would be great to have that path made clear and hassle-free/harassment-free. In that sort of structure, I see my role as someone more focused on the new-comers as well as on audio tools. But I'm happy to see folks grow into libgdx or Kotlin or whatever.

As far as "drawing attention," isn't the main way that people find us come from our existing forum content that is pertinent to searches being made? The content has to remain, doesn't it, for the forum to be visible, doesn't it?
22  Game Development / Performance Tuning / Re: for loops on: 2017-11-10 19:23:40
Question: didn't @Riven once publish a structure that optimized for contiguous memory for objects? "MappedObjects"? Was there a preferred iteration process involved? Is that approach still considered useful? At the time it came out, it was a bit over my skill set, and I wasn't able to learn the lessons it provided.
23  Java Game APIs & Engines / JavaFX / Re: Off screen rendering, drawing images onto themselves and other shenanigans on: 2017-11-09 01:01:10
Quote
It's maddening that all that seems to be requires is:

WriteableImage.getGraphicsContext()

Is this something that can be requested from these folks?
http://mail.openjdk.java.net/mailman/listinfo/openjfx-dev

Where does one go to request something like this?
24  Game Development / Newbie & Debugging Questions / Re: Importing 3D models to javaFX Group on: 2017-11-09 00:12:02
I just took a look at the stackoverflow link you gave.

That answer loads directly from an STL file. No need to do the conversion, as I outlined.

It has a complication in that it loads to a Mesh object which is not a Node. To get the data into a JavaFX node, the Mesh is loaded into a MeshView, which is a subclass of Node.

It might be a bit tricky to set up the data in the Java project correctly, but this solution should work fine, and should display the textures, too, if you include them in the project.

25  Game Development / Newbie & Debugging Questions / Re: Importing 3D models to javaFX Group on: 2017-11-08 23:46:24
Step 1: convert model to fxml.

You can do this using the app that is downloadable from here. I had no trouble getting this app to run on my Windows system--it was just a matter of extracting all and clicking the .jar file enclosed.

The export control should be easy to find. I loaded and then exported this 3D model of the Hubble.

Step 2: put the exported .fxml and texture files (in this case, .bmp) into your Java project.

I used a simple, flat directory structure:
graphics_example
       FXML_Example.java
       hbltel_1.bmp
       hbltel_2.bmp
       hbltel_3.bmp
       hbltel_4.bmp
       hbltel_w.bmp
       hst.fxml

Note: the texture files come packed within the download zip file from NASA. When the .fxml file was generated, url references to these textures were embedded. I made no edits to the .fxml file. It is very large.

Step 3. Following is a simple class that should load and display the model. (Note, I didn't implement any camera movement, so the viewpoint is fixed.)

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  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
package graphics_example;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.AmbientLight;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.PointLight;
import javafx.scene.Scene;
import javafx.scene.SceneAntialiasing;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class FXML_Example extends Application
{
   public static void main(String[] args)
   {
      launch(args);
   }
   
   PerspectiveCamera camera;

   @Override
   public void start(Stage primaryStage) throws Exception
   {
      Group root = new Group();
      Scene scene = new Scene(root, 1000, 600, true, SceneAntialiasing.BALANCED);  
     
      camera = new PerspectiveCamera(true);
      camera.setTranslateZ(-700);
      camera.setNearClip(0.1);
      camera.setFarClip(3000.0);
      camera.setFieldOfView(60);
      scene.setCamera(camera);
     
      // ADDING A 3D Model via FXML
      FXMLLoader fxmlLoader = new FXMLLoader();
      fxmlLoader.setLocation(this.getClass().getResource("hst.fxml"));
      Group graphic = fxmlLoader.<Group>load();            
      root.getChildren().add(graphic);      
   
      PointLight light = new PointLight(Color.WHITE);
      light.setTranslateX(0);
      light.setTranslateY(-3000);
      light.setTranslateZ(-1600);
      root.getChildren().add(light);
     
      AmbientLight ambiance = new AmbientLight(Color.WHITE);
      root.getChildren().add(ambiance);
     
      scene.setFill(Color.SKYBLUE);
     
      primaryStage.setScene(scene);;
      primaryStage.setTitle("3D Model from FXML");
      primaryStage.show();
   }  
}





@elect alerted me to this GitHub project, called Java Open Asset Import Library which may be a good alternative. Check with @elect for more info on that!
26  Game Development / Newbie & Debugging Questions / Re: Importing 3D models to javaFX Group on: 2017-11-08 03:45:43
I'm not able to recreate the situation from your explanation. How does one load an STL file from your link? The only download button I see outputs a PNG. It will help me if you spell out your steps more completely.

My first test was the following:

I downloaded the "JavaFX 3D Model Browser" from this page.

I then downloaded the Hubble Space Telescope from here.

jimModelBrowserJFX-0_4_1.jar ran without complaint. I was able to load the Hubble data file with no problem and am tooling around it on another window right now. The Hubble file is named hst.3ds.

I'm going to play around with this a little more, then see if I can find an STL format file to view.

********

I was able to download and load a .stl file in the JavaFX model browser, this one from the Hubble.

I was also able to download and view, in the browser, the "Cylinder Head" on this page.

In all cases where the data was not fxml to begin with, there was an option to export the data to an fxml file. I was able to view the export-created fxml files without a problem.

********
It looks like this page has models in several different formats to try out.

********

Main issue, then, is perhaps how to load these models in a java program? Working on that now.

OK, the following basically worked, as far as pulling the graphic into a Java program:

1  
2  
3  
4  
5  
      FXMLLoader fxmlLoader = new FXMLLoader();
      fxmlLoader.setLocation(this.getClass().getResource("hst.fxml"));
      Group graphic = fxmlLoader.<Group>load();    
       
      root.getChildren().add(graphic);


A couple things:

> I got the hst.fxml file by exporting the hst.3ds file mentioned earlier from the ModelBrowser.

> The import in this case was to a Group object. Not all loads do this. Another example I tried loading had to be loaded into a TriangleMesh. Then, the TriangleMesh had to be loaded into a MeshView. Another example loaded to a MeshView. In each of these cases, the code above has to be modified to account for the object type being specified in the .fxml file.

> My controls for lighting and keying the camera around are rather clumsy and I don't have a good example yet. If I get a nice clean example, I'll post it. But you are going to have to be on top of things like positioning the camera and the object to where the object can be seen, as well as handling light.

I hope this helps somewhat.
27  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-08 00:03:05
Standard Operating Procedure, for me:
1) try various approaches
2) pick best
3) test choice occasionally against variants, go back to 2.
28  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-07 23:15:11
Very nice to hear AudioCue works with Kotlin!

I'm wondering if this means that Kotlin's interop with Android means that AudioCue can be used with Android via Kotlin? There are basically just a couple IO functions (SourceDataLine and AudioInputStream) that rely on the javax.sound.sampled. Everything else in it is vanilla Java. I was assuming that for AudioCue to work with Android, it would be a matter of recoding the two IO points, and accepting the higher latencies that come with Android devices.

Suggestion that I might be afraid of change or stuck with ingrained practices is kind of hilarious. I hadn't even see my first line of Java code until into my 50's, something like 8 years ago.
29  Discussions / General Discussions / Re: Move to Kotlin? on: 2017-11-07 20:04:25
Maybe because I am "old" I very much appreciate @princec's take on variable types. There may be a few situations where the use would be benign, where the type doesn't matter and thus having to specify it is, indeed, "noise." But I think it is legitimate to worry that the feature will be abused and overused.

I am reminded of the old saw "a place for everything and everything in its place." Drives kids nuts, and for good reason: they are much more capable of remembering where everything is and don't see the motivation. Since they are pretty much bounded to a smaller area than adults, it is much easier for them to keep track of things.

With age and increased responsibility, the amount of information that you can or care to clutter your head with gets much smaller. It definitely adds to the cost of context switching, with trying to move between multiple projects.  Carrying trivial crap around like what the dang variable is or isn't is an aggravating nuisance. It's like having to continually stop for commercials when you just want to watch your movie. I am now experiencing the so-called joys and freedom of *var* with the JavaScript/VR project I'm working on, and am finding it a considerable annoyance with both debugging and with code-reading libraries and examples.

What is the term? Ah, here it is: technical debt

[EDIT, restatement of the controversy in terms of cognitive activity: is it more or less burdensome to mentally block out a bit of redundant "noise" than to carry additional facts in working memory? ]
30  Game Development / Newbie & Debugging Questions / Re: Importing 3D models to javaFX Group on: 2017-11-07 04:19:23
On first pass, it looks to me like the library you found is quite cool and should work as you are hoping it will work. Have you tried downloading it and running any of the models? I'd be very surprised if the imported model did not have it's own root node that is attached to the JavaFX node-based structure.

I'd like to give it a try, also. I'm very curious about this aspect, and want to know more about it. I'm also wanting to learn about importing 3D Models in the JavaScript world--using a VR/AR framework called AFrame. I suspect there will be some overlap as far as the tech goes. Maybe between us we can write a quick-easy tutorial for the next person who want to give it a try.
Pages: [1] 2 3 ... 53
 
xxMrPHDxx (355 views)
2017-12-31 17:17:51

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

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

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

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

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

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

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

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

Archive (1349 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!