Forum

Endless terrain generator

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Endless terrain generator

Postby toneddu2000 » Wed Dec 02, 2015 2:50 pm

Hi guys, did you ever face the attempt to create an endless terrain? I do. :) I "just" want to repeat same 3d model block (let's say 2048x2048x32 sized) in a matrix 3x3 cells. When player moves I delete old cells and recreate new ones. I'm struggling to find a method suitable in quakec but with no luck. There's something already ready to eat?

I tried this video tutorial for Unity in C# and it worked, but I couldn't replicate it in in quakec.

I also trying to do something like this in a static way but, .bsp maps, used as models, are not rendered!

inside worldspawn function
Code: Select all
local int i;
local float isize = 2048;
   for(i=0;i<9;i++){
      terrain = spawn();
      
      setmodel(terrain,"maps/terrain.bsp");
      setsize(terrain,[-(isize/2),-(isize/2),16],[isize/2,isize/2,16]);
      terrain.solid = SOLID_BSP;
      if(i == 0){
         setorigin(terrain,[0,0,0]);
      }
      else if(i == 1){
         setorigin(terrain,[isize,0,0]);
      }
      else if(i == 2){
         setorigin(terrain,[-isize,0,0]);
      }
      else if(i == 3){
         setorigin(terrain,[0,isize,0]);
      }
      else if(i == 4){
         setorigin(terrain,[0,-isize,0]);
      }
      else if(i == 5){
         setorigin(terrain,[isize,isize,0]);
      }
      else if(i == 6){
         setorigin(terrain,[-isize,isize,0]);
      }
      else if(i == 7){
         setorigin(terrain,[isize,-isize,0]);
      }
      else if(i == 8){
         setorigin(terrain,[-isize,-isize,0]);
      }
      terrain.SendFlags |= 1;
      terrain.SendEntity = SendTerrainFlags;

   }   


Another Idea I had is to store previous terrain and then add origin from previous to the new one, but I don't want that use player position, I want that uses old terrain origin and creates a new terrain ACCORDING to player position.

Code: Select all
local entity terrainprev;
local float isize = 2048;
   for(i=0;i<9;i++){
      terrain = spawn();
      setmodel(terrain,"maps/terrain.bsp");
      setsize(terrain,[-(isize/2),-(isize/2),16],[isize/2,isize/2,16]);
      terrain.solid = SOLID_BSP;
      if(terrainprev!=world){
         setorigin(terrain,[terrainprev.origin_x,terrainprev.origin_y+isize,0]);
      }
      terrain.SendFlags |= 1;
      terrain.SendEntity = SendTerrainFlags;
      terrainprev = terrain;
   }   


I dunno if I explain myself correctly, sorry otherwise! Thanks guys in advance for any suggestion!!

PS: I use FTE + CSQC but I don't think it's related in this case.
toneddu2000
 
Posts: 1281
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Endless terrain generator

Postby Zop » Sun May 29, 2016 8:56 am

I like the idea, but I can't tell what problem you have.

Do you get an error? When?
Did you make the terrain.bsp model? What map are you testing this on?
Zop
 
Posts: 5
Joined: Mon Apr 21, 2014 10:41 pm

Re: Endless terrain generator

Postby toneddu2000 » Mon May 30, 2016 7:28 pm

Hi Zop! I almost forgot my own code! :) Too much time passed by! Iirc I wanted to make dynamically generated terrain, so, splitting whole world (let's say a huge map of 99000x99000x8192 units) in immaginary sectors, I'd have liked to render every sector only when player was in that sector, rendering neighbour sectors as well. But, I abandoned the project since I didn't receive any inputs from community and after many unsuccesful code tests, I gave up! :confused:
If you want to share some thoughts, I'm here! :biggrin:
toneddu2000
 
Posts: 1281
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Endless terrain generator

Postby Max_Salivan » Wed Aug 17, 2016 5:49 pm

Good idea,i want to make something in dp.
And made 16x16x128 entity chunk.
I record video late.

But idk how to make infinite world.
Maybe store chunk 16x16x128 in file then player will be on the last cube on chunk and delete cubes,then generate new chunk.

What is better to this experiments?dp or fte,what is entity limit on fte?i think on dp 32768.

I started my experiments then read this
http://www.mustaine.com/about/one-game- ... uakecraft/

Oh,is there a way,to check enity in entity?
Sorry for my english :)
Max_Salivan
 
Posts: 89
Joined: Thu Dec 15, 2011 1:00 pm

Re: Endless terrain generator

Postby frag.machine » Wed Aug 17, 2016 6:19 pm

My understanding is that you two are talking about different things.

Toneddu's idea was to use prefabs to simulate an "endless" world, while the link you provided is a "let's do Minecraft in Quake". I already did something similar to toneddu's idea, almost completely in SSQC (with bits of CSQC for HUD). As Spike commented back then the real pain in the arse is to make artwork that mix in a seamless way. BTW after some testing I settled for a 24x24 grid of 512x512 qu's as a comfortable size in terms of gameplay and performance (at least in Darkplaces, which was my target engine; the mod ran much faster in FTE with the same hardware, but important portions of the world generation were broken on it, so for now I ditched the idea of multiple engine support).
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2052
Joined: Sat Nov 25, 2006 1:49 pm

Re: Endless terrain generator

Postby Max_Salivan » Wed Aug 17, 2016 6:29 pm

And i made minecraftish quake:D
Without infinitie generation.
Sorry for my english :)
Max_Salivan
 
Posts: 89
Joined: Thu Dec 15, 2011 1:00 pm

Re: Endless terrain generator

Postby Max_Salivan » Thu Aug 18, 2016 2:41 am

Image
too many entities:d
Sorry for my english :)
Max_Salivan
 
Posts: 89
Joined: Thu Dec 15, 2011 1:00 pm

Re: Endless terrain generator

Postby frag.machine » Thu Aug 18, 2016 3:45 am

Yeah,IMO to replicate minecraft in quake the better approach would be to implement its map format instead.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2052
Joined: Sat Nov 25, 2006 1:49 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest