CaveGear

So this is my first Project on here, it’s called CaveGear :slight_smile:

It’s a mixture of Minecraft, Terraria, Starbound and Magicite, so basically a 2D Sidescroll Sandbox game with the Goal to survive. Enemies will have much more HP than the Players, potions will be very rare and there is no Health Regen at all. You’ll start off with 3 Hearts and the amount can only be increased by Weapons/Armor with Vitality as a stat. There are other Stats such as Dextertity (Increasing accuracy of your Bow) Strength (Increases your Sword’s damage) Inteligence (Increases Magic damage) and Defense (Decreases Damage taken).

Story:
You (and your friends, multiplayer is fully implemented) crashed with your Spaceship on a planet without oxygen, your Ship is completly destroyed and you don’t have the technology to fix it. The only working parts you could get out of the wreck are an Oxygen Compressor and a Crafting Station. each of you has an Oxygen Flask that holds air for only one minute equipped and that’s about all you have. You quickly realise that you don’t have any chance of getting away from this planet, so you decided to build a base and explore the planet which surprises you with magical weapons, strange ores and deadly creatures.

Features:
:heavy_check_mark: - Day Night Cycle
:heavy_check_mark: - Build and Break blocks
:heavy_check_mark: - Lighting (Reimplementing)
:heavy_check_mark: - Multiplayer
:heavy_check_mark: - Menu
:heavy_check_mark: - Inventory System
:heavy_check_mark: - Infinite Terrain generation
:heavy_check_mark: - Seed depending maps with Caves
:heavy_check_mark: - Player Animations
:heavy_check_mark: - Ingame Chat

Todo:
✘ - Crafting System
✘ - Monsters
✘ - Liquids
✘ - More Ores/Stonetypes/Materials
✘ - Bosses
✘ - Health, Oxygen, Mana and Hunger bars
✘ - Character Customization
✘ - Stat system on weapons

(After Implementing and Testing some more Stuff I’ll release a Demo)

And now some Videos about the current look of the game:

Animated Menu:

lyN4Rb6sZ7Q

Day-Night Cycle:

XodplMMKgvc

Build/Break and Inventory:

CXLHClXaQHs

Amazing work my friend, impressive.
Definitely will be following this project.

Cheers Crucio!

Ingame Chat added :slight_smile: shows up to 7 messages currently

Day/Night Cycle improved, Sun and Moon now show up in the back, and some clouds passing by :smiley:

  • I switched from Intermediate Mode rendering to VBO rendering (only in the chunks), from 30 FPS to 1300 8)
    have to reimplement the light next (so it shows above entities, it makes no sense that entities are always in their true color)

Does this game have a story or is it prominently a sandbox

Are you using VAO as well?

I’m currently using VBOs for the Chunks and Intermediate Mode for everything else (will change that)

There’s a Story in the main post here that will introduce to the game, like why your character is there etc. but other than the atm not, I’ll be working on that later i guess

You should use VAO, you can bind your VBOs to it (like vertices, colors, texture coords…).
When you render you just have to bind the VAO, enable the attribs and then retrieve them in your shader program.

How long did it take you to develop this version? :slight_smile:

Keep in mind though that VAOs are still slower than doing it the ‘inefficient’ way. Most games, for this reason, simply have 1 VAO and bind their VBOs like they did prior to the existence of VAOs. It’s simply not the driver’s fast path.

actually i started it like 10 days ago, but I’ve recoded it a multiple times before, copied some stuff froom there and restarted.

are VAO faster than VBOs? :stuck_out_tongue:

I just think VAO to be convenient, and since he’s rendering chunks of tiles that applies.

I’m currently Stuck with the lighting that is determined by the day time, updating the VBOs that are affected all at once freezes the screen visibly for under 1 second :confused:

Show your code maybe we can help you with that :slight_smile:

Code for Block Place and Break:

// Blockchange
	public void change(World world, int x, int y) {
		float finalLight = 0;
		for (int ix = -1; ix <= 1; ix++) {
			for (int iy = -1; iy <= 1; iy++) {
				float dis = ix * ix + iy * iy;
				if (dis != 0) {
					float cur = 0;
					if (world.getBlock(x + ix, y + iy) != null) {
						cur = world.getBlock(x + ix, y + iy).light;
					}
					if (dis == 2) {
						cur -= 1.7f;
					} else {
						cur -= 1.0f;
					}
					if (opaque) {
						cur -= 1;
					}
					if (cur < 0)
						cur = 0;
					if (cur > finalLight) {
						finalLight = cur;
					}
				}
			}
		}
		if (finalLight != light) {
			light = finalLight;
			stepChange(world, x, y);
			if (Chunk.stepping)
				chunk.redolight = true;
		}
	}

Code for the method “Step Change”


	public void stepChange(World world, int x, int y) {
		if (world.getBlock(x - 1, y) != null)
			world.getBlock(x - 1, y).change(world, x - 1, y);
		if (world.getBlock(x, y - 1) != null)
			world.getBlock(x, y - 1).change(world, x, y - 1);
		if (world.getBlock(x + 1, y) != null)
			world.getBlock(x + 1, y).change(world, x + 1, y);
		if (world.getBlock(x, y + 1) != null)
			world.getBlock(x, y + 1).change(world, x, y + 1);
	}

And in the BlockAir it’s different cause that’s the only one affected by the WorldLight:

@Override
		public void updateWorldLight(float delta, World world, int x, int y) {
			BlockBack bb = world.getBlockBack(x, y);
			if (bb == null) {
	
			} else if (bb.Type == 0) {
						change(world, x, y);
			}
		}
	
		// Blockchange
		@Override
		public void change(World world, int x, int y) {
			boolean worldLight = true;
			float finalLight = 0;
			BlockBack bb = world.getBlockBack(x, y);
			if (bb == null) {
	
			} else if (bb.Type == 0) {
				if (world.worldLight != light) {
					finalLight = world.worldLight;
					worldLight = true;
				}
			}
			for (int ix = -1; ix <= 1; ix++) {
				for (int iy = -1; iy <= 1; iy++) {
					float dis = ix * ix + iy * iy;
					if (dis != 0) {
						float cur = 0;
						if (world.getBlock(x + ix, y + iy) != null) {
							cur = world.getBlock(x + ix, y + iy).light;
						}
						// following calculations round the light shape
						if (dis == 2) {
							cur -= 1.7f;
						} else {
							cur -= 1.0f;
						}
						if (opaque) {
							cur -= 1;
						}
						if (cur < 0)
							cur = 0;
						if (cur > finalLight) {
							finalLight = cur;
							worldLight = false;
						}
					}
				}
			}
			if (finalLight != light) {
				light = finalLight;
				if (worldLight) {
					if (shouldChange(world, x, y)) {
						stepChange(world, x, y);
						if (Chunk.stepping)
							chunk.redolight = true;
					}
				} else {
					stepChange(world, x, y);
					if (Chunk.stepping)
						chunk.redolight = true;
				}
			}
		}
	
		public boolean shouldChange(World world, int x, int y) {
			for (int ix = -1; ix <= 1; ix++) {
				for (int iy = -1; iy <= 1; iy++) {
					float dis = ix * ix + iy * iy;
					if (dis != 0) {
						if (world.getBlock(x + ix, y + iy) != null) {
							if (world.getBlock(x + ix, y + iy).Type != 0) {
								return true;
							} else {
								if (world.getBlockBack(x + ix, y + iy) != null) {
									if (world.getBlockBack(x + ix, y + iy).Type != 0) {
										return true;
									}
								} else {
									return true;
								}
							}
						}
					}
				}
			}
			return false;
		}

If the chunk.redoLight has its value set to true it will refresh the VBO rendered for the light.
the update worldlight method only gets called when the WorldLight value changes.
I’m stuck :stuck_out_tongue:

I don’t think that’s quite readable but well :confused: