No, that just gives me a out of bounds exception, which makes sense. Oh well, thanks for trying I’ll keep messing with it!
Ill keep trying, please tell me if you get it.
Wow, sorry everyone for so many posts! I feel bad
Well, I got it working. But my terrain is very rigid, I guess I’ll just have to play with more values!
Simple Noise usage:
double h = SimplexNoise.noise((x + xoffset)/xscale, (y + yoffset)/yscale) * heightscale + heightoffset;
x is the x coordinate. y is the y coordinate. For 2D terrain like you want, one of these must be constant.
xoffset and yoffset are irrelevant in this situation.
xscale and yscale define the smoothness of the terrain. The higher, the smoother.
heightscale is the multiplier for the height. Normal simplex noise ranges from -1 to 1. A heightscale of 10 will give -10 to 10 etc.
heightoffset is the offset for the average value (0 in normal simplex noise) of the noise.
So the following would give terrain that ranges from 10 to 20, with a smoothness of 15:
SimplexNoise.noise(x/15f, 0) * 5 + 15;
(the height offset and scale mean that the terrain is in the range 15-5 to 15+5)
Wow, that helps immensely! Seeing as this is the first time I’ve delved into noise functions, that was exactly what I needed to find values that work.
A few questions. Is height scale typically the size of the tile? For example, I’m using 32x32 pixel tiles. Should height scale be 32 so it only returns noise in iterations of 32 pixels? (If that makes sense).
Second question, is height offset’s purpose simply to spread the tiles out farther on the y axis?
Thanks a lot!
+1 medal by the way
Heightscale and heightoffset are relative to the map.
Raw values from SimplexNoise are in the range -1 to 1.
What you need to do is transform those into the appropriate place for your world.
If I have a map that is 50 tiles high, and I want the deepest valley to go no lower than 20, and the highest mountain no higher than 40, then I’d put the heightscale as 20 (max-min) and the heightoffset to 30 (min+(max-min)/2)
Wow, I’m loving that The lighting looks a little off though, I can’t tell why however
I think you need to change how much light is lost each tile just a little bit!
thanks man, what you are seeing may be the quality of the image being a 85% clarity .jpg image.
Okay so new update (pre-Alpha 2.0):
- lighting add
- day night cycle
- enemies (press k)
- task bubbles
- zoom (ctrl+ mouse Scroll)
new Instructions:
press “m” for a mining task, “n” for a waypoint and “b” for building
press x after clicking a mining task to select blocks to mine
press v after clicking building task to enter build mode
This game is really cool! I read your blog, and saw some of the
original screeshots and it’s come a long way.
It needs :
-Tutorial, or at least a how to page. I dont understand the controls.
-Better night lighting, I cant see anything at all. Maybe this is better
more challlenging for the complete game, if so please add in a night vision until we can spawn lights
Other than that its a wicked fun game!
Thanks,I really appreciate your post :), I really do need a tutorial page. I’ll start on a google sites wiki for it. You actually can spawn lights (the red item when building) but I’ll raise the light level at night for now.
thanks again, one question though, what’s the average fps you get. I didn’t release this earlier because I was having performance issues but I think I fixed them. If you could tell me your fps it would help a lot. ;D
READ THIS:
I ran it and got an error for missing “window.png”.
I looked in the jar (you only need resources in the jar, not in the folder…), and saw a “Window.png” with a capital ‘W’. So I fixed it, and then this came up:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: Stickman Head.png
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: Stickman Head.png
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:140)
at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64)
at com.badlogic.gdx.graphics.Texture.load(Texture.java:175)
at com.badlogic.gdx.graphics.Texture.create(Texture.java:159)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:133)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:122)
at com.me.main.Game.create(Game.java:76)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:127)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: Stickman Head.png (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:127)
at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:580)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:215)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)
... 8 more
Hope im not too late to anwser the Adverage frames per second question.
I get low (5-20) fps when loading a new map, and then
it jumps up signifigantly to about 60 for anything else I did.
Yeah, when I played the game I maintained a high FPS the whole time, it felt super smooth and really nice!!
Hmm… for some reason, the .jar doesn’t run without the resources in the file with the jar. Check to see if Stickman Head.png is in the folder with it. I seems that there are a lot of errors of the same type (that …8 more thing at the end)
Absolutely wonderful. I will continue to upgrade the rendering system however.
What do you guys think about the art style? I might implement texture packs in the next update
I like the basic style of your sand, it contrasts nicely with your stone walls. I would say the terrain should be kept simple, while players and the walls or items and the such should have more intricate textures.
I just uncovered a screenshot from when I first started to work on the game a few months ago:
And here is one from now:
Look at the improvements ;D. Just wanted to say thanks for the help along the way! :point:
Still got a long way to go though
Very neat. Are you going to implement mobs and pathfinding in the future?
Yes, I’m trying to implement some simple path finding into the workers and start on some “other-worldy” mobs to be implemented. There are some very simple enemies in the game right now but those are just to test out a fighting system.