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

Author
Message
puzzler2018
User Banned
Posted: 2nd Sep 2018 13:22 Edited at: 2nd Sep 2018 13:23
Hello

Here is a dynamic box creator with Color or Texture

Texture version - put cube.png into media folder




On the command, you can change witdth/height/depth- they are allcurrently 5 at moment


object = CreateObjectFromMeshWithColor(CreateMeshObjectBoxWithColor(5,5,5,MakeColor(0,200,0)))

Enjoy

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 2nd Sep 2018 17:56
Just thought give grass a go again

puzzler2018
User Banned
Posted: 3rd Sep 2018 18:45 Edited at: 3rd Sep 2018 18:46
Here is a cone and a box on the same mesh



Use the Cube.PNG to use the texture
Enjoy!

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Sep 2018 01:06
How about a mesh memblock function that will take a mesh and create separate meshes from each face ( or number of faces)?
So if i say 3 faces then it will create separate meshes for each 3 faces (possibly joined)
puzzler2018
User Banned
Posted: 4th Sep 2018 06:59
Anything is possible - will have a go at this soon

puzzler2018
User Banned
Posted: 4th Sep 2018 18:19
Here is a cylinder object to use on a mesh



puzzler2018
User Banned
Posted: 4th Sep 2018 18:57
Single sided mesh plane


Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 4th Sep 2018 21:03
We all see outside in the real world everyday and every thing is made up of a multitude of:-

- boxes
- spheres
- cylinderical shapes
- cones
- capsule

So I understand that these are the basic primitives - multple of these creating a fantastic horror house for example...


puzzler2018
User Banned
Posted: 4th Sep 2018 22:21
This is a worthless thread!!!!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Sep 2018 16:48
Quote: "This is a worthless thread!!!!"

I wouldn't say that there was someone posting help the other day for such memblock functions
I left it for you to answer and thought this was the thread.

Ive just been busy with blockLifter just when I think I have a method that works I find theres a better
way and new ways being suggested all the time

fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Sep 2018 11:01
Here's how i think you could break up a mesh.

1. Take a vertex
2. Find x polys that share that vertex (x is specified, must be 1 or more) if you can't find x then as many as you can
3. Create a mesh from those polys
4. Remove those polys from your original mesh
5. repeat until you have no more polys

Then what you can do is take all those meshes, make them physics objects and add a force at the center of the models and BOOM! Explode-able objects
puzzler2018
User Banned
Posted: 6th Sep 2018 21:47
Thanks to both of you

I was thinking of doing some more basic stuff before i delve into deeper stuff like this.

Cause its on the thread - it will be on my list of things to achieve

Thanks though
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Sep 2018 23:55
Review of my logic;
1. take a poly
2. find x polys that share two vertex with the first
3. if you can't find enough polys that share two vertex then find polys sharing one
4. if you cant find enough polys sharing one then just create the mesh from the polys found
5. remove those polys from the mesh and repeat

I think this will give you nice solid chunks and avoid star shapes
puzzler2018
User Banned
Posted: 7th Sep 2018 00:23
Yeah you have already said - i dont understand the logic.. On a mesh there cant be any less than 3 vertices. let me have a think
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 7th Sep 2018 01:07 Edited at: 7th Sep 2018 03:52
For explosions
I think if you know how many faces there are in an object
and if you know the x,y,z location of each face
a object plane could be created at each x,y,z location facing the centre of the model (perhapsRed)
then it would just be a matter of sending the new object planes in random directions

The only problem is that we dont know the size of each face but that is a starter
That should work well for a cube atleast


Example Code


It really just demonstrates creating thin boxes at the faces of a box and shows how that could be used for an explosion
fubar
puzzler2018
User Banned
Posted: 7th Sep 2018 17:22
That looks mighty clever - ill take a look over the weekend see what i can do
nonom
6
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 7th Sep 2018 17:30
Congrats, good job
surfing dry land
puzzler2018
User Banned
Posted: 8th Sep 2018 13:44
Falling world


fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 8th Sep 2018 14:20 Edited at: 8th Sep 2018 14:21
That has great potential
fubar
puzzler2018
User Banned
Posted: 8th Sep 2018 16:01 Edited at: 8th Sep 2018 16:04
Thanks

I trying to make a shatter for a plane


For shattering objects - i think we will have to have pre-defined vertices.

Mathemematically creating 100s of smaller triangles on a plane (face) is somewhat quiet challenging.

But here is something to get us started

Ive split up a plane into 8 segments. Will re-factor this soon to be able to add more segments

EDIT - I will remedy the UVs too in a while
puzzler2018
User Banned
Posted: 8th Sep 2018 16:12 Edited at: 8th Sep 2018 16:13
UVs done in the CreateMeshObjectPlaneWithTexture_Shatter(0,0,0,30,30) function

wow that was straight forward

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 8th Sep 2018 16:15
I Think many users Watch but dont post anything puzzler…
Its very unmotivating when you put in alot of effort but sadly how it is many times…

I will look in to all experiments when i have more time over
I find all small samples very usefull as iam going to have a go later on with a 2d to voxel like convertor for map tiles..
You know read in a image with a bunch of tiles and memblock to read colors and make them to 3d voxel like tiles instead.
puzzler2018
User Banned
Posted: 8th Sep 2018 16:21 Edited at: 8th Sep 2018 17:38
Its perfectly alright - not many want to delve into the realms of memblock work and i appreciate ones that are a bit nervous to start. and ones that are already the masters already have their knowledge

I shall keep posting my memblock work as and when i can think of something new. which is mostly every few days.

All these will be very useful in making any kind of game which gives a performance boost.

This thread will be our a bible for memblock works

EDIT

I have attached the 8 segment triangle strip of a plane with each segment preprocessedly cut into seperate triangles for the last effect to work like it does.

If any of you think of a more effective split to make a better and reallistic shatter then that would be most welcome

Note. We have to work in triangles. - Something like "Shatter2.png"

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 8th Sep 2018 17:44 Edited at: 8th Sep 2018 17:48
On a side note - programming this shatter is in effect could be a Mosiac window with different segment colours!!!

WOW!


puzzler2018
User Banned
Posted: 9th Sep 2018 11:38
A shattering box


puzzler2018
User Banned
Posted: 9th Sep 2018 11:57
Chopped up a plane into normal objects that can now be moved at will



Keep hold of space

Enjoy and catch up soon
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Sep 2018 12:15
Awesome cant wait to try them ive been trying to get my head around orbiting objects I want to add a heli for the enemy
in blocklifter.
fubar
puzzler2018
User Banned
Posted: 9th Sep 2018 12:21 Edited at: 9th Sep 2018 12:22
Thanks - no worries

Just had a thought - with this technique - we could create something along the lines of



But not for now - but we do have to tools now to create something similar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Sep 2018 12:54 Edited at: 9th Sep 2018 12:59
Great work
The shattering box kinda works but you need to use random directions that don't change in the setup perhaps
The chopped up plane works quite well
and the mosaic im not sure what im meant to be doing but pressing space didn't seem to do much for me

All done with mesh very handy routines

Edit you should note that they don't need physics to work which can be very handy for example with blocklifter
using a physics shatter it caused a problem with the objects sometimes getting stuck and needs a gravity to work
but without physics a similar effect can be achieved. Somethink blink and I discovered if you just create an object
at each face setting physics they will push themselves away from each other themselves especially when shot and
they will fall back down to ground but the ground needs to be set as a static physics object to work that way
fubar
puzzler2018
User Banned
Posted: 9th Sep 2018 18:22 Edited at: 9th Sep 2018 18:24
Thanks

I have changed the/function createMeshObjectCylinderWithTexture(x#, y#, z#,height#, baseradius#, topradius#,segments#, top, bottom, color)

so it can have a different radius for the top of a cylinder to the bottom - so now could construct things like lighthouses or wind turbines

Have a play around with the "baseradius#" and "topradius#" value for different effects



For example

//lighgthouse
createMeshObjectCylinderWithTexture(0,0,0,30,10,3,10,1,0,MakeColor(255,255,255))

//goblet
createMeshObjectCylinderWithTexture(0,0,0,30,10,20,10,1,0,MakeColor(255,255,255))

Im exhasted now, so catch up in a few days
puzzler2018
User Banned
Posted: 9th Sep 2018 18:39 Edited at: 9th Sep 2018 18:47
Top Radius# = 57 creates the blades for the wind turbine



EDIT - change the segments# too for other nice effects - say top radius#=50 and segments=30

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Sep 2018 21:56
Very neat puzzler
fubar
puzzler2018
User Banned
Posted: 10th Sep 2018 19:43 Edited at: 10th Sep 2018 19:52
Thanks

I have been envisioning to shatter say like a concrete slab - or a thinker plane cube - to be able to build the triangles into chunks with a thickness - it doesnt look good with just a 1 pixel thickness. But say if had a 5 pixel height then
that would look more better i think -


like a block of triangulated cheese



This is where CreateMeshObjectTriangleBlock command comes in



To create your own triangle mesh with a height or thickness to something.

You will get the idea once i put into practice later on in the week
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 10th Sep 2018 20:36
This is an interesting concept, but wonder this potential? For something like granny smith and shattering a single window ovcaionsally it may work well.....buy for serious explosions why would you not use meshes/models? So model a car, but make each wheel, the bonnet, the boot, doors etc all a separate mesh, then fix them to the body. To explode then, just unfix them and then move them at will.

I've found creating an object from a memblock, above about 1000 vertices, causes a visual pause, and making physics objects even worse for some reason. If I make my landscape a physics object it literally takes several minutes, even when flat.

I doubt there's many games do this type of calculation I realtime. Even Red Faction, grand daddy of destruction, was really.jist lots of smaller objects cleverly built together to break.
puzzler2018
User Banned
Posted: 10th Sep 2018 20:43 Edited at: 10th Sep 2018 20:49
Thanks

How about making a "plane" of shattered objects built of that plane, whilst a game is "loading" so that they are already in memory then we have all the shattered peices already to go in game play...

All it needs is to have randomisation of a potential breaking point and they are already pre-built already in memory to be used to be shattering boxes.

Im working on the premise of minecraft (soreeee), we would only smash one block at a time so can re-use those pre-built shattered peices once per block

puzzler2018
User Banned
Posted: 15th Sep 2018 12:11 Edited at: 15th Sep 2018 12:12
This is what ive been meaning



with this primarily code makes it happen and chop into 4 peices




Attached statter3.png is what the above makesand cube.png for texturing the cube

Again the shattered peices are in the Peices type and they produce actual AppGameKit objects so you can move them around with 3D Physics etc

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 15th Sep 2018 12:24 Edited at: 15th Sep 2018 12:25
Where is my graph paper lol



This chops up a thicker triangular shape to produce a box which will then shatter up like the attached shater.png

Youll get the idea hoefully with this command

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 15th Sep 2018 13:22
Next task ill try to aim for is creating peices that chop up like the images attached

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 15th Sep 2018 16:24
I have now chopped it all up into 24 segments triangulated, to allow us to have a look and feel a bit better

To achieve it, I have to create new function having depth too - CreateMeshObjectTriangleChunk which will allow you to create any obling shape with 4 faces.






The 24 segments split up as per attached



Press Space to rotate and Enter to split the segments up
Enjoy

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 15th Sep 2018 17:37 Edited at: 15th Sep 2018 17:44
Added a bit of physics



Press Enter

Enjoy and catch up in a few days
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 16th Sep 2018 00:09
That's very impressive, puzzler. I want to have a rock crumble when the player mines it. I think I might have to use your code as inspiration.
puzzler2018
User Banned
Posted: 16th Sep 2018 00:27 Edited at: 16th Sep 2018 00:27
you welcome

rem out each of the commands in turn to see how it built up




Rocks uhmmm interesting object
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 16th Sep 2018 02:45 Edited at: 16th Sep 2018 02:46
My inspiration. Skip to 45 seconds.

puzzler2018
User Banned
Posted: 16th Sep 2018 09:49
Thats a good vid for ideas - cheers

for a rock think maybe siimpler to use the command

createMeshObjectTriangleChunk( 0, 0, 0, -size#, size# , 0, 0, size#, size# , 0,size#,0)


and put it into a few for loops for x,y,z with a bit of sin and cos in there too

let me have a think

I love the aluminum chop
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 16th Sep 2018 11:24
That's pretty neat Puzzler
fubar
puzzler2018
User Banned
Posted: 16th Sep 2018 12:48
Thanks

My next challenge like to try is to create an "ICO-Sphere" this will be the first stage of creating a rock

Im sure it can be used in a Minecraft clone, so it wont be wasted
puzzler2018
User Banned
Posted: 19th Sep 2018 12:53
Just had an enlightening and interesting idea from Blin0k - Cheers.

This is to do a proper importer to be able to work with these memblocks functions

So this weekend I will aim to do this importer :- will be able to import

- OBJ files (from blender and such like)
- Identify any materials associated with it to make sure you put them in the media folder
- All Vertices
- All UVs
- All Indices

and place them into the MESHID array I have been using through out this.

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 19th Sep 2018 14:38
I think all the work you have done on memblocks is great and the sharing of the code
behind them quite beneficial to many. I was just thinking tho with your experience
with the radio plugin perhaps you could make a list of commands and place into one
puzzlers dll which might make them more reachable to more novice style programmers
Especially if you had a thread like with the radio one that gave examples of using the dll.
The dll could also be shared on i beleive its github where TGC have made it open to
developers to share code they may or may not decide to use in future versions of agk

Just a thought as to how the handy new memblock functions could reach a larger
audience
fubar
puzzler2018
User Banned
Posted: 19th Sep 2018 15:14
Thanks

Although the radio plug-in was a one time thing. I haven't delved anymore into VStudio DLL creations.

All these memblock functions could be converted to C++ somehow to put onto GitHub for TGC to review to implement into AppGameKit Tier 1 in future releases.

But thats a long way off for me to challenge that - cause my knowledge of Tier 2 programming / C++ is non existent.

Nice idea though, but in the meantime, I shall keep cracking on with these.


fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 19th Sep 2018 17:07 Edited at: 19th Sep 2018 17:10
Quote: "Fair enough and its allot easier to make suggestions than actually do the work required."


you've created allot of good memblock functions and when I get a brainstorm for a project they will definitely get
some use. Nightdriving started out as a desire to move blocks in all directions inspired from the
Minecraft thread. Pixelated Labrynth evolved from your maze generation code. BlockLifter 3D
my latest started off as a cross between garbenjamin's global defence and one of your memblock creations. I learnt
new methods from blink0k that was quite good that allowed the data from a "obj" file to be read and used,
in particular the reading of vertices (Lines beginning with "v ". obj files a just text files). This method was used
to place objects at the vertices i had to check for duplicates but it looked allot better with the triangular image used
for the world object.


Keep up the great work
fubar

Login to post a reply

Server time is: 2024-03-29 05:32:57
Your offset time is: 2024-03-29 05:32:57