From 8ca7cdd845a8b8f6a99d284b52caf9bf4297bff1 Mon Sep 17 00:00:00 2001 From: Christopher Johns Date: Wed, 18 Jul 2018 10:24:46 -0700 Subject: [PATCH] revised noise functions and level gen --- .../src/miniventure/game/client/LevelViewport.java | 2 +- .../client/src/miniventure/game/screen/MainMenu.java | 12 ++++-------- core/game/src/miniventure/game/GameCore.java | 2 +- .../game/world/levelgen/GroupNoiseMapper.java | 7 ------- .../game/world/levelgen/LevelGenerator.java | 5 ++--- 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/core/client/src/miniventure/game/client/LevelViewport.java b/core/client/src/miniventure/game/client/LevelViewport.java index 616aba41..93c900da 100644 --- a/core/client/src/miniventure/game/client/LevelViewport.java +++ b/core/client/src/miniventure/game/client/LevelViewport.java @@ -147,7 +147,7 @@ public void render(@NotNull Vector2 cameraCenter, Color ambientLighting, @NotNul batch.end(); } - private void zoom(int dir) { + public void zoom(int dir) { zoom += dir; zoom = MathUtils.clamp(zoom, MIN_ZOOM, MAX_ZOOM); resetCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); diff --git a/core/client/src/miniventure/game/screen/MainMenu.java b/core/client/src/miniventure/game/screen/MainMenu.java index 7abcf428..8a81e363 100644 --- a/core/client/src/miniventure/game/screen/MainMenu.java +++ b/core/client/src/miniventure/game/screen/MainMenu.java @@ -40,7 +40,7 @@ public class MainMenu extends MenuScreen { private final Color lightOverlay; private final Vector2 cameraPos, cameraDir; - private static final float PAN_SPEED = 3f; // in tiles/second. + private static final float PAN_SPEED = 4.5f; // in tiles/second. public MainMenu() { super(); @@ -107,10 +107,11 @@ public void clicked(InputEvent e, float x, float y) { // setup level scrolling in background levelView = new LevelViewport(); + levelView.zoom(-1); TimeOfDay time = TimeOfDay.values[MathUtils.random(TimeOfDay.values.length-1)]; lightOverlay = TimeOfDay.getSkyColor(time.getStartOffsetSeconds()); - LevelGenerator generator = new LevelGenerator(MathUtils.random.nextLong(), 30, 20); // 100, 60 + LevelGenerator generator = new LevelGenerator(MathUtils.random.nextLong(), 200, 100); backgroundLevel = new DisplayLevel(generator); Vector2 size = new Vector2(levelView.getViewWidth(), levelView.getViewHeight());//.scl(0.5f); @@ -120,12 +121,6 @@ public void clicked(InputEvent e, float x, float y) { // setup background music Music song = ClientCore.setMusicTrack(Gdx.files.internal("audio/music/title.mp3")); - /*song.setOnCompletionListener(music -> MyUtils.delay(MathUtils.random(5000, 10000), () -> { - music.stop(); - music.play(); - }));*/ - //song.setVolume(0.5f); - //MyUtils.delay(100, song::play); song.setLooping(true); song.play(); } @@ -135,6 +130,7 @@ public void clicked(InputEvent e, float x, float y) { @Override public void draw() { + // levelView.handleInput(); levelView.render(cameraPos, lightOverlay, backgroundLevel); cameraPos.add(cameraDir.cpy().scl(GameCore.getDeltaTime())); diff --git a/core/game/src/miniventure/game/GameCore.java b/core/game/src/miniventure/game/GameCore.java index cca87372..051d08fe 100644 --- a/core/game/src/miniventure/game/GameCore.java +++ b/core/game/src/miniventure/game/GameCore.java @@ -33,7 +33,7 @@ public class GameCore { - public static final Version VERSION = new Version("1.5.4.dev"); + public static final Version VERSION = new Version("1.5.4"); public static final int DEFAULT_SCREEN_WIDTH = 800; public static final int DEFAULT_SCREEN_HEIGHT = 450; diff --git a/core/game/src/miniventure/game/world/levelgen/GroupNoiseMapper.java b/core/game/src/miniventure/game/world/levelgen/GroupNoiseMapper.java index 61839ddc..b72fd59f 100644 --- a/core/game/src/miniventure/game/world/levelgen/GroupNoiseMapper.java +++ b/core/game/src/miniventure/game/world/levelgen/GroupNoiseMapper.java @@ -59,13 +59,6 @@ public TileTypeEnum getTileType(int x, int y) { else System.out.println("multimatch for value "+values[i]+"; first region="+biome+", second region="+regions[i+1]+" sticking with first match."); } - /*else if(val <= regions[i].getSize()+threshold) { - // in range for canceling other biomes, but not quite enough to be this biome - if(biome != null) - return filler.getTileType(x, y); // previous found biome is too close - - close = true; // for checking future biomes - }*/ } if(biome == null) biome = filler; // no biomes were in range. diff --git a/core/game/src/miniventure/game/world/levelgen/LevelGenerator.java b/core/game/src/miniventure/game/world/levelgen/LevelGenerator.java index ba5fe0ae..68cc267e 100644 --- a/core/game/src/miniventure/game/world/levelgen/LevelGenerator.java +++ b/core/game/src/miniventure/game/world/levelgen/LevelGenerator.java @@ -206,7 +206,6 @@ private static NoiseMapper DEFAULT_MAPPER() { private static NoiseMapper ISLAND_MAPPER() { NamedNoiseFunction continentNoise = new NamedNoiseFunction("Continent Noise", 500, 2); - NamedNoiseFunction landNoise = new NamedNoiseFunction("Land Noise", 300, 3); NamedNoiseFunction biomeNoise = new NamedNoiseFunction("Biome Noise", 120, 2); NamedNoiseFunction detailNoise = new NamedNoiseFunction("Detail Noise", 12, 2); NamedNoiseFunction islandNoise = new NamedNoiseFunction("Island Noise", 24, 2); @@ -215,7 +214,7 @@ private static NoiseMapper ISLAND_MAPPER() { NoiseMapper plainsBiome = new NoiseMapper("Plains", detailNoise) .addRegion(GRASS, 4) - .addRegion(WATER, .07f) + // .addRegion(WATER, 1f) .addRegion(GRASS, 3) .addRegion(TREE_CARTOON, 1); @@ -239,7 +238,7 @@ private static NoiseMapper ISLAND_MAPPER() { NoiseMapper snowBiome = new NoiseMapper("Snow", biomeNoise) .addRegion(SNOW, 1) .addRegion(GRASS, .25f) - .addRegion(WATER, .07f) + // .addRegion(WATER, .1f) .addRegion(SNOW, 1); /*NoiseMapper volcanoBiome = new NoiseMapper("Volcano", continentNoise)