Ike Gentz

Greenhorn
+ Follow
since Jan 01, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ike Gentz

Campbell Ritchie wrote:Shows that old posts can be useful



Precisely! Hate to start a new topic when one already exists, even if it is old.
7 years ago
Thank you so much!!! I had the registry issue, and I had never encountered it before. I was COMPLETELY baffled when my project would run from the command line but not by double clicking. You really saved my bacon man, thanks again!!
7 years ago
I have this game I am working on and it uses parallax scrolling. The thing I'm wondering is if there is a noticeable performance gap between calling drawImage(Image,x,y,ImageObserver) on a bunch of smaller Images which would make up the background, or calling drawImage(Image,x,y,ImageObserver) on one large Image.

In context, the size of the images would be 1920 x 1080 for if I was making a call and just drawing one large image at a time, v. using maybe around 40 x 40 images, but enough of them to fill up a 1920 x 1080 space. Any insight here on which would be more efficient or what would be the optimal image size : number of images drawn ratio? Thanks
7 years ago
Ignore this post. I found out what was wrong. Silly error
8 years ago
I am currently using drawPolyLine(int[], int[], int[].length) to draw a line representing the ground coordinates for a platforming game. However, the endpoints are leaving streaks when I scroll across the screen. I fixed the one that was at the end by simply using vals.length - 1 (for the length of the array) instead of vals.length

I know for a fact that both the arrays I am passing in for coordinates, xVals and yVals, are the same length. I am wondering why the first point leaves a line behind as it scrolls.

Here is a picture showing what is happening Problem Picture

You can see that the very first point left a streak (Sonic was falling downwards, which is why the streak goes down).
8 years ago
After trying literally everything I could think of I ended up giving up on the JMF. However, I am actually glad that I did it now because I was instead able to write (well, smush a couple examples together. ) a video player in JavaFX that runs through Swing instead! It is much better than JMF too... better formates, resolution, you name it! However, I did run in to one slight little problem I was hoping for some help on. This problem is not nearly as strange though I don't think.

So here is the code for the video player, and it includes a main method in there for a test example.



Now, when I was working on this on my laptop, it worked perfectly fine! I even built it into a JAR and distributed it to some friends, who all reported it worked for them as well. However, when I came home for the weekend and put it on my main rig, it wouldn't run. I keep getting this error...



Now, I can hear the audio from the video play, but it seems to be something with the graphics. I have never used JavaFX so I am looking for a bit of help figuring out why it runs for everyone except me. :-/

Also, on my laptop I have the most up to date versi nof Java. I use the 32 bit version on there. On my main desktop that is having issues, it is the exact same OS (Windows 7 64 bit) and I also have the 32 bit version of Java. I even checked Oracle and made sure everything was up to date, both my JDK and JRE. I feel like it's not anything related to the OS, as this error seems code related to me, but I just need some help because I have never used JavaFX, and this is the last part of my big Swing project I need to get working. It's just wierd it works on practically every machine I try, except my nice desktop.
8 years ago
Yes, I have everything set up according to that description. This is what the filepath looks like...

X/Y/Z/dist/(Sonic Game.jar as well as lib), then inside lib I have jmf.jar.

I as well read about the other jar's as well, such as mediaplayer and sound. I tried adding these (as well as every other JAR that comes w/ JMF) in the same way as jmf.jar, but it did not change anything.
The only thing that seems different is the JMF.properties file.

I went and found this article... Jmf Properties. I did these instructions from that article...

I was able to successfully get Clean and Build to automatically add in the jmf.properties file at the same level as my JAR within the dist folder. (I added jmf.properties to my lib folder and then did what the instructions in the link said, using the one located there). Now each time I build the project I am able to see the properties file in there along with the JAR, however when I run the project from the JAR, I still get the same results.
8 years ago

Presumably you aren't using Netbeans to run this jar file, though. So anything you wrote there about Netbeans could be considered irrelevant or even misleading



Ooh, sorry about that, I wasn't very specific. What I use Netbeans for is writing the actual code, and from within Netbeans is where I added jmf.jar to the project's libraries. Then I clean and build from Netbeans to create the executable JAR. When I run the project from Netbeans (Shift + F6), that is when everything works. When I run the executable JAR that is generated from 'clean and build' I use both the methods of simply double clicking, as well as running it from the command prompt to ensure that I get the same results, and this is when anything relating to the JMF doesn't work, but the rest of the entire game goes off without a hitch still.

You need to look at what is actually in the jar now. Your command line argument, which I assume was the arguments for the "jar" command, doesn't appear to include your code in the jar. So have you looked in the jar? Are your compiled classes in there? And does it contain a manifest with a line which says "Class-Path: lib/jmf.jar"?



I actually ditched using that command line argument a while ago, as it seemed to do nothing different than manually adding jmf.jar into the libraries in the first place from Netbeans. Also, I actually am able to run the entire game from the executable JAR that is generated, it just won't play the videos form the JAR. If I extract the JAR that is generated, I have all the packages with my compiled .class files in there. The manifest file is also located under "META-INF" and does contain the line "Class-Path: lib/jmf.jar"

You did bring up an interesting point I am a little confused on however. So, when I look in the 'dist' folder for the project after 'clean and build', in there I have my JAR (which is the one I exctracted for the above example). There is also the "lib" folder in there, which contains jmf.jar, that seems to be automatically generated when I clean and build. On the autogenerated README for the project it says that you can zip up the 'dist' folder for distribution, so I was assuming that the 'lib' folder being added at this level meant it was working, but does it need to be put in the JAR itself somehow? I'm still 17 and all this is a little new to me. Been learning from the internet until I can get into college. :-/

Thanks.
8 years ago

Paul Clapham wrote:Is JMF a separate jar which is part of your classpath? If so, how did you run your jar so as to include that JMF jar in its classpath?



What I did was create a 'lib' folder in the project's main folder, on the same level as 'dist,', 'build', etc... and placed the jmf.jar in there. Then in Netbeans, I went to the libraries node and added the jmf.jar located in the lib folder I just created, for all five categories. (processor, run, etc...) I assumed that this was all I had to do, as once I had rebuilt the project my manifest folder then would show a new 'lib' folder being created under the 'dist' folder, with the jmf.jar in there. I knew that it was reading from that JAR because I was able to still continue coding on another machine that didn't have JMF installed. However, when I would run from a JAR I still got just a blank screen and the command prompt telling me "NoPlayerException. Could not find a player for... //video file"

I then looked into it a bit further and found that there was a command line argument you could pass in to specify a custom manifest file. I created a custom one that was exactly the same as the one Netbeans auto-generated, including "lib/jmf.jar" on the classpath. Here is the command line argument I used...



However, this seemed to have no effect and the project still did the same thing.

I feel like I am just missing some other small file or something, like a .dll for Windows? (I am using the Windows Performance Pack of JMF), because if I open the videos I'm trying to use (which I looked up and converted to MPEG so they would work w/ JMF) through JMStudio, they play just fine.

Thanks for reading. :)
8 years ago
I have a game that I built, it is done. I just want to play a simple video for cut scenes and such, that's all. I used the JMF for this, as it seemed simple. I was able to build a video player pretty quickly with some basic internet tutorials about JMF, and it works beautifully... from Netbeans. However, when I build my project into an executable JAR file, anything related to the JMF refuses to work. Yes, I did add 'jmf.jar' to the project's classpath, and Java seems to recognize it, but it just doesn't work! It's always blank. If I run it from the command prompt and print the error, I get this...



All I want to know is why I am able to play this exact same video from JMStudio perfectly fine, but when I try to use it in my project it will not work. I have been looking around the web 24/7 it seems just to get it to work and I feel as if I've tried everything short of asking on the Ranch. I have had this project done for 3 months now and haven't released it simply cause I can't get the darned videos to play from a JAR. If JMF isn't the answer, is there another way to play videos in Java easily? I looked into FMJ already but it does not seem to like 64 bit operating systems, and is also suffering from lack of updates like JMF. I honestly just want the simplest way to get a video to play from an executable JAR file, nothing more.

Here is the code for the VideoPlayer just in case..



Thanks for reading.
8 years ago
Also I just wanted to note that if it is not possible to add the video / the JFrame containing the video to the Grahics object, is there a way to simply display the JFrame OVER the graphics? I already set it to "alwaysOnTop" but I believe this only applies to other SWING components and that is why it does not work.
8 years ago
Hi, I am a greenhorn myself, but I just wanted to say that game development takes MUCH more than you would think. I took AP Comp Sci (which teaches Java) 2 years ago and have been working on a Sonic game ever since. I am about 50% done w/ the engine at the moment, but this is two years later! I think it is really cool that you want to create a game in Java, but you really need to spend more time learning more specific things in Java, such as Graphics. I mean, even if you are able to store your level data you still need a way to play it. For things such as this, I would recommend some video tutorials. There is a very good one on TheNewBoston.org that goes over everything in Java you would need to start running your game. From that point, you can start building your game specific elements like levels and gameplay. Sorry to sound discouraging, but just a tip I would recommend after my 2 year efffort so far is to do some tutorials like this one, then start building the game itself.
8 years ago
Hi, I am currently building a Sonic game and the main game itself is mostly done. I run it all through a Graphics2D object and it all works fine. However, I realized that I wanted to add in video capabilities for certain screens and cutscenes, because it is much easier to show one video than storing a ton of animations in memory. Anyways, I have installed and got a video player working through JMF (Java Media Framework). When I run it by itself, I simply create a new JFrame and add the video player to it, which works great. However, during my game, since it is constantly updating the Graphics2D object and repainting, it always paints over the video when I run it. I would like to know how to add the video player directly to my graphics object (similar to how I use drawImage() ) for drawing animations and things, so that the video plays in the graphics object instead of under it, and can be treated similarly to the rest of my graphics on the screen.

Here is teh VideoPlayer class that I have taken from JMF and tweaked for my needs...



Also, here is the class which creates the main loop for the game...



And finally, here is the ScreenManager class which is referenced from the Core class.



//a lot of the code in these core classes were taken from a tutorial on TheNewboston.

So anyways, my game runs fine, I have graphcis, music, the works all in it and it is playable. I just need a way to play videos during the game w/o them being painted over by the Graphics object which is drawing all the other stuff. Thanks
8 years ago
Well, after spending a good 3 days straight working on this I managed to stumble across this page...

http://www.vbforums.com/showthread.php?595275-RESOLVED-Images-embedded-into-JAR-file
Not sure how my countless prior Google searches did not come up with this but nevertheless this was pretty much my exact problem (except for the spelling issues). All I gotta do is rework my ImageHandler, AudioPlayer, and FileHandler classes to create a URL and have whatever class is using it use that instead. It is a shame though this beautiful, elegant, lovely code I constructed and have been using for this project for a year now needs modifications but oh well, they are small and easy to do, just a little tedious going through each adn every place I use these classes on my pretty-much-ready-to-distribute game. Oh well..

Anyways, I seem to have resolved my own problem. Sorry to be any inconvience.
8 years ago
Hi all,

I have a Sonic game I am in the process of building and must say it is coming along quite nicely. I've got everything up and running, except for this one little issue. Now, my friends who are helping all have a Java IDE of some form or another and are able to simply open the project in thier IDE and handle things form there. However, now that the game is nearing completion I must start thinking about distribution, therefore I thought to myself "Well, the easiest way is to pack everything in an executable .jar file and BAM! Double click and enjoy the game". However, whenever I generate the exec .jar by doing a clean and build in Netbeans, it generates the .jar, I go to the dist folder and double click to run, but none of my files appear, just the blank JFrame without any graphics or sounds.

Now here is the interesting thing...
I went back to a previous version of the project where my filepaths I passed in to my "Artist" class (class I wrote methods in for handling images and sounds) are all pointing to specific places on my hard drive. However, yesterday I went and added all my files to a "Resources" folder on the same level in the project directory as the dist, build, src, etc... folders. When I call my filepath now instead of something like "C:\\Users\\Ike\\Sonic Game\\Pictures\\Sonic_Running.png" I am able to simply call something like "Media\\Images\\Sonic_Running.png" and all is fine and dandy when running it from the IDE. BUT... then I try and build this executable .jar file and all my hard work vanishes into a blank JFrame when I run it from the executable .jar despite still running fine within the IDE.

Here is a video I made detailing the problem...
http://www.youtube.com/watch?v=0L1XYmbCLV0&feature=youtu.be

If you could write out some step by step directions for how exactly to get the project to run from the executable .jar file I would really appreciate it, as well as a bunch of people on the internet looking foward to this game. Thanks
8 years ago