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 Chat / MeshMemblock Function

Author
Message
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 16th Apr 2018 19:06 Edited at: 10th Sep 2018 19:53
Hello

The last post will always have the very latest of my commands


Now I have a little bit better understanding on how MeshMemblocks are built and put together,

I will use this thread to attach any new bespoke functions as I figure them out and create them,

First function, i would like to try to achieve is

function mesh_merge_object ( meshobj, meshid, objid, x#, y#, z#)

meshobj - the mesh object that we want the objid to be applied to

meshid - the mesh index that we want the objid to add be applied to ( up to 256 I think)

objid - the object itself

x#, y#, z# - where on the mesh that you wish to place the object

- Attaching your own Static objects together into one mesh - like buildings, houses, bridges, cubes - just about anything, as long as the size of the memblock chunk doesnt exceed 100,000 then we good.
so having multiple thousands of small objects into one mesh will have a drawcall of 1 instead f thousand

The header of the mesh will need to be added with the header data of the objects mesh and the object mesh data itself to be added to the end of the previously added object

and indices data (if any) for the objects mesh to be added right at the end of the memblock

Will be no easy task, but will be an enjoyment to try and construct a function to make this happen

Along with Minecraft, it will be good to have a function that does it all for you

So thats my task for you guys
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 16th Apr 2018 20:07 Edited at: 16th Apr 2018 20:40
Other functions like:-

function mesh_object_angle( meshobj, meshindex, objecttypeid, anglex#, angley#, anglez#)

function mesh_object_reposition( meshobj, meshindex, objecttypeid, x#, y#, z#)

function mesh_object_resize( meshobj, meshindex, objecttypeid, tox#, toy#, toz#)

function mesh_object_delete ( meshobj, meshindex, objecttypeid )

function mesh_object_detach ( meshobj, meshindex, objecttypeid )

These will be very powerful when got them or even if this is at all possible,

Any other thoughts of functions are most welcome
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 17th Apr 2018 00:25
Does anyone know the potential of this?
Xaby
FPSC Reloaded TGC Backer
11
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 18th Apr 2018 07:32
Great idea,

how can I imagine this command: function mesh_merge_object ( meshobj, meshid, objid, x#, y#, z#)?

for which reason I would need x#, y#, z#?

CreateMergedObjectFromObject ( NewObjID, FromObjID )

Imagine, there is an Object, we could attach Objects with FixObjectToObject (objID, toObjID)
And all fixed objects would be an object group to this parent toObjID. (problem here would be, that we don't know, which one is attached to which one, and it has to be hierachical, so that also childs of childs are considered)

...
so we would need maybe a group of objects, we want to merge.



This function could be simple an Array with ObjIDs later.

AddObjectToMergeGroup(ObjID, MergeGroupID) would be the ObjID added to the Array

And CreateObjectFromMergeObjectGroup(MergeGroupID) would create the ne Object. (problem here, are the textures)



So the chellange here are:

Which textures are on the objects in your group. What is with ObjectWithChildren-Objects,

The position of the Meshes you would get with GetObject... Local, Global, ... Angle, Rotation ...

The realy complex part would be, if you need to Unwrap the UV-Texture coordinates and wrap them again and merge the texture or something.
But maybe in the first place, your objects have to have all the same texture assigned and you could take it as parameter / argument.







fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 18th Apr 2018 08:24
The beauty I think is not only being able to create joined objects but being able to load and save a memblock that can recreate them

How the textures would work sends my head in a spin lol but then i dont understand enough about memblocks nor mesh for that matter
but texture mapping always has been an issue in the past. Realy curious how puzzler achieves the joining with or without textures, I wont
even pretend to know lol. But with my experiances with using 3d software like 3ds max mapping the texture was hard enough in that
program let alone the mechanics behind it. Even if we could just color individual parts and use one texture ide be very impressed
fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 18th Apr 2018 13:03
Thanks Guys.

Multiple textures can be applied to each mesh index (I think) - so we got the capability of having up to 256 textures on any one mesh.

So as long as no one wants any more than that - then think this will be very useful.

I shall have a think on how to get this started.

Good idea about Object merging - was thinking of this too.

The x#,y#,z# to place the object at the coordinates.

But I shall have a think of this and get started
Xaby
FPSC Reloaded TGC Backer
11
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 18th Apr 2018 16:51
I don't know, if it helps, to get started, it was a beginning for a performance tester on the OUYA, but not included the "object merging". So that has to be done



Sources are the standard Soldier and a box. I used also a high-poly Model from Poser 11. The controlls are for a XBox 360 Controller, but you could change it to something else.
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 16th Jun 2018 17:15 Edited at: 16th Jun 2018 17:33
Hello

I am finally getting to grips with memblocks now



2 new functions used by using the following for example




// AddObjectToMeshMemblockWithTexture
Adds an object to a single object with its own texture and positions it on the mesh too



// function setobjectpositiononmesh(objid, meshid, meshindex, x, y, z)
Used in conjuction with the function above to position the object on a mesh



Enjoy!!!
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 16th Jun 2018 19:07
Looks good and plenty of textures
Quote: " AddObjectToMeshMemblockWithTexture
Position the object on the mesh"


Will come in handy for allot of projects especially if people are trying to create all models and textures with code for sharing
like you are doing with Minecraft and i did with the Night driver template.

Im not sure with the XYZ coordinates that are passed are their global positions or local positions, im thinking they are global
until i get to do some testing.





fubar
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 16th Jun 2018 19:15 Edited at: 16th Jun 2018 20:18
Will be especially good when TGC incorporate "SaveObject( objID, szFilename ) "
but using Memblocks it should be easy enough to write out the memblock data to a file which I imagine could be easy enough to have an encrypted object
if one choses

Another thing I just thought having multiple objects as one mesh is great just curious how the collision detection will work with the present raycasting commands
If there AppGameKit uses a mask effect then we are very good if not then the world would still need careful use with the commands so as the collision detections works as
a person would imagine

I have done both modelling and scripting in secondlife and they have an object called a sculpted or sculpty which uses a mesh to define the vertices. To keep
explanation simple this can be used to create one object from many to cut back on what linden call prim usage. A box is one prim two boxes two prims a scultpy
bridge can be one prim. So its allowed for example But the problem I found with sculpties was collision detection for example a house made from a sculpty may
have a doorway in the centre that you cant walk through if you enable collisions.

A different primitive
As mentioned about sculpties is another way of creating a object similar to height fields. I figure if TGC community wanted to be able to incorporate sculpties they could
do so with a mesh with a set number of vertices and a formula based on the color at the location of a texure. https://www.peterkovesi.com/matlabfns/index.html
has some good reading and source if anyone is interested. Its a little off the topic we have here my apologies but that's another way of having one object that comsumes
little resources

fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 16th Jun 2018 20:16 Edited at: 16th Jun 2018 20:17
Thanks - a very interesting read of which i will read again to get a better understanding about the sculpty thing.

I suppose if add objects to one object and use the standard raycasting on an object - then im sure it will return true if something hits anything that been added to it surely?

Or is this not what your trying to suggest.

but like your suggestion like a house with a door - we only want to be able to see if raycasting would work just on the door object.


Interesting and would need testing.....

If doesnt work as expected then may need to develop our own for memblocks

I have just thought - the addobjectwithtexture function above works for

1st object having texture 1
2nd object having texture 2
3rd object having texture 3
4th object having texture 4

Which is fine - if say modelling a character - 1st object could be the arms
2nd object been the body
3rd object been legs
4th object been feet

but wouldnt work well for creating worlds (worlds that require the same texture at various parts of the world.... Like Minecraft for example

So we need to have a function to add multiple objects on the same mesh ID, like

function AddObjectToMeshWithPosition(objid, meshid, x, y, z)

So lets say have 20 cubes on mesh ID 1 and texture it green
So lets say have 20 cubes on mesh ID 2 and texture it water
So lets say have 20 cubes on mesh ID 3 and texture it sand
So lets say have 20 cubes on mesh ID 4 and texture it snow


Ill take a look in figuring this out by the use of what we know from Minecraft with Santmans / Janbo's and many others help

Cause will need to use the GetmemblockInt and Floats etc to make that work

Then once added those 20 cubes at different positions, then can texture that meshindex
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 16th Jun 2018 20:24
Quote: " suppose if add objects to one object and use the standard raycasting on an object - then im sure it will return true if something hits anything that been added to it surely?
"


What i was trying to say you want the player to collide with the house correct but will it also collide with the doorway when you are trying to walk through

I dont unsderstand the raycasting in AppGameKit the background workings behind it so it may work perfectly well just wasnt sure if thats something to think about
nomatter what it will work perfectly well for minecraft just would need some thoughts and trial to consider how it would work with other programs
fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 16th Jun 2018 20:30
Cool - i got you know,

Maybe develop somekind of mechinsm with object locations that you add to the single mesh like:-

Add Door to MainObject
Door.x =6
Door.Y = 1
Door.Z = 2

Then use a distance algorithm and camera direction facing to work out where you are in relation to the big object
and if you are anywhere close to the Door.X, door.y, door.z values and facing it - then its the Door we are particularly interested in

fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 16th Jun 2018 20:56
yep but may not have too just will have to do some testing it may be fine if you have two objects for example positioned at location 1
and location 3 location 2 has nothing and may still not have a collision, it really depends on the mechanics behind AGKs collisions.

Just to clarify there are differences between a height field and a sculpty and there is much software out there that confuses the two
the main thing the same is they can be made from one texture but a true scultpies algorithm is far more complex see the difference
below

Just wanted to clarify don't expect anyone to actually create code that does so as there is allot of things that can cause it to error. I really just
used a sculpty as an example of how collisions could go wrong
fubar
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 17th Jun 2018 12:22
Puzzler, I've already said if your using memblocks adding multi textures is easy, the coords are in the data file (ago calls them UVs in the help file).

That's how I do my grass......you can literally have as many grass images as you want in a single texture, then just map the UVs to parts of the texture.

So let's make this super simple.....you have two textures side by side in one image, the same size.

The mesh is made of triangles, so you split each texture in half diagonally and that's Got our two triangle textures.....but the references work as % between 0.0 and 1.0. So, if you set the first triangle to be 0.0,0.0 x 0.5,0.0 x 1.0,0.0 then it draws from the top left corner, to the top right of the first texture, down to the bottom left corner. Set the other one up to oppose and the texture draws perfectly.

You can literally have hundreds of Minecraft textures in a single image and every "cube" can be uniquely textured as part of one mesh.
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 17th Jun 2018 12:26
So to add clarity to the above, when your two textures are side by side, they would have coords as such:

Texture 1 is from 0% horizontally to 50%, and 0% to 100% vertically

So in code terms, the UVs for the first texture are 0.0 to 0.5 horizontally, then 0.0 to 1.0 vertically.

Texture 2 will be 0.5 to 1.0 horizontally and 0.0 to 1.0 vertically.
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 17th Jun 2018 14:22 Edited at: 17th Jun 2018 14:24
Im not too sure on texturing at the moment - will look into it. thats something more that would like to get my head round.

But for the time being, here are a few more functions that could be helpful

Memblock Exporter to an external file - named of your choice





Memblock Imported to bring back from the external file (use export to create the file first



A nice copy object to a new object instance - could be similar to copymemblock perhaps but this has debug info



I have uploaded a test object that was created using the export function


Shall crack on with more....

Attachments

Login to view attachments
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 17th Jun 2018 15:53
Thanks Santman for the inspiraton of UV mapping for textures, but coulple things:-

1. Is this UV map the texture of just one cube? - using one image with many texture styles on there (similar to the example CAPTURE.PNG attached) - which is ok and can work with something like
this for different sided textures of a cube

or

2. Texture mapping the whole say a 16x16 fully cubed mesh - how would I work that one out - to cover the whole say chunk in Minecraft for example

Would i need to pre-generate and build a full 16x16 textured PNG first and use that to spread evenly over each cube (similar to SPRITESHEET.PNG Attached

and set UV coordinates to the starting pixels of the 16x16 image we want to use for a particular object

So all depends what you mean and whether im just talking as if I know what im on about



Attachments

Login to view attachments
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 17th Jun 2018 18:58
You can do either, a simple mesh or the large complex one.

Think of it like this......the UVs are literally just the triangular coordinates of an image that should appear across a geometric triangle.....

So they are x and y coords of each of the points, and the gpu will map that to the shape.
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 17th Jun 2018 19:19
Ok, so I;ve drawn a simple visual representation of how UV mapping works, on a simple plane (cubes are dead easy).

I can't make it much more simple than this. Now, lets say you're still doing Minecraft, each block needs 6 images - so you can put them in a row, then map the UVs for each side to a different texture within the row, always remembering that the width is always 0.0 to 1.0 (think of this as 0% to 100% width.....you are literally saying "this texture starts at 0% of the image width and ends at X% of the image width).

You could, with savvy coding, put dozens and dozens of 6 faced textures on a single row, and have dozens and dozens of rows.....it's really all to do with clever setting up of the UVs. I suspect that's where Minecraft recently changed to allow unlimited block types as opposed to the original 256 (which I think were mapped to color channels) - but don;t quote me on that one..

Attachments

Login to view attachments
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 18th Jun 2018 07:02
Wow... Thanks Santman - Ill certainly take a look into this after work

Minecraft is now working along the lines of using Mesh Indexes, say for example

- a random number of green blocks are built randomly on Mesh Index 1 using perlin noise levels
- a random number of sand blocks are built randomly on Mesh Index 2 using perlin noise levels
- a random number of water blocks are built randomly on Mesh Index 3 using perlin noise levels
- a random number of deep water blocks are built randomly on Mesh Index 4 using perlin noise levels
- a random number of rock blocks are built randomly on Mesh Index 5 using perlin noise levels

and then all joined into the same position of a chunk making it look and feel that its one whole chunk

But then this may not be best practice cause using 5 objects here to theoretically 1 chunk object.

Ill have a huge think


puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 18th Jun 2018 19:22
Hi

I got it working perfectly understandably on a

- CreateObjectCube

- Applying the texture with your picture example (4 tiled one)

- using SetObjectUVScale(planeside[0],0,.5,.5) (cause its 4 and 2 textures each row)

and then

SetObjectUVOffset(cube,0,0,0)

SetObjectUVOffset(cube,0,0,1)

SetObjectUVOffset(cube,0,1,0)

SetObjectUVOffset(cube,0,1,1)

Brings out fantastically for each of the tiled textures.

This would be grand if created 6 planes and used the above and join them altogether to a cube - Pefect for some apps.

now we need to delve into memblocks to create that cube.

Where in the memblock data do we apply the UV data - would it be after every planed vertexes or at the end and would you know the type and position of the values to apply

eg. in your AddPlane example you helped on Minecraft there is some code within the AddPlane function and appears to be at the end of each face created

off2=vertoff+((a-24)*vertsize)
setmemblockfloat(chk,off+12,0.0)
setmemblockfloat(chk,off+16,1.0)
setmemblockfloat(chk,off+20,0.0)
setmemblockfloat(chk,off+24,GetMemblockFloat(1,off2+24))
setmemblockfloat(chk,off+28,GetMemblockFloat(1,off2+28))

What does these mean - is it normals / uv data somewhere here, I see +12,0,0 , +16,1,0, + 20,0,0 here.

Ill certainly have a go at the mesh creating for this



fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 18th Jun 2018 20:17
@Puzzler

To get it working on other shapes could perhaps visit moondogs primitive post https://forum.thegamecreators.com/thread/215819
It may not be an exact solution but the textures he uses in the primitive pack may help you with the workings of getting it to work with others
fubar
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 18th Jun 2018 20:35 Edited at: 18th Jun 2018 21:25
It would be really good if it could be done with memblocks but so many variations to consider but would be very handy for Minecraft as one mesh could have one texture
cutting back on resources and making it allot more mobile friendly. Curious where this goes

Think this is all very achievable for Minecraft as its a world made up of boxes. With 6 textures being merged into one for a cube, although how it works with multiple cubes
joined to make one mesh and one texture I have no idea and am very interested how it ends getting used in Minecraft. (seems untreaden territory) But im thinking if you
wanted to do other objects such as a cone for example there would be quite a bit of math involved and even if you just sized and pasted parts of your texture onto another
it would require the ability to size images unproportionally. ie x1,y1,x2,y2,x3,y3,x4,y4 if x1 and y1 was top left and x4,y4 was bottom right. We would need a way of sizing it
so as x1,y1 to x2,y2 distance would be less than x3,y3 to x4,y4 which isn't even possible with images or sprites. (not that its needed to be either), but as Minecraft is a world
of boxes this is still very achievable.

Would love to see any functions that achieve texturing via the uv method but im patient
fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 18th Jun 2018 21:16
Im certainly in the memblocks mode going forward now Fubrpk - so dont worry, as soon as i have something to show and share, i will cause memblock work on every aspects will be vital for
big world games - and thats where I want to go now.

Im head strong in memblocks, memblocks memblocks

Will post more as soon as i have something to show and works well.


puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 18th Jun 2018 21:21
Once I started AppGameKit last year - I saw memblocks - like AMOS with memory pokes and peeks lol and thought oh now, memory coding has come back to haunt me.

But in fact, its quiet ok with AppGameKit and becomes easier and easier, just need a little bit of knowledge to start the ball rolling and soon will be programming like back of our hands with this
style of coding.

Must admit, it still haunting me lol

fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 18th Jun 2018 21:28
Quote: "I saw memblocks - like AMOS with memory pokes and peeks lol and thought oh now, memory coding has come back to haunt me."


HAHAHA well i still find them a little troublesome as there is so much that can be done with them with speed but information for the how toos
are scattered accross the forums

fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 18th Jun 2018 21:34
Yes I agree. But I intend to keep this thread a alive with everything i learn with them.

I havent really seen a thread like this either, have for many other areas (2d stuff) - as if its this style of programming haunts everyone.so is less and less existant to the far more easier commands
we all know and love.

Building commands here will help build Minecraft better

i will not stop until I have something very extra-ordanary to show off the true AppGameKit capabilities
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 18th Jun 2018 21:37
Maybe then once we all have found the techniques in using all the meshmemblock commands, maybe good to add examples to the help file vocabulary that TGC has
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 18th Jun 2018 21:51
Quote: " maybe good to add examples to the help file vocabulary that TGC has"

I agree but I was thinking when you have a Minecraft that works with creating and removing blocks using the mesh method and you can freely move around the world
It would make a great being broken up into a tutorial. Hahahah wouldn't that kick the million dollars or so it cost to create there Minecraft engine in the teeth lol But
there is many parts that could be added to help files. You definitely have come a long way with AppGameKit for your time using it. And the help and direction People like Santman
have given has been great. Ive used TGC products for quite a while on and off admittedly with big breaks but there is so much im still learning. Fortunately I try to do
things a little out of what I can foresee easily but not allot lol. I think you are similar you work on projects that you can't imagine the answers before you attempt them.

fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 18th Jun 2018 22:19 Edited at: 18th Jun 2018 22:22
Thank you fubarpk

I like the sound of your idea of the million dollars though - but why!! - we will get there slowly but surely of a £79 product lol

I think he sold it for the idea and technique that it was something new at the time - it was the idea that was sold (cause Microsoft are recreating in C LOL)

At least we will have the building blocks to create other types of big world games here
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 19th Jun 2018 10:53
On the demo I uploaded to the Minecraft thread it made cubes in memblocks, and commented where the UVs are.
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 19th Jun 2018 12:21
Hi

Indeed you did.


Thanks

Shall work this out and get something together over the week with UV texturing.
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 19th Jun 2018 14:41
You're really close with the basics now puzzler, keep at it. The big thing now is deleting/adding cubes, and collision.

The way I see it, you need an array index for both. Each possible block needs an entry in this index which feels the game which vertices apply to that block.....then you just erase em and rebuild. Adding works exactly the same.

For collision, do a ray cast and then use a mix of the xyz collision point and normals to work out which block you would have hit, that gives the index position.

Index also make updating the aging of blocks easy, for example fire.

Then you've got what is probably the hardest part......actually getting interesting booked procedurally!
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 19th Jun 2018 19:28
Thanks for guidance here Santman - very much appreciated.

Im still fighting with memblock headers and data beyond, from how i understanding it is:-

A potential memblock header ( i found this in the help file and much shorter ) - this one has colour vertices available -



The data after needs to be inline with what info we have placed in the header, so for the above

We have position, Normal, UV and Colour



so the vertex data straight after at position 72 requires to have for every vertice

x, y, z, nx, ny, nz, u, v, RGB

repeated for every vertice until get to the Vertice Count

next example..

We have position, Normal, UV



so the vertex data straight after the UV at position 60 requires to have for every vertice

x, y, z, nx, ny, nz, u, v

repeated for every vertice until get to the Vertice Count

Getting there slowly

fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 22nd Jun 2018 00:01
You will get there. Rome wasn't built in a day they say
And your definitely getting close
fubar
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 22nd Jun 2018 10:18
Just remember my version doesn't store colour data.....if your using colour data you need to account for that attribute too.
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 22nd Jun 2018 13:42 Edited at: 22nd Jun 2018 13:43
I was thinking more along the lines of creating a bible of all these new meshmemblock commands, so

one function to build one with color and one without color


like



plus many more

Once these are built then can use them to build big world maps
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 22nd Jun 2018 14:47
Thats of course if that interests anyone.

Please advise what type of meshmemblock commands you like to see to work with and place your thoughts here and ill see if I can make them going forward - elimating all the hard work and anything
on top of what we have so far
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 22nd Jun 2018 17:55 Edited at: 22nd Jun 2018 20:33
That looks good
I like the idea of being able to change a face with a color!
and curious how things go to get a texture to a face. (Still some algorithm work I think for that)

There is so many functions that could be created that would be very useful to the AppGameKit forums
Really a question of how far you want to take it.

A little off topic but did you get to try my cantor fractal tree snippets? (on my page of usefull snippets all good if you haven't I know people get very busy as you have been with work and the new functions)
fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 22nd Jun 2018 20:53 Edited at: 22nd Jun 2018 20:55
Yeah I saw your trees and look awesome indeed - did you look at The Coding Train you tube for that algorithm by any chance - i seen he has done some fractral work - awesome

in regards to making these functions for ease of use is good and will be powerful to the end user (our delightful programmers)

I would take this to the extreme cause instead of small apps that might last a day to play - can create big world apps that can take years to play - all up to the programmer

But if the tools are in place (and because Paul will be tied up with his own projects) im more than willing to create the tools instead, by all means help if you can set your mind you memblock
programming

The faces on objects can be achievable by adding the color attribute to a given mesh, so importing a bog standard blender cube for example wont have any UV or COLOR data, but
just trying to figure out where the header of the blender obj finishes - adding a few extra lines at the end of the header and reconstructing the bones of the data and adding the UV / Color in addition on
each vertice.

I have the idea in my head - its getting it down on paper and then to AppGameKit -


Please bear with me, but it is completely do able

fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 23rd Jun 2018 00:33 Edited at: 23rd Jun 2018 00:34
Sounds like the problem needs breaking down into steps that you mostly know

1.Understand how a cube primitive is stored as a memblock
2.Understand how the UV data is stored for a cube
3.Convert a cube to a memblock and change the colors of faces
4.Convert a cube to a memblock and change the textures of each face

once the above as been achieved and understood

5.then try with a mesh that you created which really is just a cube
6.Finally try with a mesh that is made up of many planes


Not sure if that helps but often when im solving stuff I think going back a few steps can really help although im often too stubborn to do.
fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 23rd Jun 2018 00:56
Good man
Golelorn
1
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 29th Jun 2018 01:01
puzzler, have you been able to read a file that you created through createfilefrommemblock? I just get a bunch of jibberish. Thanks.
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 29th Jun 2018 07:07
Im not on AppGameKit at moment, Is "CreateFileFromMemblock" a genuine AppGameKit command? or is it one ive created above - cause i dont seem to recollect that command.

If its the exporter and importer from earlier your referring to, then it will be garbled code cause it writes binary code to file instead of human readable code.

Do you wish to have the export and import human readable?

Please advise what you wish to achieve.

Golelorn
1
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 29th Jun 2018 15:49
Its an AppGameKit command. https://www.appgamekit.com/documentation/Reference/Memblock/CreateFileFromMemblock.htm

I want it to be human readable. Was hoping I could learn more about them.
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 29th Jun 2018 16:52 Edited at: 29th Jun 2018 18:20
Quote: "I want it to be human readable. Was hoping I could learn more about them. "

They are raw data and you can change various parts with
when you know the offsets

My thread has examples of
creating/editing sound files with memblocks
Getting the color at a location and modifying a heightmap mesh
all done with memblocks and can be found here
https://forum.thegamecreators.com/thread/222027 and more sound
memblocks here https://forum.thegamecreators.com/thread/222158

Puzzlers memblock thread is also a great place to start and thats why you are here
Also the Minecraft thread https://forum.thegamecreators.com/thread/221407?page=1
Is quite a long thread but has work on creating/editing a mesh object

It is really up to what you want to achieve from them there are many great examples
across the AppGameKit forum and the Darkbasic Forum. When the newsletters were created
there was documented examples but there is allot of them to read and hard to find
which one you want https://www.thegamecreators.com/pages/newsletters/newsletter_issue_n.html
link is where you find the newsletters replacing the n in the above link with a number
ie 1 or 2 etc like https://www.thegamecreators.com/pages/newsletters/newsletter_issue_1.html

@Golelorn I think allot of us want to understand memblocks because of the power
they can give us. They still worry me lol but they are more on a need to know basis. So
when you have something that has to be done with memblocks then you use them in
my opinion. Puzzler is working on creating a whole level mesh for Minecraft which I
don't know how but he is doing good work here. It all takes time, not to steal the thread
but thought ide share what I know and what I have learnt about them. So much more to
understand about memblocks
fubar
puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 11th Jul 2018 19:04
Will work as our next useful command is to combine objects to a single mesh by :-

- reading the input objects header info and adjusting the meshmemblock header accordingly.

- copy the input object vertex data and adding to the meshmemblock vertex data

- copy (if any) indices (at the end of an objects mesh) and add to the end of the meshmemblock

I think the above algorthim will do the trick to truly add an object onto a mesh

I know there is AddObjectMeshFromMemblock but this is fairly limited (for example, cannot change the vertices when add objects via this command, cause it doesnt update the header




MadTinkerer
7
Years of Service
User Offline
Joined: 21st Nov 2010
Location:
Posted: 19th Jul 2018 22:19
So I was looking at the documentation and this is what it says for LoadObject "This command will not load any animation or bone data and will consolidate the vertices into a single object with as few meshes as possible"

"Cool", I thought, "I know Puzzler is trying to figure out how to easily and quickly combine a bunch of meshes together. I wonder what the documentation says about SaveObject()?"

"Not yet functional."

puzzler2018
1
Years of Service
Recently Online
Joined: 8th Oct 2017
Location:
Posted: 21st Jul 2018 15:37
Here is a little teaser for UV Mapping a cube



Uses Triangle List building,


Will finish it up tomorrow with an extension of the sprite sheet of different tiles - like sand/earth/water tiles on the attached MineTiile.png and tweek the UVs and the AddVertex command

Please use the attached PNG and put into Media folder

Attachments

Login to view attachments

Login to post a reply

Server time is: 2018-10-23 18:28:31
Your offset time is: 2018-10-23 18:28:31