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.

AppGameKit Classic Chat / Is there anything like a Minecraft clone out there, made with AGK?

Author
Message
puzzler2018
User Banned
Posted: 22nd Jan 2018 18:56
Going to have a bash at frustum culling and only making objects appear/visible that is in the line of sight of view thats in front of the player.

we are not really bothered about objects thats behind the player is so why waste rendering energy to process them

Catch up soon

puzzler2018
User Banned
Posted: 22nd Jan 2018 19:59
So, here is that idea



What this does for the moment is change the alpha all way down to 0 for 10 blocks in front of the player - you will see them red.

I have only done the backwards code (so press the down cursor) to see the affect

Once the alpha is <0 then is makes them invisible

Tomorrow will continue by bringing them back in when press the forward (up cursor)

Have a nice evening


Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 22nd Jan 2018 20:24 Edited at: 22nd Jan 2018 20:33
@Puzzler,

AGK already implements Frustrum culling for you. All objects bounding boxes are checked before sending them to be drawn by the GPU. If an object cant be seen on screen then its not sent to the GPU to be drawn.

Your FPS will automatically go up in AppGameKit when there are less objects on screen even if they are ALL set to visible. You will get a minor framerate improvement by setting them to invisible but its not much at all as the frustrum culling in AppGameKit is pretty fast.

Its the sheer number of object draw calls that is slow

As Janbo said above
Quote: "It's the amount of objects that affect the frame rate so bad not the polygons ...well the polygons too but you have to find a good balance.
You don't want to switch between states for all the different Objects so much.
I wonder if the only way to combine objects is via memblocks ?
You want as few Objects as possible, so I suggest, if you go with the 16*16*16 chunks to combine all faces in this chunk to one object so agk can still run view frustum culling and draw call batching on the chunks/objects."


The GPU can draw polygons VERY quickly but it wants thousands of them at a time.... not the 12 triangles that make up a box each time. Making a lot of draw calls (one per object) is what is slowing it all down.

As an example
With 50k+ box objects my framerate on an old machine drops to 34fps and if i set them all to invisible it only rises to 44fps. Thats when everything in the scene is invisible! Yet I can draw a single object with the same number of polygons and get a much larger framerate.


As janbo said, combining into memblocks is a good option. Say 10x10 x10 block sections into an object would be a big improvement to the frame rate
puzzler2018
User Banned
Posted: 22nd Jan 2018 20:33 Edited at: 22nd Jan 2018 20:34
Really interesting again.

Thats where im struggling to fathom.

Combine? - you mean with the use of FixObjectToObject possibly mechanism to make it one object?

No one happens to have some examples that i could be inspired with to try and understand that logic at all?

Thanks

ps. Im an early beginner to 3D of this magnitude, but its an excellent learning experience.

Thanks again to you all
puzzler2018
User Banned
Posted: 22nd Jan 2018 21:30 Edited at: 22nd Jan 2018 21:33
Something to be enlightened by

In Minecraft

Maps are 128×128 pixels in size, giving coverage varying from 128×128 to 2048×2048 blocks (8×8 to 128×128 chunks) depending on their zoom factor. Some relevant distances: 128 blocks (8 chunks) is the update radius from a player in the overworld. However, it is half this (64 blocks) in the End and the Nether

So yes, its time to be able to combine/split cubes

I can work with this, if Minecraft chaps can achieve it, then im sure we can

We might be just looking at this all wrong....
puzzler2018
User Banned
Posted: 22nd Jan 2018 21:50
And on that note, how does this look and feel



Mountain generation could be better but looking at performance at moment

janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 22nd Jan 2018 22:42 Edited at: 24th Jan 2018 13:26
I think many of us already tried to create a minecraft like world.
I did, and i didn't succeed, at least not to the degree I wanted.

So let me jump in here and present a little code to create voxel worlds, build out of one sided planes, they are not combined to one object yet.
One sided plane means you can fly inside the cube and look out, so the other side doesn't take up render time.

Play with create/deletecube.
Beware I started at index 1,1,1 and end at 8,8,8 even if you have space in 0,0,0 and 9,9,9 of the array ... I choose it, so I don't need to check bounds every time I create or delete a cube. (I.e. I traded memory against run time)
You can go from here and add them to one object to form your chunk... If you have done that I may present you with another pice of code
puzzler2018
User Banned
Posted: 22nd Jan 2018 22:53
Thanks again Janbo - I shall review this and try and get an understanding of how it works.

How you feel Xaby with the progression?
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 22nd Jan 2018 23:07 Edited at: 22nd Jan 2018 23:26
Just a quick note...

#include "MeshManipulation.agc" needs to be commented out as you have put most of the functions from that file into the source code above directly.

Other than that it looks great and works well. I like the deleting of faces that cant be seen! I was thinking along the same lines!

(Its still not that fast to render as there are still a massive number of individual objects. My thoughts were to combine into one single object - one memblock for an 8x8 area

Awesome work
puzzler2018
User Banned
Posted: 22nd Jan 2018 23:33
Looks good too and with the FPS been so high - looks like some blocks been taken from this massive one - its not mincraft itself but can see what trying to achieve


puzzler2018
User Banned
Posted: 22nd Jan 2018 23:36 Edited at: 22nd Jan 2018 23:39
I would just go with the principle that i found earlier.

Just wondering if the characters are scalable to an 8th of a block.

.05 of something like that and keep the texture or do we need to upsize a bit

only suggest this cause each blocks width is the width of the player, will look odd with 1-1 with a .05,.05 block for example
puzzler2018
User Banned
Posted: 22nd Jan 2018 23:55
If not then thats the perfect reason as to why they made everything in blocks player as well
puzzler2018
User Banned
Posted: 23rd Jan 2018 00:34 Edited at: 23rd Jan 2018 00:35
If it is all blocky then check my 3d object creations - all of which would fit nicely into the scene

https://forum.thegamecreators.com/thread/221110

Currently doing a character funnily enough lol

Let me know your thoughts or am i getting way to ahead of myself
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Jan 2018 11:08 Edited at: 23rd Jan 2018 11:35
I tested something on my OUYA.

I think, I can have like ~ 100 objects with ~ 4000 Polygones or 10 Objects with 1 Mio. Polygones.


What are you seeing?
Yesterday I tried things out on the OUYA, to understand, how AppGameKit handles objects and if the Tegra3 could render some objects. Why? I had an early project, with only 5 objects and I had only 12 Frames/second on the OUYA, but the objects where very low Poly. I can't say, if it was UV-Scaling or what caused the problem. So I build a test-app.
First I use the boxes, thay have 44 polygones each. I am using INSTANCING
The Soldier is about 6.000 to 8000 or so, I think, and the white lady is about 70.000 to 90.000 Polygones. It's an FBX export from Poser. SydneyG2.
The OUYA does not crash, I close the program and started it again. Loading time without Optimization for 3 objects and 3 textures is about 10 sec.

I will try something with
https://www.appgamekit.com/documentation/Reference/Memblock/AddObjectMeshFromMemblock.htm

If I can combine some Objects in Memory, so that they act as one object. Maybe there is an easier way, to combine objects for a drawing-list

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 23rd Jan 2018 19:24
Cool - thanks for the info - enlightening. for the minute ive been experimenting with the cubes. making sure everything is perspective size of the player and things like that

A cube as a surface, so ive added in the potential of a surface textures and main textures




Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Jan 2018 19:27 Edited at: 23rd Jan 2018 19:53
So ...

I think there is a BUG in this Release of AGK.

CreateMemblockFromObjectMesh(ObjectID,1) ... is everytime 24 Bytes, no matter which Object I am trying to put into it.
>> ObjectID can't be an Instance

// I knew, that in some last version of AppGameKit it worked fine.
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 23rd Jan 2018 19:33 Edited at: 23rd Jan 2018 19:36
It works fine here.

What makes you think its 24 bytes?? The first value in a mesh memblock is a number of vertices....At a guess you are creating a memblock from a cube.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Jan 2018 19:52
ne ... I am using Instances, so CreateMemblockFromObjectMesh(ObjectID,1) does not work for an Instance. I have to change somethings, but after that, I can test the idea of combining Meshes together
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 23rd Jan 2018 19:59 Edited at: 23rd Jan 2018 19:59
Combining meshes together works great.

As long as the various meshes dont move or rotate relative to each other and as long as they share the same texture (using atlases etc)... then its fine.

Its not hard to do either.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Jan 2018 20:37 Edited at: 23rd Jan 2018 20:40
I tried ... but I don't get the Position of one Object to Another. So they are all on the same position. I think, there is an improvement in Performance, but I can't tell, if the scene looks the same, because I don't get the positioning right.

Code so far, but the Mesh-Data, I think, has only the Position of the Original-Object


puzzler2018
User Banned
Posted: 23rd Jan 2018 20:51
And a little bit on the mountain generation



From starting this at the weekend, I feel its come along way for a few hours a day work

Shall look at doing more tomorrow eve

Enjoy for now
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Jan 2018 21:04 Edited at: 23rd Jan 2018 21:04
Before and After,

don't get the Mesh-Position right. And the Texture and all stuff

Attachments

Login to view attachments
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 23rd Jan 2018 21:14 Edited at: 23rd Jan 2018 21:19
All meshes have the vertices set around the origin. When rendering a transform (world, camera, projection) is applied depending on the object and camera position and rotation in the world.

So you have to position them into another object by adding x,y,z to every vertex (translation). You will have to get the relative position of A to B and add that to every x,y,z value....quite easy for blocks in a minecraft game

Itgets harder though once you start rotating things...it gets a lot harder as you will need a transform matrix to position the model correctly in the new larger model.


The improvement in rendering performance only comes when you are rending large number of objects with small numbers of polygons so the combination makes sense to cut down on draw calls a nd bounding box checks. If the models are high polygon then the draw calls wont necessarily be the bottleneck so less gains to be made.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Jan 2018 21:17
@puzzler2018,

looks like Minecraft Great progression. I think, some Optimization would be needed (like you know), I have about 48 to 70 Frames, on a GTX 770. But like the look very much.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 23rd Jan 2018 21:22
@Bengismo,

My Models have also very low Polygones, some walls, some boxes. Most of them would be static. The question is, do I have to do alle the MATH by myself, or is it in MEMORY done by AppGameKit itself before in someway, so that I can copy that?

Maybe combining 4 x 4 boxes to a wall of boxes. Or building a street from street-tiles ...

How would gras be done? I think, that some shader or so. But gras could move. That is to complicated, I think.
puzzler2018
User Banned
Posted: 23rd Jan 2018 21:23 Edited at: 23rd Jan 2018 21:23
A really inspirational video

https://www.youtube.com/watch?v=Xq3isov6mZ8

It is fast doing the C programming but the chap talks through stage after stage

Good work Xaby - keep it up
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 23rd Jan 2018 21:33 Edited at: 23rd Jan 2018 21:34
Quote: "@Bengismo,

The question is, do I have to do alle the MATH by myself, or is it in MEMORY done by AppGameKit itself before in someway, so that I can copy that?
"


The transformed vertices are not in memory really (this is actually done in the graphics card) they are stored in model space around the zero axis.

http://www.codinglabs.net/article_world_view_projection_matrix.aspx


As you are copying the vertex positions over, you just add an offset to every value x = x0 + xoffset, y= y0 + yoffset etc... As you add each model. Its not hard. Its only if you want to add some rotation too that it gets a bit harder.
Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 24th Jan 2018 03:23
puzzler a while back someone posted this code to cull objects behind the camera:
puzzler2018
User Banned
Posted: 24th Jan 2018 07:27
Thanks @Golelorn for your input, an excellent find

puzzler2018
User Banned
Posted: 24th Jan 2018 17:35
If this is possible, how about creating a 128 x128x128 all full of cubes

The player and playfield will start on height 64 ( half the height of the full cube ).


So on height level 64, this layer is only visible and the blocks above and below are inivisible- until the player starts building or destroying cubes

I will test this theorem tonight




Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 24th Jan 2018 19:17
Maybe I will get "putting meshes together" to work. With the offset thingly. But with rotation it would be awesome. So maybe it will take a while or is a "little side project". And still don't know, how to get the texture in place.
puzzler2018
User Banned
Posted: 24th Jan 2018 22:55
Nope that didnt work what so ever.

I think its time to have a stab at meshes too - If only i knew where to start like everyone here explaining about - even many minecraft clones on C++/OpenGL talks about meshes as well.

ill do some research over next few days to see if I can do it

All I know is:-

V - F + E = 2
Vertices - Faces + Edges = 2

and thats my knowledge so far.


puzzler2018
User Banned
Posted: 24th Jan 2018 23:45 Edited at: 24th Jan 2018 23:51


Shall continue tomorrow
puzzler2018
User Banned
Posted: 25th Jan 2018 19:37
I have no way forgot about this, work is just going through a reduction phase - so gotta be on the ball with this. Shall come back to this at weekend
puzzler2018
User Banned
Posted: 25th Jan 2018 22:00 Edited at: 25th Jan 2018 22:00
next challenge after this

https://www.youtube.com/watch?v=r2LpOUwca94

Anyone up for it
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 26th Jan 2018 11:36 Edited at: 26th Jan 2018 11:37
@puzzler2018,

I think, that


could be archived with "Shaders" or "Animated Textures". It is like gras. No need for real meshes. Faking the effect, we could try.
puzzler2018
User Banned
Posted: 26th Jan 2018 19:06
Back to business...

I think we getting somewhere now



Press cursors for the hidden surprise

puzzler2018
User Banned
Posted: 26th Jan 2018 20:20 Edited at: 26th Jan 2018 20:22
We gotta be lifted,



Do more tomorrow
puzzler2018
User Banned
Posted: 27th Jan 2018 09:16 Edited at: 27th Jan 2018 09:17
After doing a little bit of research this is how big world app engines go, the pevious example just rolls round a 30x30 block map (every direction)

Big world maps are larger as such:-

Lets Say
- Play area 30x30 (visual)
- World area can be an empty array to start with - but dynamically building height of the array

eg

x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x P P P P P P x x x x x x x x x x
x x x x x x x x x P P P P P P x x x x x x x x x x
x x x x x x x x x P P P P P P x x x x x x x x x x
x x x x x x x x x P P P P P P x x x x x x x x x x
x x x x x x x x x P P P P P P x x x x x x x x x x
x x x x x x x x x P P P P P P x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x

the P's is the play visible area
the x's is the world

when move player around it moves the player in the world area
and moves the content of the world.height to make the P's height the same

the world height and P's height is where the blocks live in 3D space. height wise

If you know my meaning

Shall crack on with coding this, this weekend
puzzler2018
User Banned
Posted: 27th Jan 2018 09:25 Edited at: 27th Jan 2018 09:29
The cube is made of up 6 faces

- No bottom face on any

If any two blocks are next to each other - then the faces that are touching will be deleted and instanceobject created once they dont touch

Thats the idea of doing the cubes without effecting fps too much.. But doing the world first

1 Task at a time
puzzler2018
User Banned
Posted: 27th Jan 2018 16:10 Edited at: 27th Jan 2018 16:12
Been working on the cubes faces (making sure they are not visible if next to another



Works well i think

press T to pop there tops on
Press and hold C whilst moving with cursors wllmove camera
puzzler2018
User Banned
Posted: 27th Jan 2018 17:04
Press and hold A



Catch up tomorrow
puzzler2018
User Banned
Posted: 27th Jan 2018 20:00
https://forum.thegamecreators.com/thread/216928 - This is Locked but

Thank you Thank you Thank you

Some ideas in here
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 27th Jan 2018 20:53
@puzzler2018

so what we are doing now? Building a Meshcreator inside of the game? AGK-Meshmaker. My game would also have a lot of low-poly models, I want to combine "onTheFly" in game at loading a level to some bigger meshes. e.g. the OUYA (game console) can handle about 1.0 Mio. Polygones with more than 30 frames/sec. but it can only handle about 100 objects drawn with AppGameKit at this framerate. (maybe some more or less)
For that, and for walls and ground-tiles, it would be realy great. Most of the parts in the levels are not moving, so it should be easy.

Keep it up. You are making great progress. And thanks for sharing the link to the post. Didn't saw it, when it was out in 2016.
puzzler2018
User Banned
Posted: 27th Jan 2018 21:04
Yes,I think meshing thats best way to go-but my knowledge it poor with that - so i will learn it

Like the ground say 100x100, so instead of having 10000 blocks to fill it,just make it 1 large block and mesh texture to it into

and then work out how to combine many blocks into 1 and uv texture it to make

All these little snippets i think about to see which is best methodology

Whats important is learning from mistakes and build better ways to do things,, that above example from2016 - builds and create an OBJ file and then loads it back in all textured up.
Maybe not what minecraft works,cause need to dynamically add and remove blocks

Keep thinking caps on and keep going...
puzzler2018
User Banned
Posted: 27th Jan 2018 21:06
i have blown my PC amultiple of times with the block quantity testing lol

puzzler2018
User Banned
Posted: 27th Jan 2018 21:35 Edited at: 27th Jan 2018 21:38
[video=youtube]https://www.youtube.com/watch?v=IKB1hWWedMk[/video=youtube]

Can someone advise me how to add youtubes in the window

All these tags infuriate me, i only know

janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 27th Jan 2018 21:46 Edited at: 27th Jan 2018 21:49
Quote: " instead of having 10000 blocks to fill it,just make it 1 large block"

Don't create only one block.
If you do so this block will probably be rendered every time as some part of it will be in the view frustum no matter where the camera is looking at.
You still need to find the balance between objects and polygons.
Make it small enough so AppGameKit can cull this object/chunk if it is outside the view.
Look into my example, there is some code to create objects from memblock.

"[video=youtube]"IKB1hWWedMk"[/video]" <- without "
puzzler2018
User Banned
Posted: 27th Jan 2018 21:57 Edited at: 27th Jan 2018 22:09
Fantiastic- Thanks Janbo?

Edit - "The Coding Train" is subscribed
puzzler2018
User Banned
Posted: 28th Jan 2018 00:30
my version of perlin noise


Login to post a reply

Server time is: 2024-11-22 05:36:58
Your offset time is: 2024-11-22 05:36:58