World Gen Improvements

This commit is contained in:
MasterGordon 2023-01-04 14:03:08 +01:00
parent 8525ea8c69
commit 08249fc196
4 changed files with 25 additions and 5 deletions

View File

@ -83,7 +83,7 @@ public class Breaking
}
[Interaction(InteractorKind.Server, PacketType.BlockBroken)]
public static void BreakServer(BlockBrokenPacket packet)
public static void BlockBrokenServer(BlockBrokenPacket packet)
{
var ctx = Context.Get();
var tile = ctx.TileRegistry.GetTile(packet.Tile.Id);

View File

@ -33,8 +33,8 @@ public class ChunkGenerator
{
for (var j = 0; j < Constants.ChunkSize; j++)
{
var n = (Noise.coherentNoise(i + (x * 32), j + (y * 32), 0, 1, 25, 0.5f, 0.9f));
var n2 = (Noise2.coherentNoise(i + (x * 32), j + (y * 32), 0, 1, 25, 0.5f, 0.9f));
var n = Noise.coherentNoise((int)((i + (x * 32)) * 0.6), (int)((j + (y * 32)) * 1), 0, 1, 25, 0.5f, 0.9f);
var n2 = Noise2.coherentNoise((int)((i + (x * 32)) * 0.6), (int)((j + (y * 32)) * 1), 0, 1, 25, 0.5f, 0.9f);
// Console.WriteLine(i * (x * 32) + " "+ j * (y * 32));
if (n > 0.08 || n2 > 0.08) continue;
chunk.SetTile(i, j, fill);
@ -69,6 +69,26 @@ public class ChunkGenerator
{
fill.Id = (int)Tiles.CoalOre;
}
if (fill.Id != 1)
{
var pX = i;
var pY = j;
var maxCount = new Random().NextInt64(fill.Id == (int)Tiles.CoalOre ? 3 : 1, fill.Id == (int)Tiles.CoalOre ? 10 : 6);
for (var count = 0; count < maxCount; count++)
{
var delta = new Random().NextInt64(-1, 2);
var dir = new Random().NextInt64(0, 2);
pX += (int)(dir == 0 ? delta : 0);
pY += (int)(dir == 1 ? delta : 0);
Console.WriteLine("Try Adding ader");
Console.WriteLine(pX + " " + pY);
if (chunk.HasTile(pX, pY))
{
chunk.SetTile(pX, pY, STile.From(fill.Id));
Console.WriteLine("Adding ader");
}
}
}
chunk.SetTile(i, j, fill);
}
}

View File

@ -101,7 +101,7 @@ public class WorldGenerator
}
}
var rng = random.Next(0, 700);
var rng = random.Next(0, 1050);
if (rng < ores.Count)
{
return ores[rng];

View File

@ -88,7 +88,7 @@ public class WorldRenderer : IRenderer
{
ctx.Renderer.DrawText("" + Math.Round(ChunkGenerator.Noise.coherentNoise(
(chunk.X * Constants.ChunkSize) + x,
(chunk.Y * Constants.ChunkSize) + y,
(int)(((chunk.Y * Constants.ChunkSize) + y)*0.7),
0
), 4),
(drawX - (int)camera.Position.X) * scale,