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
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 19th Mar 2018 18:17
Puzzle,

Either I'm not follow you or your not following me. Lol. By instancing I mean at a GPU level.....where the geometry for one single mesh is passed to the GPU with data, then it draws it X times at locations in that data. It's apparently faster for simple shapes.

RE faces.......all shapes have double sided faces, all that changes is the cull mode. In a normal face, it's only ever drawn from the "front" ... only by turning off this cull are both sides drawn. By default, a cube is the same.....only 3 sides would ever be drawn by default. Google backface culling.
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 19th Mar 2018 21:36 Edited at: 19th Mar 2018 21:49
santman wrote: "Either I'm not follow you or your not following me. Lol. By instancing I mean at a GPU level.....where the geometry for one single mesh is passed to the GPU with data, then it draws it X times at locations in that data. It's apparently faster for simple shapes."


Im pretty sure puzzler meant instancing as in InstanceObject()
Which is one set of object data & attributes but multiple objects at different positions and uses multiple draw calls. Not the same as GPU instancing as you have suggested which would be quicker. Even with Instanceobject() you still need thousands of drawcalls (one per cube) and so memblocks full of many cubes makes loads more sense. GPU instancing would also be a great solution.

santman wrote: "
RE faces.......all shapes have double sided faces, all that changes is the cull mode. In a normal face, it's only ever drawn from the "front" ... only by turning off this cull are both sides drawn. By default, a cube is the same.....only 3 sides would ever be drawn by default. Google backface culling."


Puzzler is right, the planes in AppGameKit are actually 4 triangles. A back facing pair and a front facing pair so no matter what the Cullmode is, it always draws whether your in front or behind it - plus the textures are always the right way around on them. Not that it makes sense to create cubes out of plane objects...(lolz)

Like you said though...you can easily set backface culling on or off with SetObjectCullMode(). The default value does cull backfaces.

AGK's Cubes do not have "double sided faces" (or 2 sets of faces) they simply have 2 outward facing triangles on each side as they should. The rear sides do not get drawn in the default cull mode


Janbo showed that it was possible to get large numbers of blocks drawn by combining them into a memblock back on 22nd january but for some reason the post kind of got lost. I dont think people realized that was the way to go (its fast and simple) and kind of dismissed it.

Great progress by all. The demo looks good.
puzzler2018
User Banned
Posted: 19th Mar 2018 21:48
Thanks for that info,

Its not that we/i missed it - i found object memblock coding one is very complicated and Janbo's code went straight over my head... Give me an image memblock puzzle to write then will do it in no time.

Object memblocks went really over my head for a 6 month beginner with AGK

Im slowly but surely getting there with them now
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 19th Mar 2018 23:58 Edited at: 19th Mar 2018 23:59
Are you sure planes in AppGameKit are four triangles? If you create a plane and walk around it, with normal culling, AppGameKit only draws one side of it. Either way, making a single static mesh does seem like the only realistic way to get that kind of world size.

Maybe once GG is upgraded that will work it's way into AGK.....

P.S. my memblock code is based on creating a plane in AppGameKit, then reading it into a memblock, and "mimicking" that each time it writes new data. Works fine, and does only do two triangles per face, but the count at the start may well be wrong and contributing to that error.
puzzler2018
User Banned
Posted: 20th Mar 2018 06:59
I was going to post how your code assembles the memblock but you bet me to it lol and rather an intuitive way of building an empty one from scratch.

Well done again
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 20th Mar 2018 08:48
Quote: "Are you sure planes in AppGameKit are four triangles? If you create a plane and walk around it, with normal culling, AppGameKit only draws one side of it. "


From CreateObjectPlane ()
https://www.appgamekit.com/documentation/Reference/3D/CreateObjectPlane.htm

AGK Documentation wrote: "Description
Creates a 3D double sided plane with the given width (X) and height (Y). The plane is created in the XY plane and has no size in the Z direction. "


Plus it has 4 triangles in the memblock.

Plus it shows both sides when you walk around it.

So...yeah. Im sure.


But adding 2 triangles to a memblock isnt the same as creating a plane object. Seems to be some confusion going on. lol
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 20th Mar 2018 08:57 Edited at: 20th Mar 2018 09:43
Hey,

@puzzler2018: I'm coming from DBpro and even could take some memblock knowledge from there at some extend. So 6 month, and fiddling with memblocks yet, is pretty good I think.
@Santman: AGK's plane is double sided without indices therefore taking (12 vertices,4 triangles, no indices) to produce the whole mesh. And I think your "cubes" in the demo have inside faces.

In a Render Pipeline you can draw points, lines, triangles and quads.
Most of the time, if its not a particle system or something, you want to build a mesh from triangles.
Triangle strips to be precise which means triangles can share vertices by using indices to know which vertices to connect to. (this can save memory and processing time)
I think all primitive objects in AppGameKit are made from triangle strips except of the plane object, which is made without indices, so every 3rd vertex will be a triangle.

Code to play with:
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 20th Mar 2018 09:10
Ah, that makes sense. Ok, won't be mesh in my demo dosnt have double sided cubes as each face writes only 2 triangles worth of data....it's just the vertex count at the start that states 12 vertices per face as that's what the AppGameKit primitive had. Always wondered why it say 12 and not 6, but when I changed it to 6 AppGameKit crashed.

Anyway, try taking out a wall, you'll only see one side of each face, the other doesn't render. However, AppGameKit is probably making a lot of zero sized triangles (every other one to be exact) which means there's another small potential performance boost right there. Also why it was giving the error stating the memblock didn't contain data to match the size it reported I would think.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Mar 2018 09:44
In my current project (DBPRO)

I started using cubes...then the z fighting of placing the cubes got me frustrated (seeing lines and shiz in the walls)

The, I made all the objects planes...still had all the z-fighting shiz.

THEN

I combined everything into one object with add mesh.

Not only did I solve all the vertex issues, that also solved all the vertex fighting issues.

I went from about 2000 (or more) draw calls, down to 4 and still had many extra FPS to play with now that my map was now 1 object instead of thousands.

Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 20th Mar 2018 10:52
I had that z bugger fighting......eventually figured put my near camera distance was too close.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Mar 2018 14:04
Quote: "I had that z bugger fighting......eventually figured put my near camera distance was too close.
"


No, this was DBP trying to figure out what face/veretexes of the cube it should display. I made a thread about it in the DBPforum (Unsightly Panty Lines...).
puzzler2018
User Banned
Posted: 20th Mar 2018 19:36 Edited at: 20th Mar 2018 19:37
Im currently condensing the makememblock into a memblock type structures to store the info on all the various aspects of a memblock for manageability etc

Like from:-



To




One thing noticed is



This can be simply be



Back to it...
puzzler2018
User Banned
Posted: 22nd Mar 2018 22:34
Hi guys,

Ive condensed a little of memblock code from santman - cheers?

but it doesnt seem to show any cubes- the rendering takes place just great cause can see the FPS go through the roof

Is it just my camera positioning, cause if move mouse - the drawpoygon goes to 0 in some areas

I have made a chunk world of 10, with a cube size of 100x100 for each world chunk and runs at 60 fps - Fantastic.

But nothing on screen :-(




Any assistance what im missing would be splendid - crack on tomorrow / weekend

Been a long week!
puzzler2018
User Banned
Posted: 22nd Mar 2018 22:58
Its ok - got it - changed blocksize to 10 and see things, so camera is way off...

Catch up with more developments in a day or 2
puzzler2018
User Banned
Posted: 22nd Mar 2018 23:08
For example



Cheers Santman/Janbo for the memblock inspirations



puzzler2018
User Banned
Posted: 22nd Mar 2018 23:22
This weekend will be to change all those cubes positions in real time (per sync) using vertex positions, so we need to remember each and every one.

Then once thats done, we will know how to adjust the vertices. then work out how to identify where the + (centre of screen) is pointing at cause note.. these are not individual objects anymore, we going to have to do some great maths to work out positionings of where the camera /player is in the world

All in good time.

On that bombshell its time to say good night for today
puzzler2018
User Banned
Posted: 23rd Mar 2018 00:13
Added our good freind perlin



zzzzzzzzzzzzz
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 23rd Mar 2018 00:26 Edited at: 23rd Mar 2018 00:29
Good stuff.
puzzler2018
User Banned
Posted: 23rd Mar 2018 00:30 Edited at: 23rd Mar 2018 00:33
Yes - dont worry, ill work out the textures - you should be able to view the map at least - ill add the movements this weekend

Textures going to have to think about cause this is a brand new venture

each chunk is going to have to initialise as its own biome, sand, grass, forest etc - and if add and remove blocks then when load a saved game - then this will be a bit of a challenge - cause what you should be seeing is just 1 object, texture that 1 object will indeed texture the entirety... This is not what we want. mmm let me think
puzzler2018
User Banned
Posted: 23rd Mar 2018 00:46
So, maybe create a 16x16 set of proper cubes which are texturable. Then the far world we will see like the above bits of code.

Thats the only foreseeable I can see to be able to have object collisions and different textures.

So keep the player zone in a 16x16 area - only using 256 blocks. Thats better than 40,000 drawcalls

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Mar 2018 03:11
Doing some good work

Plenty to do yet be great when it calculates chunks as part of the perlin map

Some math expert on here should be able to calculate where the mouse is in world

I think one of the biggest challenges that i foresee is how the textures are mapped
but i think if you applied each face a texture it might make it easy with texture mapping
but no easy way of doing that without the use of the uvcommands. And it may be something
to use a shader for.

fubar
puzzler2018
User Banned
Posted: 24th Mar 2018 08:50 Edited at: 24th Mar 2018 08:55
I think i got the real time block changes



This little bit does it



Hold the space key to see what i mean - the results do work but some are unexpected results too, this is due to not changing vertices correctly. Will correct this, but the removal of blocks will be there end of day
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 24th Mar 2018 08:55
Well done @puzzler
fubar
puzzler2018
User Banned
Posted: 24th Mar 2018 09:12
Cheers - it looks odd cause the reset 0,0,0 coordinates is just wrong - it was just a test to see if can change them real time - so now need to work on the calculation of where say Block 284 is in the world
by using its X / Y / Z positions and work out the current vertices coordinates depending on the XYZ position

Come back a little later this afternoon
puzzler2018
User Banned
Posted: 24th Mar 2018 10:20
We have already created the perlin map "Sprite" shows at top of screen. How about we just map that sprite image onto the world



Keep restarting the app to show different styles

Lots more to do with this, but principle is there
puzzler2018
User Banned
Posted: 24th Mar 2018 12:03 Edited at: 24th Mar 2018 12:04
Or we could use



which creates

PS


VS


and then use these with
shader = LoadShader("shader,vs","shader.ps")

and SetShaderConstantByName to pass info to it

But this will have to come when im more experienced - ill research over next week
puzzler2018
User Banned
Posted: 24th Mar 2018 12:25
WOW - or we could work with Layers to structure the chunk up



4 Layers at moment

What you think?

Thanks
puzzler2018
User Banned
Posted: 24th Mar 2018 14:27 Edited at: 24th Mar 2018 14:28
We can make some really fancy stuff with memblocks



Ive posted enough today lol - shall crack on and post more developments soon
puzzler2018
User Banned
Posted: 24th Mar 2018 15:38
Something more like the real thing and at least can move about now



Going to have a remaining Saturday in front of the box an a light beer

Enjoy
puzzler2018
User Banned
Posted: 24th Mar 2018 18:09
Sorry all, I just had to tidy the code up a bit and add in what we have learnt prior to memblocks



Enjoy

Catch up soon
puzzler2018
User Banned
Posted: 24th Mar 2018 23:38
Why do I bother
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 25th Mar 2018 00:11
Quote: "Why do I bother"


Don't get discouraged, man. I'm still following your progress!
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 25th Mar 2018 02:14 Edited at: 25th Mar 2018 02:15
Quote: "Why do I bother"


You bother because you are working on a project with a thread that has well over 6,000 views. Clearly there is a lot of interest in this. It may seem a bit odd how there can be so may views and yet minimal input but I am guessing this is because the majority of the folks checking this out are learning with you and eagerly waiting for you to figure it all out.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Mar 2018 03:41 Edited at: 25th Mar 2018 08:42
I couldn't comment as I was in bed

Patience is a virtue
fubar
puzzler2018
User Banned
Posted: 25th Mar 2018 08:43
Ok no problem, maybe its me posting too heavily.. So what ill try and do is work on the project and post a major update when i have something constructive, this will evidantly make posting a little bit more manageable and meaningful.

I know it can get quite over whelming seeing tuns of post and ya trying to catch up.

Ill crack on more today, todays task ill try to

- sit player on the starting chunk ( with all surrounding chunks invisible)

- make chunks surrounding the players chunk visible (say 5 x 5 chunks surrounding the player chunk, instead of the whole 80x80) - This will up the FPS

- when fly up in the air, to make further afield chunks visible - this will decrease FPS (but we would expect that)

- when fly back down, the further afield chunks go back to invisible (increasing FPS)

- work out the vertices for each block, so can remove/add new when move around

- make the colours of each chunk correspond to the map colours somehow

puzzler2018
User Banned
Posted: 25th Mar 2018 18:54
Added

- Textures
- Colored according to the map



Perlin the whole map is still in progress - its quiet challenging one - but will come in a few days
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Mar 2018 19:54 Edited at: 25th Mar 2018 19:57
Definitely some good progress

Ive been thinking perhaps move the camera forward back left right instead of blocks for accuracy

and a block that hovered ahead of you depending on the mouse that stayed at ground level this
could in turn be used as the build/delete location but im not sure how you would know where it
is in relation to the arrays of the map if you go with camera movement. But if it was restricted to
chunksize movements it would always be above the location you want. Collisions would tell you
which chunk but not where in relation to the chunk but some math may be able to tell you, where
the intersection is in relation to the chunk. The block ahead would also need to always be relative
to the land
fubar
puzzler2018
User Banned
Posted: 25th Mar 2018 21:02
Cheers

The coordinate system for memblocks is something got to have a real think about - cause not as easy as ObjectRayCasting / collisions anymore, but working with pure memory

I read your ideas and taking into consideration.

My thooughts - Maybe, could use 1 (crosshair) object that sits in centre of screen perminantly and use objectraycast on the chunks - this will provide what chunk ID to work with when the cross hair collides.

and then do some more calculations on the 16 x 16 chunk that the object is collided with to idenify which cube its within.

The command "add_plane" to add blocks, will need to create another one similar to remove the vertices of a block, maybe called remove_blocks

The camera moves not the world - but maybe move the camera (if i understood you) on a block by block basis
Hope all this learns you all well.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Mar 2018 21:47 Edited at: 12th Apr 2018 22:00
Cool

I just had a play with the object idea


that creates two objects one the block I'm talking about and second the ground moving the mouse
just moves the block along the x and z axis sitting on top of the second block with a bit of math
should be able to restrict it to size 16 jumps so it jumps from the smaller chunks to the next

But if you was thinking some other way that's fine just I thought ide share
fubar
puzzler2018
User Banned
Posted: 25th Mar 2018 22:02
Thats perfect,,, what ever the player selects from the inventory then can use this to move it onto a cube in the near world, then press left click to release, then will drop a cube on top of the nearest cube nearby it

Excellent...
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Mar 2018 22:14
Quote: "The camera moves not the world - but maybe move the camera (if i understood you) on a block by block basis"


Oh that did sound a bit confusing

Just meant moving around in the world without moving the terrain mesh

Then i thought we needed someway of knowing where we are going to build and or delete
Hence above example but it would have to be restricted to moving within the terrains locations

That could give the chunkid and help with the calculations of where in the chunk

unless someone has a vertices collide function

Anyway its early morning here and prob late at night there so il wait to see and try what you do next
have a great week I already have Mondayitis lol
fubar
puzzler2018
User Banned
Posted: 25th Mar 2018 22:15 Edited at: 25th Mar 2018 22:19
But thinking that, each 16x16 chunk needs to be the same texture if add to add further objects to the cube.

So maybe these adding objects (be objects in ther own right), so objectraycasting will be needed,

if use the same texture as the chunk, than add the object to the mesh

if different texture - then add a new instance of the inventory item in the world

My mind is sleepy and cannot think straight

Monday blues are coming but got week commencing 2nd April off so can do some serious cracking on with this
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Mar 2018 22:16
Thanks lol you speedtyper lol I still type with 2 maybe 3 fingers here lol
fubar
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 26th Mar 2018 10:31
So in terms of working out what block is hit, I think there's a recast command that tells the exact coords of the impact. But do you need them? Let's think about this. The chunk is a fixed size, starting at point X (let's call this chunkX). Each block is exactly Y width (for ease, let's say 10).

So getting the player/camera position is actually quite easy. Get the camera X position, take away chunkX and divide it by the block size, round it and that's where you are.

For example : chunk starts at an X of 0. Player is at X of 257.
So (257 - 0 = 257) / 10 = 25.7
Floor this and you get 25, so the player is 25 blocks in.

Now extend this to the camera check - move the camera locally on the Z plane by the blocksize however many times you want (the distance you want to check for impacts)....then do the above check each time. You'll get coords for the array holding the block data, which you just check for a block. Simple, no mess and should be perfectly quick enough for 6 or 7 blocks.

In terms of deleting the blocks, remember a memblock does not need written in sequence - so add fields to the array which stores the vertices numbers (memblock offset) for every face it contains - then you can quickly and easily just delete that entry. Some form of array sorting is needed though. Literally, that and scrolling chunks are the only hard bits left really, and that's Minecraft done.

I looked at it last night - 95% confident that would allow comparable size to the actual Minecraft, and probably not hugely slower (they do still have occlusion routines too).
puzzler2018
User Banned
Posted: 26th Mar 2018 12:58
Thanks Santman - I think I did something quite similar in one of the very earliest examples of doing it this way and seems to work well, I didnt expect to return to that method - but foresee no alternative way.

I think it was one when i got the player/camera to find the block number when moving around ontop of blocks

And of course all your feedback / ideas and such like is very valuable.

Crack on more with this when I get home

Thanks
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 26th Mar 2018 13:35
I think you're doing awesome, and like everyone else I drop in and check on it from time to time, but right now I'm trying to get a different open world style landscape running at speed so am tied up.

Keep at it......from memblocks to normals I'm sure everyone is learning something.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 26th Mar 2018 15:57 Edited at: 26th Mar 2018 15:59
Quote: "they do still have occlusion routines too"

Found a good article about it some time ago and it doesn't sound to complicated if you ever made a path finding algorithm
Advanced Cave Culling Algorithm
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 26th Mar 2018 16:09
I think the algorithm is easy enough, it's doing it in AppGameKit t1 that's the issue. Bengisimo (I think) showed that simple cake are 50+ times faster in t2, and Minecraft windows uses threading. Look back at traditional Minecraft, with chunks of blank space.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 26th Mar 2018 16:22 Edited at: 26th Mar 2018 16:29
You don't need threading to get good performance with this algorithm.
It's simple breadth first search on a 3 Dimensional Grid. You don't need to constantly run this algorithm, only once you moved into another chuck.
Also the bigger you make the chunck the less data the algorithm must go through obvously.
As my Tower Defense path finding algorithm is pretty fast, this one should be too.
Although multithreading would be cool
puzzler2018
User Banned
Posted: 26th Mar 2018 18:13 Edited at: 26th Mar 2018 18:16
Wow thanks again

I think we need to make an itinerary, a task list and order of completions, otherwise we can forget whats important to implement as progress comes along

So here is one, feel free to add/change/remove/reorder the importance or stages of future developments

1 Coordinate system to identify blocks on the chunk - getting the Chunk reference and block number that the mouse (centre) is hovering over.
Nice affect would be to put an Outline on the block that its hovering - maybe a shader

2 Add and remove those identified blocks by adding a new block with new vertices or deleting the vertices of that location in the chunks memblock
To do this, maybe as we move the player onto a new chunk then dynamically load that chunks memblock/vertices data into working memory, so can achieve this

3 We dont really want to walk through blocks - so use the Coordinate System to identiffy any blocks surround the player/camera and if there is a block adjcent (in all directions) then cant move any
more in that direction - thus collided with a block

4 To be able to add new blocks onto the current loaded mesh / maybe look into been able to have multiple textured blocks on the same mesh with the use of U V and Normals

5 Perlin Map the whole map instead of just 1 chunk and the map is duplicated with that 1st created chunk - maybe the use of task 2 can achieve this once got this code in place

6. Scrolling the map so it feels infinate

7. Undergound

8 Occusion Culling with BFS

If any think i have the wrong way of thinking or thiings cannot be acheived then please share your thoughts

This should keep us going for a while.

Login to post a reply

Server time is: 2024-04-25 17:34:41
Your offset time is: 2024-04-25 17:34:41