Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (580)
Games in Android Showcase (162)
games submitted by our members
Games in WIP (632)
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 ... 38
1  Game Development / Newbie & Debugging Questions / Re: LibGdx - perline noise on: 2015-05-21 23:26:43
Thanks again,

I think there should be variations in thickness.  Say I was doing the dirt, got height of 4 means do 4 dirt tiles on vertical, then next one said 3, what goes into the 4th space - see below:


GG
D <------ Do I put grass here?
DDD
DDD
DDD
R  R   <---- put dirt in the missing space here?
RRR
RRR
RRR

Thanks again

I would maybe use a mix of "air" and "lava". Not sure how to make sure we don't just end up with a flat middle layer (if we purely added in towards the center of the grid. I would have to think about that for a while.

e.g., something like the following

AAA
GAG
DGD
DDD
DDD
DDR
RRR
RRR
RRR
RLL

How you decide to fill in is up to you to decide. You might make up some rules based on how much slope is allowed for the Grass or another layer. Or, whatever helps the game-play the most or looks the best.

It's not clear to me that Perlin Noise is the way to go for generating the randomness in this case. A simpler approach, such as having thickness variables for each layer that are allowed to wander randomly within a certain bounds (and sensitive to the location of the upper and lower neighbors) might be just fine.
2  Game Development / Newbie & Debugging Questions / Re: LibGdx - perline noise on: 2015-05-21 17:44:36
So the value back from noise will state how many to draw vertically (height wise)?

If you are using the same sequence of air/grass/dirt/rock/coal/lava in each column, and only the height varies, then yes.

If there are variations in the the thickness of the layers (implied by the graphic on your link), then you'll need to do more. You could use a Perlin noise function to determine each of those thicknesses, again as a 1-dimensional value, then assemble the results into your array.
3  Game Development / Newbie & Debugging Questions / Re: LibGdx - perline noise on: 2015-05-20 22:34:01
Doh! I should have read your post more closely. [I think] You are using 1 dimensional noise, not 2.

So, use the same Y value throughout, and just vary the X. The resulting number tells you how much to draw.
4  Game Development / Newbie & Debugging Questions / Re: LibGdx - perline noise on: 2015-05-20 21:30:02
Thanks,

So from the value back from the noise function, say if in range of 0-20 draw lava, 20-30 granite, 30-50 rock, 50-80 dirt, 80-100 grass?

So say the noise function came back with 5, I'd draw lava 5 high, if so, what would you put in the empty space (6-20?, just leave as dirt?), am I getting confused here?!

Thanks again,
Steve


The values returned by the function will be -1 to 1, so you might first add 1 then multiply by 50 if you really want 100 gradations to assign to terrain types. If there are only 5 types, that might be overkill, unless you want to jigger the odds so some are more likely than others.

Can also do something like this:
if < -0.8 then granite
if < -0.6 then earth,
etc.

The values will fluctuate, so if the first is 5, the next might be 16 the next might be 9, the next might be 18, etc. etc. You will choose the terrain type that matches each number and have them contiguous on the screen.
5  Game Development / Newbie & Debugging Questions / Re: LibGdx - perline noise on: 2015-05-20 21:22:39
Hey thanks for that, I did read that before.

I do have a SimplexNoise class I got from here in a thread, just don't know how to use it.

Think you do:

1  
2  
SimpleNoise sn = new SimplexNoise();
float noise = sn.noise(xin, yin);     // not sure what these are - possibly the location of x,y tile in array?


I guess the noise is the height?


First off, there is a good reference to check out here at JGO:
http://www.java-gaming.org/topics/noise-bandpassed-white/27071/view.html

(1) The inputs have to be scaled. Perlin Noise is set up so that there is grid of points at which there are gradients derived from a random function. The grid points are about 1 apart (or one "simplex" apart if you are using SimplexNoise). So you will have to divide your tile's (x, y) by some factor so that your variables will follow the contours. You might experiment with divisors that are powers of 2, e.g., 1/16th to 1/128th, to see how much contouring you get. The smaller the factor, the more gradual the slopes.

1  
    float noise = sn.noise(xin * k, yin * k);


I put the same k in both, but they can be scaled differently if it suits your geography. The k value can even be varied as a function of xin or yin if you wish to create something like a perspective effect with the noise values.

(2) The output will be a number from -1 to 1. You can set up how that is translated however you want. Sometimes folks first apply an ABS function, and then translate the numbers 0 to 1 to whatever type of environment. This will create a sort of "fold" in the output data. Using the ABS function is sometimes referred to as "turbulent" noise as opposed to using the data straight, which is called "smooth" noise.

(3) To get more dramatic results, people sometimes use multiple calls to Perlin noise, each with different k values, and add them up. The most common strategy is as a fractal function. This gets progressively more expensive, but can make much more interesting patterns.

Ken Perlin himself describes this method in a slide presentation, in slide 21 from a talk he gave. http://www.noisemachine.com/talk1/21.html

I have a post where this can also be seen, and a Java tool for experimenting with visualizations with Perlin Noise.
http://www.java-gaming.org/topics/simplex-noise-experiments-towards-procedural-generation/27163/msg/242735/view.html In the first post you can see four fractal calls to Perlin's SimplexNoise function, with k values of 1/256, 1/128, 1/64, 1/32, that are progressively summed together, and the cloud pattern it produces. The tool lets you plug in different values and mix the different channels at different amounts. The instructions are sparse, but the code is available via github github.com/philfrei/SiVi, and there is a "gallery" of effects and some commented sample code exposed in the jar to look at as well.

I set up the tool so that the noise outputs point into a Color Map. But instead of a ColorMap with 256 divisions, you can certainly have a map with fewer divisions where each is a terrain type.
6  Discussions / General Discussions / Re: Looking for Beta Testers for Android Metronome App [UPDATE: now in google store] on: 2015-05-20 00:22:00
Thanks for the links you provided in the PM. I was able to install the Metronome.apk file directly in the Emulator provided by AndroidStudio and run the program. My emulator is running as a Nexus 5 API 22.

Nice choice of sound. As far as I can tell the tempo is rock steady. The basic look of the Metronome is nice, and the animation of the pendulums works perfectly well. Congratulations!

I'm not clear what the blue glows do yet. Perhaps this is something yet to be implemented?

The numbers for the beats are a bit awkward to edit. For some reason I can't use my keyboard "Del" but only the "Backspace" for editing. That could have more to do with the clumsiness of emulators than anything else. The first two numbers seem to affect tempo more than they are actual time signatures. Once they are real time signatures, you should probably eliminate the possibility of putting crazy numbers in the denominator. For example 4:3 makes no sense as there is no 1/3 note in between a half note and a quarter note (crotchet).

Also, 3:4 runs faster than 4:4, but I was expecting the "quarter" note of each to be the same length. If there are 60 beats per minute, and the middle control is the denominator of the time signature, that value (1, 2, 4, 8, 16, 32, 64) should be the note value that occurs 60 times in the minute.

Something that would be very useful for me is if it could be set up to play a compound meter, for example 7/8 time, with the groupings 3/8+2/8+2/8, and a discernably different sound on (a) the start of the measure, (b) the start of the grouping, (c) the remaining beats. I just performed a piece in this meter.

When the program is paused and resumed, there is a burst of activity, as if the beats which weren't heard during the pause all played in quick succession.

When adding a sound (a second metronome), the edits I made to the first are lost and revert to 4:4:4.

Eventually, there will be a way to load/save a more complicated beat?

Great start!
7  Game Development / Game Play & Game Design / Re: Perlin Noise? on: 2015-05-19 00:44:15
Quote
I already have the code for the Perlin Noise, but I don't know how to generate it.

Are you asking how to make a Perlin noise function?
Are you asking how to figure out what values to pass into the Perlin noise function call?
Are you asking what to do with the values that are returned by the calls?
8  Java Game APIs & Engines / Java Sound & OpenAL / Re: Getting TinySound to play .oggs in a .jar on: 2015-05-19 00:38:39
IF you get the following result:
(1) jar with wavs plays from console with no errors
(2) exactly the same jar with oggs for wavs (from console) has an error message,
THEN we should have a basis for getting to the root of this mystery.
9  Java Game APIs & Engines / Java Sound & OpenAL / Re: Getting TinySound to play .oggs in a .jar on: 2015-05-18 00:57:13
The name of the file has to be exactly right, including case. If your file is "SlimeFighter 4.JAR" and you specify "SlimeFighter 4.jar" it will give you the "unable to access" error message. Also, "Slimefighter 4.JAR" will fail.

Maybe it would be good to just save a "HelloWorld" program as a jar and run it from the command line, if you have never done this before. It's a crucial skill to be able to troubleshoot: e.g., make simpler cases to try and isolate where a problem lies.

Just now, I took a file of mine which uses Java audio and renamed it to include a space in the name. The original file is Tanpura.jar, and the copy is "Tanpura 1.jar".

These commands worked just fine:
1  
2  
java -jar Tanpura.jar
java -jar "Tanpura 1.jar"
So the problem is probably not due to the space in the name. Having a space in the name still makes me uneasy, though. For example, the easy-to-make error of forgetting to include the "" marks gives the following:
1  
Error: Unable to access jarfile Tanpura
10  Java Game APIs & Engines / Java Sound & OpenAL / Re: Getting TinySound to play .oggs in a .jar on: 2015-05-15 21:54:42
When you ran the command

1  
java -jar SlimeFighter4.jar


the jar file was in the same directory, yes? If it is not in the same directory, then the address has to be included with the name. My apologies if I am indicating something that you already know.

Also, I'm not sure on naming conventions, and if Windows is okay with having a space in the name. Seems to me that it is safer to eliminate spaces.
11  Java Game APIs & Engines / Java Sound & OpenAL / Re: Getting TinySound to play .oggs in a .jar on: 2015-05-15 17:58:17
It means your launch/run configuration is incorrect. Make sure you're specifying the correct one in the jar wizard.

Im using the default configuration, which was working fine with .wavs

The only suggestion I can think of at this point is to try remaking the program as small as possible while still generating the error. At some point it the answer will either become clear, or you'll have posted code that we can use to recreate the error (if the error is in the code and not in Eclipse settings).

I'm assuming the error game up while making the Jar, not while running the jar. When you run the jar from the console, is there a useful error message?
12  Discussions / General Discussions / Re: Is there a term for this? on: 2015-05-15 17:32:33
My life.
LOL! I feel it.

@KevinWorkman -- You've nailed it. The quotes are perfect. It was a recent question about the mysterious Java Sound library that prompted my post. But yes, I was also thinking about the folks who start to blame Java itself or its compiler, etc., for their own bugs, as I have done, even recently.

How about "black box misattribution error"? Before I read your post, I was mulling calling it "black box error," but adding the term misattribution does a lot to disambiguate the target concept.

"Black box" is kind of a relative term, depends on one's knowledge base. True story: listening to a talk radio topic on science of evolution (teaching Darwin or not, debated for CA schools back in the 1980's, a ballot proposition), and an astrophysicist/astronomer called said that he thought we knew a lot now about how stars form, etc., but that the whole issue of how life started was kind of miraculous. Then I swear within half an hour a biologist came on and said he could see how life could have come about from complex protein chains, etc. (or something along those lines), but the creation of the universe was just too amazing. Each was both ready to ascribe divine intervention in the part that they hadn't studied. I wish they could have heard each other or that I had recorded this.
13  Discussions / General Discussions / Re: Is there a term for this? on: 2015-05-13 05:24:55
@BurntPizza, Yes, very similar to XY Problem. That is a good post you linked.

@richierich, Yes, the situation often does lead to learning more about the new tech. But sometimes that is NOT such a good thing. There are a limited number of hours in a day and a seemingly infinite amount of useful tech it would be nice to know about. One would like to prioritize, and maybe leave a few things here and there as "black boxes".

The situation I'm describing is almost the opposite of the drunk that loses his keys scenario. In this case, the keys are dropped near the lamppost, but the drunk spends hours looking around in the dark, because that's where it is easiest to lose things.

My most recent run-in with this (where I had committed the bug) involved my first use of a ConcurrentSkipListSet, where I discovered it was occasionally "misbehaving." I even went to the Concurrency-Interest group to get help. Turned out I had simply made a mistake in writing the Compare function (implementing Comparable) which had nothing to do with the ConcurrentSkipListSet. Very embarrassing.

But I often see problems that others present that are kind of similar in form.

Not sure what one could do to try to catch this when it is happening.
14  Discussions / General Discussions / Is there a term for this? on: 2015-05-12 18:55:09
A really common time-wasting debugging scenario follows this pattern:

* programmer is working with a new technology or new technique that is somewhat mysterious to them
* something (something simple) goes wrong that has nothing to do with the new tech
* programmer assumes the error is in the "mysterious" code part and spends many hours on a wild goose chase

Is there a term for this? It seems to me it deserves a name of its own, if there isn't one already.
15  Java Game APIs & Engines / Java Sound & OpenAL / Re: Getting TinySound to play .oggs in a .jar on: 2015-05-12 18:47:42
During compiling, Eclipse throws out the "Could not find main method from given launch configuration."

Before, you said the program runs fine in Eclipse. Is this a new error? Is this a warning that occurs when you try to run the program (but the program still runs)?

Or is this a message that occurs when you make the jar file?

Have you done anything custom or special to configure how this program is built or what it calls when it is run?
16  Java Game APIs & Engines / Java Sound & OpenAL / Re: Getting TinySound to play .oggs in a .jar on: 2015-05-11 17:59:06
The command for running a jar is as follows:
1  
java -jar fileName.jar

where fileName.jar is the name of your jar file. If Java throws any exceptions, they should show up as output on the console output unless you wrote code to catch and ignore them.
17  Java Game APIs & Engines / Java Sound & OpenAL / Re: Getting TinySound to play .oggs in a .jar on: 2015-05-10 21:47:16
when you make the jar, are you adding another level of compression to the oggs? This *might* have an effect. I haven't tried to do this in a long time, so I am only guessing.

If you are using exactly the same code and file locations and wav works and oggs don't, the only other thing I can think is that maybe needed library files aren't getting included in the jar. I can't recall if TinySound includes the needed files for ogg or if they are an additional import that is needed.

Is there an error message when the sound should play (when the jar is run from a command line)?
18  Java Game APIs & Engines / Java Sound & OpenAL / Re: EasyOgg nowhere to be found. on: 2015-05-04 23:25:56
I'm busy learning Android and have the following plan/goal-->writing a Java library that handles the mixing of tracks, some signal processing effects, some soft synths, and event system, and some provisions for things like creating soundscapes with aleatoric elements and branching of sound/music based on game state. (Much of the preceding is now working.) It will be structured to allow either a javax or Android adaptor to be used with it to isolate and handle interfacing with the native code for the two systems.

When I make more progress, I'll make an announcement in the Audio area. Am pleased so far just to have gotten over the hump with learning how to bring a Java jar/library into Android, and to have gotten a working Android Studio/Linux system, with emulators using an accelerator working. Probably still a month away, though. Android development has proved to have a steep learning curve.

Glad to hear TinySound is working. It is a nifty and very helpful library. I suspect it could be optimized a bit, though for cpu usage. Be sure to test as you add more sounds to the system, as it may start clicking and dropping out depending on how hard you push it. Some folks have mentioned problems with this, but I think if you keep your cues simple you will be fine.
19  Java Game APIs & Engines / Java Sound & OpenAL / Re: EasyOgg nowhere to be found. on: 2015-05-04 22:17:21
I was going to suggest TinySound, too.

Does it output via OpenAL? I thought it used the javax.sound.sampled library, and wasn't running on Android/iOS as a consequence. Am I wrong about that?

I didn't know TinySound integrates with LibGDX and OpenAL. Use of these two implies that the OP is interested in publishing on all three platforms.
20  Java Game APIs & Engines / Java Sound & OpenAL / Re: EasyOgg nowhere to be found. on: 2015-05-04 05:12:46
I'm not familiar with EasyOgg. But maybe I can help with recommending another library. What are you hoping to use it for? Java desktop? Android/iOS? What does it have to be capable of handling?
21  Game Development / Newbie & Debugging Questions / Re: 1D Perlin Noise on: 2015-05-02 05:03:33
Just a quick superficial guess, but I wouldn't be surprised if your freq is far too large. With the Perlin generators I've worked with, one is usually travelling through the generator at a much slower clip. Try 0.09 instead of 0.9 or even 0.01.

But also, only two types of terrain? Or will that be expanded later?
22  Games Center / Showcase / Re: VERBAL - the fast-paced thinking word game on: 2015-04-27 14:23:10
I just tried the obvious thing: fired up the browser on the emulator and navigated to Verbal in the game store!

Unfortunately, it seems that Google doesn't want emulator customers. There is no "Google Play App" on the emulator device. There do appear to be ways to get around this, but I'm not sure I want to take that route (if it is indeed a copyright issue).

http://stackoverflow.com/questions/11154222/google-play-on-android-4-0-emulator
http://www.flinkd.org/2015/02/installing-google-play-on-the-android-emulator-api-21-lollipop/

Genymotion and something called Xamarin both look like they both provide emulators and a legitimate, working Google Play Store app for them.

I'm guessing the only other way I could run your game would be to release a project source file of some sort. I still learning about all this stuff and am I don't know if there is a way to do that while not revealing source code (as one can with a Java jar file). Also I'm not clear if project source files come in a single format--i.e., Android Studio project seems to be structured differently from an Eclipse project. Surely someone else will know this?

"Verbal" has one drawback as a game name: when I did a search at the Google Store, there were a LOT of hits. I had to pass through something like a dozen screens before spotting your game. Maybe (for future projects) it makes sense to come up with a unique name.

If you ever do decide to try getting an emulator working, I'd be happy to help trouble shoot. I've personally encountered and solved a couple dozen gotcha's in the process of solving it for my PC. But there are always new issues arising, and Android dev really does seem to be a moving target.
23  Games Center / WIP games, tools & toy projects / Re: Treasures of the Rijks: Dutch Painters Edition on: 2015-04-23 07:08:03
I like it! How is the project coming along? Anything playable that can be downloaded or tested?
24  Games Center / Showcase / Re: VERBAL - the fast-paced thinking word game on: 2015-04-23 07:03:08
I now have an Android Emulator working. Am still new with Android stuff, and don't have a phone or tablet yet. Do you know if it is possible to run your game on the emulator? Any instructions for how to do so? I'm running the emulator via Android Studio on Linux PC.
25  Game Development / Newbie & Debugging Questions / Re: Looking for Source Code Ressources on: 2015-04-19 02:39:28
You might check out princec's "Revenge of the Titan's"

http://www.java-gaming.org/topics/revenge-of-the-titans-source-code/24119/view.html
26  Game Development / Newbie & Debugging Questions / Re: [Newbie]Need feedback on achieving smooth animation on: 2015-04-13 20:01:05
Your program ran quite smoothly for me. (I commented out the FPS measurement coding at the top of the loop.)

Using a fixed sleep amount is not terrible, as long as there is a minimum of variability in the rest of the program. Often people take a time stamp at the top of the game loop, and measure the elapsed time for the update and render, then subtract that from the target sleep amount, and sleep the result. For many simple applications this is quite adequate.

Another strategy is to use a util.Timer (not Swing.Timer), or a ScheduledThreadPoolExecutor with a time increment set via ScheduleAtFixedRate. With this, there is no need to worry about measuring elapsed time.
27  Game Development / Shared Code / Re: Curve fitting on: 2015-04-02 02:47:49
I'm not entirely sure that Fourier analysis is what is needed here as the best way to do the particular curve fitting you are trying to accomplish. But I did spend some time last year working through the math of the DFT, and collecting links. I managed to get the basic concepts of DFT and for programming convolution. I didn't make it as far as FFT.

Maybe something here will be useful.

I think this is the main book I worked through. "The Scientist and Engineer's Guide to
Digital Signal Processing"
http://www.dspguide.com/ch8/1.htm

ccrma is a fantastic resource, with sections for some of the background math.
https://ccrma.stanford.edu/~jos/mdft/DFT_Math_Outline.html

I have a link to some Java implementations of FFT, from StackOverflow, that I haven't followed up on yet.
http://stackoverflow.com/questions/3287518/reliable-and-fast-fft-in-java

StackOverlow now has a DSP site:
http://dsp.stackexchange.com/questions
I haven't tried using it yet. Just signed up prior to this post.

28  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Lost System.out.println, Being bombarded with text. on: 2015-03-27 19:54:00
This is why I usually include the class and method in println diagnostics. A few extra keystrokes vs. time sink-hole trying to figure out WTF.
29  Game Development / Game Play & Game Design / Re: How to win the boss-fight on: 2015-03-24 05:17:45
Just make sure there is a walk through available.  Grin
30  Game Development / Newbie & Debugging Questions / Re: Play Audio from Byte Array without distortion on: 2015-03-16 01:14:46
Is there a class assignment requirement to put the data in a byte array? If not, you can use the AudioInputStream to open a Clip object. Playing back a Clip is one of two standard methods for playback supported by Java audio. It is optimized for sounds that are short enough that they can be preloaded and held in RAM.

It looks to me like the "sample" you create is only used for printing out the length. Instead, you can calculate the length from the frame length and the frame size, from the AudioInputStream and the AudioFormat.

1  
2  
3  
4  
5  
6  
7  
8  
9  
  
    Clip clip;  // often set up as an instance variable  
    File soundFile = new File("A:/Code/MeusProjetosJava/AudioAnn/src/resources/cat10.wav");
    AudioInputStream sound = AudioSystem.getAudioInputStream(soundFile);

    // load the sound into memory (a Clip)
    DataLine.Info info = new DataLine.Info(Clip.class, sound.getFormat());
    clip = (Clip) AudioSystem.getLine(info);
    clip.open(sound);


Usually, Clips are loaded in advance of when they are to be played. At a later point, when you are ready to play them, all that is needed is the following command:

1  
    clip.start();
Pages: [1] 2 3 ... 38
 
Waterwolf (20 views)
2015-05-20 15:01:45

chrislo27 (24 views)
2015-05-20 03:42:21

BurntPizza (58 views)
2015-05-10 15:53:18

FrozenShade (44 views)
2015-05-07 09:11:21

TheLopais (208 views)
2015-05-06 13:36:48

TheLopais (191 views)
2015-05-06 13:35:14

TheLopais (198 views)
2015-05-06 13:33:39

TheLopais (214 views)
2015-05-06 13:32:48

TheLopais (214 views)
2015-05-06 13:31:28

ClaasJG (236 views)
2015-04-30 20:33:25
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00
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!