# Zone generation

2814 views

Subscribe to our subreddit to get all the updates from the team!

I have integrated the zone separation with my implementation of the Marching Cubes algorithm. Now I have been working on zone generation.

A level is separated in the following way :

1. Shrink the zone map to exactly fit an integer number of Chunk2Ds, which are of 32² m².
2. For each Chunk2D, analyse all zones inside its boundaries and determine all possible heights for Chunk3Ds, which are of 32³ m³. Imagine this as a three dimensional array as an hash map : we are trying to figure out all keys for Chunk3Ds for a given Chunk2D.
3. Create and generate a Chunk3D for each height found.
4. Execute the Marching Cubes algorithm to assemble the geometry for each Chunk3D.

In our game, we want levels to look like and feel like a certain world. The first world we are creating is the savanna. Even though each Chunk3D is generated using 3D noise, I made a noise module to map 3D noises into the 2D to able to apply 2D perturbation to the terrain.

I also tried some funkier procedural noises :

An arch!

The important thing with procedural generation, it's to have a certain level of control over it. With the new zone division system, I have achieved a minimum on that path for my game.

## 1 Comment

I don't have much specific to say, but I just wanted to quickly comment that I've been finding these entries interesting, keep up the good work!

## Create an account

Register a new account

• ### Similar Content

• well I am working on a simpler game called tic tac toe, my question is how do I get the mouse click to draw an X on the  board. when I click the mouse nothing happens.
#include <freeglut.h> #include <iostream> using namespace std; void drawBoard() { glPushMatrix(); glColor3f(1.0f, 0.0f, 0.0f); glBegin(GL_LINE_STRIP); glVertex3f(-18.75f, 6.25f, 0.0f); glVertex3f(18.75f, 6.25f, 0.0f); glEnd(); glBegin(GL_LINE_STRIP); glVertex3f(-18.75f, -6.25f, 0.0f); glVertex3f(18.75f, -6.25f, 0.0f); glEnd(); glBegin(GL_LINE_STRIP); glVertex3f(-6.25f, 18.75f, 0.0f); glVertex3f(-6.25f, -18.75f, 0.0f); glEnd(); glBegin(GL_LINE_STRIP); glVertex3f(6.25f, 18.75f, 0.0f); glVertex3f(6.25f, -18.75f, 0.0f); glEnd(); glPopMatrix(); } void drawText() { glColor3f(0.0f, 1.0f, 1.0f); glRasterPos2f(10.0f, 10.0f); glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 'X'); } void renderScene() { glClear(GL_COLOR_BUFFER_BIT); drawBoard(); glutSwapBuffers(); } void ChangeSize(GLsizei w, GLsizei h) { GLfloat aspectRatio; if (h == 0) h = 1; glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); aspectRatio = (GLfloat)w / (GLfloat)h; if (w <= h) glOrtho(-100.0, 100.0, -100.0 / aspectRatio, 100.0 / aspectRatio, 1.0, -1.0); else glOrtho(-100.0*aspectRatio, 100.0*aspectRatio, -100.0, 100.0, 1.0, -1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void mouseClicks(int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { drawText(); } } int main(int argc, char**argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE); glutInitWindowPosition(600, 400); glutInitWindowSize(800, 600); glutCreateWindow("Tic Tac Toe"); glutDisplayFunc(renderScene); glutReshapeFunc(ChangeSize); glutMouseFunc(mouseClicks); glutMainLoop(); }

• Hello guys, these past weeks I've been trying to implement a PBR shader and OMG there are so many little details. First I started reading this article: https://learnopengl.com/PBR/Theory
because it had a lot of good explanations and sample code, and did A LOT of googling for the stuff that wasn't clear enough. Right now I am very confused about why the fresnel term uses the dot product between de halfway vector and the view vector. From theory I thought that the fresnel computes the amount of light that should reflect off a surface depending on the viewing angle and the surface normal, and there are a lot of articles explaining it like that:
- https://learnopengl.com/PBR/Theory
- https://docs.unrealengine.com/en-US/Engine/Rendering/Materials/HowTo/Fresnel/index.html
- https://en.wikipedia.org/wiki/Schlick's_approximation (in the first paragraphs)
And I was happy with that knowledge until I started to discover a lot of articles (and even that wiki one in the last sentence) that actually tell you to use the dot product between the halfway vector and light direction.
- http://filmicworlds.com/blog/everything-has-fresnel/ (this one just says that it got the formula from the gpu gems article https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch14.html which unfortunately doesn't give details about that)
- http://www.codinglabs.net/article_physically_based_rendering_cook_torrance.aspx
- https://computergraphics.stackexchange.com/questions/2494/in-a-physically-based-brdf-what-vector-should-be-used-to-compute-the-fresnel-co (there are really good answers here but I couldn't wrap my head around)
I tried to read the original schlick's paper but I'm the kind of person that can't really follow all that math without visual examples...

In the first image I'm using the dot(N,V) and visually it makes sense. In the second image I'm using the suggested dot(H,L) while having a point light behind the sphere, and I'm just confused, I can't understand what I'm looking at, and why is the normal not needed at all.
I have the feeling I may be mistunderstanding or mixing concepts, so I decided to come here and create a thread so maybe someone could explain it with more....simple words?

Also here is a code snippet of what I'm currently doing, but just for illustrative purposes ( I'm not looking for code, just some theory explanations):
void frag() { float NDF = DistributionGGX(N,H,roughness); float G = GeometrySmith(N, V, L,roughness); float3 F = SchlickFresnel(saturate(dot(V,H)??), F0); float3 radiance = lightColor*attenuation*dot(N,L); // only have a single point light float3 numerator = NDF * G * F; float denominator = 4.0 * saturate(dot(N, V)) * saturate(dot(N, L)); float3 specular = numerator/ max(denominator, 0.001); //avoid division by 0 float3 kd = float3(1,1,1) - F; // if I understood correctly, ks is not needed as it is included in the F term float3 diffuse = albedo/PI; float3 irradiance = (kd * diffuse + specular) * radiance * NdotL; } I know there are a lot of posts talking about this, and I spent a lot of time reading those, but it wasn't entirely clear...so apologies for making another thread asking basically the same thing. Thanks for your time...cheers!

• My project started in 2014 but recently ended due to no funds.  AltarisNine was a Minecraft project based on RPG. The conc﻿ept was nine islands that you explore at a time to follow an in depth lore based on our own production team. This is where the 'Nine' comes in. With skepticism of future success we hope to make this tale into chapters. Such as the first one introducing Nine islands at time.
It wasn't always the same though, my world did evolve over time and now I have a better idea of what it is better than ever. In the first island, Main Isle, is themed around jungles and wilderness. There's lore that stretches throughout the chapter which will engage the player. There would also be kinds of characters you can be such as any other RPG which could be talked about (because i'm still  about what I have lol)
My former team was designing a world players would get into interact with in various ways. Boss battles would be minigames and the RPG lore would be engaged in and something indie platforms would enjoy and talk about beyond platforms.
In the minecraft varient I was a builder, the leader, and the story director which everyone respected. I led my own team of builders and story writers. While I chose certain individuals to be the head department of development and art design.
The reason I am here is to find a new team to help take this away from minecraft and hope we can be successful about it. I'll happily commute each and every person that volunteers and will be accommodated down the line with promotions, wages, and definitely praised for helping start my dream up.

Here are some questions that were frequently asked and that I can thoroughly answer:
What is the goal of the game? If you've ever heard of Wizard101. I got inspired by that game a little. I like the concept of making yourself in this world of mystery and impressing people with new mechanics and events that they enjoy. I'd like for the game to be successful and be mostly on PC but if this keeps up we could reach out to other consoles. But for now, PC, one platform at a time lol. My goal personally is to give people the entertainment and enjoyment I think they'll deserve. Something thats not cheesy, not cliche, something new to keep evolving the gaming community Is this in first-person or third-person? This will be a third person game. We can play around with the camera angles but I kind of want it from a aerial pov I saw RPG in the post so can I assume that the game will have generic RPG elements, e.g. quests, npcs, story-line, items? Yes this will have generic RPG elements. But with a few surprises that make the game different. Such as making boss fights some type of minigame. I don't know how the audience will like or even if it'll flow with game play. But I'd still like to take the idea on for now. Will there be combats, e.g. vs. monsters, vs. players(?) ? There will be tons of concepts. As i've said before the 'Nine' comes in the Nine isles of this world we haven't named yet lol. Each nine islands we come up with will not only give players plenty of content to play, but something we break up into story chapters. Each island will have its on set monsters tied to the story or even monsters that are just natural in their environment. There will also be a PvP aspect which can't be brought up too much because its difficult to try to come up with a player style culture that isn't too predictable or generic or even cliche. I was wondering if it should be an initiated fight or a head on duel like world of warcraft. Is this a single player game or a multiplayer one? Definitely multiplayer. Will the game look like Minecraft? like a voxel/blocks game? I imagined it not looking like minecraft but maybe that can be a concept of its own down the line (like an island concept). I was thinking along the lines of a 3D style and not like minecraft. What are the core mechanics to be included, e.g. player movement, enemy movement, enemy AI? This question is more technical but there will be interactive things in the world, things to collect, natural occurring crafting supplies to make new loot and weapons with. There will be NPC's and thats a broad topic enough lol. I'd even a imagine a pet, housing, and gardening system. But thats for accessories in coding and to give more content in the game for later polishing. Is there a storyline already made? There is an indirect storyline. We've made a script for voice actors (and just what to make the NPC's say in general) in A9 v1. Are there goals already planned out? There are many goals to set out. One each at a time for separate upcoming departments The first 8 pictures were of our hub, the other 9 was our factions world. The factions world doesn't retain to this project I wanted you to see how dedicated I was to making this project. I built everything in the hub myself except for the giant pagodas. The last two photos were all the ones I could find of the RPG world

• I want to render an ocean where players can change waves’ amplitude in real-time. Initially, I would render rolling waves (see picture). As the amplitude increases, I need to transition the rolling waves into breaking waves (see picture). For now, I am not going to show the shoreline onscreen so I don’t need to render breaking waves interacting with the shoreline; I only need breaking waves on the open ocean.

I’ve tried three different approaches so far and I’ve only had success with rolling waves using approach 1. Breaking waves have been impossible so far with all three approaches.

Approach 1: Mesh deformation

a.     I can create smooth rolling waves using the Sine and Gerstner equations.

b.     Since I can’t use these equations for breaking waves, I tried to implement them by using this free plugin whose output is similar to this paid mesh deformation plugin. But there are 2 problems with this plugin approach:

·      There is no smooth transition between rolling waves generated by approach 1a and the breaking waves generated by the Deform plugin

·      The output of the plugin does not look similar to real breaking ocean waves in three different ways:

i.     No smooth blending with the ocean surface

ii.     A large depression is created below the crest

iii.     The entire wave is the same height (rather than with more realistic variations)

c.      I considered using vertex shaders but this approach seems similar to mesh deformation.

Approach 2: Fluid dynamics + metaballs

1.     To render an ocean I will need thousands of particles which will be too expensive in terms of performance (especially for mobile devices).

Approach 3: Using mesh files

1.     I can create breaking waves using some 3D software like in this post but then I can’t modify the ocean in real-time. It will be more like a pre-rendered simulation.

To summarize, I am looking for an approach where I can vary ocean waves’ amplitude for a smooth transition between rolling waves and breaking waves. Please let me know if you have more questions.

• By Cacks
Hi,
I'd like to get & set the OpenGL View Port Matrix but it doesn't work
I'm using the "GL_VIEWPORT" parameter
any ideas?
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!