Gmod Minecraft - Concept / Beta Discussion

Gmod Minecraft
Intro
Gmod minecraft is a project I have been working on for a few weeks now, primarily to see if it is possible, and I have achieved some rather incredible results. The system uses dynamic meshes to render thousands of blocks without using entities meaning there is little to no lag. It uses a perlin noise algorithm very similar to the technique used in minecraft (this algorithm is still being fine tuned to get nice looking terrain)

Project Goals
With this project I hope to bring yet another new form of gameplay to garrysmod, which is possibly one of the most advanced building games to date with hundreds of modes of gameplay.
I hope to create infinate worlds rendered using a combination of the beautiful terrains made possible by dynamicly generated terrain, combined with the beautiful rendering and physics capabilities made possible by Gmod and its easy to use lua mod system.
By the end of the summer I hope to have support for most of the block types available in mine-craft, realistic and beautiful terrain generation with multiworld support, and an infinite map system.

How It Works
One of the biggest problems when designing a system like this is datamanagment. How does one process hundreds of thousands to millions of blocks at a reasonable speed. My solution: a mixture if oct trees and “zones” each zone is a 64 by 64 by 64 box which contains an oct tree that stores the blocks in the zone. Whats nice about this system is we can simply tell the system we want to store blocks in a particular area, even if that area goes through multiple zones, and the system will store them using as little data as possible, without having to fill up every block in the zone. This is immensely advantagous because it greatly simplifies mathematics and makes the system easier to work with, unlike my first version where simply getting a block required about 10 lines of code.

You may be asking well whats so cool about this? So u can store stuff easily, well heres what: using this method we can easily generate blocks as needed rather than generating blocks in huge batches creating lag spikes. As a player moves around we simply generate the blocks that have now entered his view radious and throw out the old ones that have left it.

Another advantage of this system is our ability to devide up meshes independent of chunks. This means we can create a mesh out of just the top layer of visible blocks and easily add code to ignore cave systems which clearly arnt visible.

Lastly, and most importantly, this system makes it easy for building where we must be able to quickly insert or deletr blocks and calculate the blocks that we now need to update on the clients. By allowing entities like the physics ents to quickly access and take on the physics hulls of blocks from any zone they desire, rather than a single chunk, we can have smaller physics meshes that just load blocks near players and NPCs

Development Team:
TheLastPenguin - everything lua based.
Sphax Team - using their 256by265 res texture pack.

Change Log
5/25 - Started recoding system.
5/25 - Oct Tree block managment system. No more “chunks” (sorta)
6/9 - Finished Rendering System
6/9 - Finished MultiPlayer Support
6/9 - Finished Terrain Generation to follow players
6/9 - Finished Physics System

Features Planned
Block Placement / Destruction - WIP
Inventory System - WIP
Crafting System - WIP
Infinate Map Size
Terrain Generation - DONE
Biome System
Ocean Biome
Snow Biome
Mountain Biome
Grassland Biome
MultiWorld support
Water and Lava
Realistic Lighting (no dark tunnels at the moment)

**NEW SCREEN SHOTS!!!
**

The Physics System

http://cloud-2.steampowered.com/ugc/919013244716714644/4AF1485CD11C6E7B138A0B6460C06793523DBF62/

Some Zombies walking around

http://cloud.steampowered.com/ugc/919013244716658687/49260A233A88568AA587E7CED76785EF8B5D16C3/

Screen shot showing the incredible texture quality I can get using gmod’s awesome mesh rendering:

http://cloud-2.steampowered.com/ugc/882983254850276387/AA15DC5A04B969CC437EA720DAC2268AFE510FF0/

Screen shot showing a massive overhang generated with the 3D Perlin noise generation:

http://cloud.steampowered.com/ugc/882983254850144657/EFAC967851813EFB860D8266FFA8DBD0559B0BAF/

Screen shot rendered with graphics on high settings with anti-aliasing and higher texture detail.

http://cloud-2.steampowered.com/ugc/884108892502917156/5201CFE04701DFFBF37786CE91DD7A67C3BFADDE/

This is a rather immersive view of a nice terrain I generated using 3D perlin noise. Probably the best looking / least technical of the screen shots i’ve selected.

http://cloud-2.steampowered.com/ugc/884108892502784126/7167E8EE97A3387854D5A5B4C9983C76503192A7/

View looking up from within a generated cave. Walls should be rock but they are dirt for some reason… it’s a glitch I’ll have fixed soon.

http://cloud-2.steampowered.com/ugc/884108892502761388/B6652E6CA9AB34A3E03D70FC2B55B5B0468FE52B/

Side view so you can see the structure of the cave system.

http://cloud.steampowered.com/ugc/884108892502769733/3B2639F3F80559A4143629A99BE8FF9D072E3EAA/

Zoomed out view of the top of the terrain shown in the other screen shots.

http://cloud-2.steampowered.com/ugc/884108892502768009/123D70E8EB1C004B5CB60160767E7BB8F08E58DD/

For those interested here is a print out of my speed results for the chunk generator for one 8 by 8 by 64 blocks chunk. ( 4096 blocks total )


9927Built Chunk at 80:64:0
      Basic Terrain: 0.07300000000032 -- that's the most intensive part generating the general form.
    Post Processing: 0.020000000000437 -- should it be stone, dirt, grass etc
       Mesh Builder: 0.04100000000107 -- make it into a render mesh so the GPU can actually draw it

Please post any thoughts, likes, dislikes, suggestions, ideas, just cause, or anything else you want to say or ask about the project!

Block Type Suggestions
If you want to suggest a block type follow the following format:
State a general name and description and its applications.
Provide artwork at 256 by 256 resolution for each of the faces in jpeg or png format.
Include a recipy / means by which it would be found. If an ore give an approximate frequency relative to iron or gold for example.

You definitely are pulling off something amazing, but why do you want to recreate something when you could be using this feature to build something different?

I think you should go a different route with this instead of just porting straight from minecraft.

This is very interesting, I had partially undertaken the project myself recently, though I haven’t got as far as you. It’s nice to see someone with the same interests. Have you done or thought about collision at all?

Also I’d be willing to help you with this project, since as I was going to make my own anyway.

I plan to handle collision by having an entity per player which will basicly shape it’s physics box to the chunk the player is in. Each time a player moves off a chunk they will be wrapped back around onto the edge of a new chunk, but actually still on the same entity.

Also yes, I could be interested in collaboration though we should talk on steam first, and i should get it past proof of concept before expanding to a team. I remember your flood remake and it looked fairly nice.

In responce to Ice Tea: Im calling it gmod minecraft because many people are familiar with it, and because im borrowing a large number of ideas from it. I will, however, also be adding a large number of custom features that are not found in minecraft. I hope to add many new items, better graphics, new high tech furnaces, and possibly an electrical system.

I would like to say, first this its incredibly beautiful.
How fast/how much terrain can you generate, for example 10 seconds?
I hope this project goes far, good luck and happy coding.

The terrain generation is indeed impressive, although I’m not sure if you will be able to maintain collision checks for a reasonable amount of players.

I’d love to see a proof of theory of it running once it’s up though.

Why would you want to play minecraft in Gmod? It’s cool as a novelty I guess, but why not just play minecraft?

I’m guessing that it’s because of a few reasons.
One could be that it’s easier to create new blocks/mobs/items/weapons/whatever in this, considering it’s lua based and would allow for a nice dynamic environment.
Another could be that he wants to blend MC and the source engine for a good effect.
A third could be he’s testing his coding abilities and wants to see what he can do

What you have definitely is neat, but I share the same concern as Pantho. Also, how would you have an infinite world? You would need to modify the source engine itself to be able to achieve that.

Ok answering questions… Here goes:

The world will not be truely infinate and the player will never actually move beyond a certain, rather short distance. Players will instead loop around, each time they loop around their “position” according to the mod will be updated to account for the offset, and using a varity of other tricks it will be possible to simulate an infinate map. Not easy, but doable.

Spot on, those are pretty much exactly my reasons.

Well it can do an 8 by 8 grid of 16 by 16 by 128 block chunks in about 5 seconds or so, however im working on techniques to get this signifiganty faster using some better algorithms and block storage methods etc. I plan to create C++ and lua versions of most of the algorithms so they can be run even faster server side and possibly take advantage of threading (yes I know that lua cant be threaded but it can use results when another thread finishes.
**

Progress Update: **spent the last few hours converting my code to use a 3D perlin noise density firld rather than a 2D perlin height map system which it uses now. A 3D perlin density map, while n(2^n) where n is now 3 rather than 2 in terms of computational time, will generate beautiful overhangs and caves that i simply cant get with 2D noise. I expect to be able to save computational time however by only sampling about 1/16th of the blocks in the chunk, and using linear interpolation on the rest to avoid so many samples. While its a bit of a cheat its actually quite similar to what the perlin algorithm does but it skips some of the more intensive steps with no noticable loss in quality.

My Turn
to pose another question which you guys have gotten me thinking about, I probably should differentiate this from minecraft more, so how would you guys like to see it changed, features or blocks added etc.

as awesome as this is, I don’t understand why you don’t just play minecraft

It’s the “ability” to play one game inside of another. It’s like gmDoom, “why don’t you just play doom?” Also, I don’t remember being able to use rag dolls or lua inside minecraft (minus bukkit and luacraft).

Blackwire also put it much better than I did, I just can’t seem to get the right point across.

Oh god everyone is calling me blackwire now.

My bad, he put blackwire up there and I just assumed that was it :stuck_out_tongue:

UPDATE! New 3D Perlin Algorithm:

http://cloud-2.steampowered.com/ugc/884108892499294423/F20E7B31661AC2E1C5E23DB3916F1DC03AC1A3BF/

http://cloud-2.steampowered.com/ugc/884108892499272535/A1C684DDA374DCADF501A98CC2549FD4C3714383/

This is how i’m weighting the noise right now:


local thresh = z / MC.ChunkHeight * 2 - 1	local severity = gen1:noise2D( x/256 + 0.3, y/256 + 0.3 ) * 0.5 + 0.5
	local density = gen1:noise3D_smooth( x/32 + 0.3, y/32 + 0.3, z/32 + 0.3, p, severity * 0.33 )
	density = MC.math_bias( severity, density * 0.5 + 0.5 ) * 2 - 1
	return density > thresh

each function returns a number from -1 to 1. The result is a bool. true for solid, false for air. Block types are chosen in post processing.

Needs smoothing etc but what do you guys think of it etc? Particularly what kinds of transformations could I add to the terrain etc. Feel free to use mathematical / code speak or plain English to describe your ideas.

This looks very interesting. I always wished I could have better physics in Minecraft.

It all looks great but I get the feeling there will be limitations somewhere down the line which in effect kind of destroy the minecraft concept. Probably not enough to put people off…

What kinds of limitations do you fear? I must admit I had similar fears when I started this project, but I have since found solutions to the majority of them. My primary concern is implementing water as It will require a custom collision management system but is absolutely necessary to the game.

Wow, when I saw this, I thought it was going to be some stupid thing with the block swep and horrible ragdolls, but this looks great!

Speaking of which, how is this going to work with building and mining? Is it going to use a SWEP and how will you collect materials? A custom inventory?