Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 21st Jul 2011 03:05
Hello guys, I'm working on a sort of Minecraft clone. I'm working on it in DarkGDK, but this forum is more active and the guys who frequent here seem to know more about the engine itself.

The problem I'm having is with performance, obviously rendering a huge amount of cubes is quite stressful for the system. Currently I have all the 'chunks' that are far away added as limbs to a single object, but this doesn't seem to be fast enough.

I was wondering, if I used the vertex modification commands( using memblocks, is what I mean ) and adding each cube to a single object, would it render faster?

Is there some method with limbs I'm missing that could make it faster?

Thanks a lot, any replies will be greatly appreciated.

Indi.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 21st Jul 2011 03:10 Edited at: 21st Jul 2011 03:11
From what I've learned:

A DBP/GDK primitive cube has 24 vertices, 4 for each face, also 6 vertices per face too. You can actually create a cube manually using just 8 vertices. Minecraft also removes some faces which are not shown. Each will speed up things immensely is you're having a massive amount of cubes in your scene.

EDIT: I'll be back to GDK once I've finished the current project I'm on. Good luck with it...

Warning! May contain Nuts!
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 21st Jul 2011 05:11
Oh cool. That will hopefully increase performance by quite a bit. I've read through quite a few tutorials on the vertexdata commands, but none of them really explain how to create an object from scratch, could you please give some example code?

Thanks for the advise and the luck, good luck with your own project, my friend.

Indi.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Jul 2011 10:49
As WLGfx mentioned, MineCraft removes faces that aren't shown. It's very simple to accomplish, just delete any faces that are on the same position (if you have two cubes next to each other, two faces will be colliding. Delete both of them.)

TheComet

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 21st Jul 2011 10:54
Do you think it would be a better idea to use planes instead of cubes, then? I'm not sure how having 6x more objects would affect performance, which is my main worry.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 21st Jul 2011 15:05 Edited at: 21st Jul 2011 15:07
If a predefined set of objects are created (with and without faces and with a reduced set of vertices). Then instancing them to be placed in the scene would also speed things up too.

IanMs Matrix1 Utils would be the way to go with manually setting up objects but creating them in a modelling program would also be good.

Using just planes would still reduce performance if you're planning on having that amount in the scene at the same time being rendered.

I thought about that, which is easier to set up. Tried it out and made a bigger scene. I forgot to include the fact that there's going to be lots of other objects in the scene. Plus effects like particles.

The best way to go is to get a streamlined performance with your scene from the start then add everything else on top.

IanM posted these for me to have a look at:


and

Currently they have been an invaluable source...

Warning! May contain Nuts!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Jul 2011 21:20 Edited at: 21st Jul 2011 21:32
Instancing is a good solution. If you feel you have enough coding skills, you can also do everything through memblocks and vertexdata, which is really speedy (because you are only editing one mesh). I actually tried doing that, but I got all messed up and canceled that project. Oddly enough, this post has motivated me again. I shall do a second attempt from scratch, I already have a much better design in mind.

EDIT : also, yes, you can use plains instead of cubes. But add them as a limb to an object, that's much faster than having them all as separate objects.

TheComet

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 22nd Jul 2011 01:23
Quote: "Oddly enough, this post has motivated me again. I shall do a second attempt from scratch, I already have a much better design in mind."


I'm glad I could give something back. Good luck man.

Quote: "do everything through memblocks and vertexdata"


I've never used either before, but I think if I put enough time and effort into it, I can do it. Thanks.

Thanks WGLfx, no doubt those snippets will come in really handy.

Indi.

Alien002
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 22nd Jul 2011 03:46
Here is a link to my snippets of minecraft style.

http://forum.thegamecreators.com/?m=forum_view&t=185308&b=1

The map are very basic i only used them to test the code. These snippets are only to show the basic idear of culling. There still needs a lot of work.

list of snippets.

1. cube very slow for the map size.
2. useing plains faster than useing cubes.
3. hide face culling
4. plaine culling fast
5. reduce plain. about 2% the number of plaines for 256X128X256. not good for complex shapes. For large flat plains that are the same block type great.
6. view culling a basic 2d culling. If the tile if not in view don't show it.
7. Distance culling. If the distance is to great don't show it.

There are other form of culling. These are the main one that you should be look at.

I have tryed useing limbs found i problem with the code best of luck of you can get it to work.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 22nd Jul 2011 23:36
Wow, thanks man, they're great examples, hopefully I can implement them to my own code.

Login to post a reply

Server time is: 2026-07-10 10:20:07
Your offset time is: 2026-07-10 10:20:07