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 / limit to 3d objects+physics??

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 8th Jan 2019 23:38
I have been working on a 3d editor for some time, but after ages of coding I think i realized there is a limit to how many 3D objects i can clone or make:
example:


seems enough to make AppGameKit crahs out,at least for me!

so the approach of blockbilding for me is no good,well it is but would have to scale/repeat texture on blocks to use less..
Hail to the king, baby!
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 9th Jan 2019 00:29 Edited at: 9th Jan 2019 01:14
1100 spheres on my modest system is not an issue but the # of physics bodies are. consider reducing the # of actual physics objects "in play" at any given time?

if you could clarify "blockbuilding" a bit, i'm sure we could offer additional help. Ie, if its City Blocks you're building, i can't imagine that your entire City needs full-time physics when the player would only occupy a small portion of it at a time?

add: i tried separating the objects so they wouldn't touch and was still unable to pull off 1100 spheres with full physics but was able to do 1000 (both separated and overlapping) with ~100 FPS performance in both cases. I also reviewed a (brief) bulletâ„¢ manual looking for a maximum # of bodies, faces, etc, and found none. i think you may have found it otherwise, again, consider reducing the number of physics bodies in play at once (through masks or otherwise).
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 9th Jan 2019 01:52 Edited at: 9th Jan 2019 02:28
well,it aint a biggy,i can reduce the number of blocks used by scaling the objects and repeating the textures on them, but of course that knacks up my raycasting per block idea i had for a cubed maze type game!reading each block(tile), by blocks, think minecraft!! though the editor aint limited to just blocks! hmmm, masks i havent looked into yet. sorry yes it is obviously a physics issue and should be more clearer,though actually at the time i didnt know which anyhow! so thanks for clearing that up!
here is how far i got with it all before the limit horror:



as you see every 'block' the player walks on turns red,to tell me my system works! Unknowingly I was close to the limit then,the objects used is readout top left on level editor screen!
damn glad i created that objectcounter var and had it readout to me,as after i had shot that vid,i started filling in a maze within that empty room, obviously going way past 1000!
The errors it was throwing out in debug mode made no sense,object does not exist,when i knew damn well it should!
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jan 2019 02:42 Edited at: 9th Jan 2019 02:45
Maybe you could do it with math
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 9th Jan 2019 10:30 Edited at: 9th Jan 2019 10:34
I am about as good at math as I am at heart surgery,and i would really be dropping the physics totally then as it would be pointless..so awesome stuff like the character controller wold be pointless yet they are so frigging handy
Hail to the king, baby!
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 9th Jan 2019 19:31 Edited at: 9th Jan 2019 19:33
You can not set the positions or rotation of the object after it is made a physics object.
Incorrect.

Correct
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 9th Jan 2019 19:44
ah ok,thanks,but the limit still exist,least it just totally crashes out above 10xx
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 9th Jan 2019 20:32 Edited at: 9th Jan 2019 20:33
ok,I am taking the scaling of objects route,but mam having problems, using THIS model i want tehe texture to repeat no matter which way i scale the cube, but how, have tried firstly:



after loading the image, then after creating object,well cloning actually, and settings its image I use

sx# and sz# being scaling values, also sy# exists to scale the object along the y coords but it just doesnt turn out right and i aint getting it coz of course i have 3 scaling vars but just 2 params in SetobjectUVScale. the cube i made using blender and separated all faces
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jan 2019 20:39
What does it look like if you don't use SetObjectUVSacle()?
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 9th Jan 2019 20:50
looks ok,as expected,repeated once!
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jan 2019 21:01
So if it's scaled x 4 Do you want to see 4 images per side instead of 1?
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 9th Jan 2019 21:21 Edited at: 9th Jan 2019 21:25
yep,in some try i got it ok on faces but one where it squashes the image *scale on one face
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jan 2019 21:53 Edited at: 9th Jan 2019 21:53
Ok so if you scale the object up then scale the UV's down. Maybe try this
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 9th Jan 2019 22:55
yhe tried that,i get portions of the image then, i have noticed it changes matters when trying different uv mappings in blender,but cannot find one that does the job, tried em all
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jan 2019 23:21
Your cube has a very weird texture map. Using the attached cube works
So your UV scale is the same as your object scale

Attachments

Login to view attachments
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 9th Jan 2019 23:40 Edited at: 9th Jan 2019 23:41
for me it is repeating the texture on each face 4 times though,also try scaling with say 3-2-3 and yo will see!
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jan 2019 23:56
I thought that is what you wanted?
What exactly do you want?

If by 3,2,3 you want the texture to repeat 3 times along the x,z planes and 2 along the y planes then i'm not sure that is possible without having separate meshes for each side of the cube
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Jan 2019 00:26
yeh that is what i need,just dont know how!
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Jan 2019 13:54 Edited at: 10th Jan 2019 14:36
ok, i got it working,but not using an external object, just using createobjectbox command...


But indeed it was simply setobjectuvscale(obj,0,sx#,sy#)

you defo need to use setimagewrapU and setimagewrapV,setting them both to 1
At the very least anyhow this cuts down the obejcts needed for the walls, the roof I might just use a plane primitive, so i might just be able to still use single blocks where needed for flooring,setting them at specific values depending what i wanna do,the only real drawback is that with scaled faces, the lighting aint so great as it was before:



Still though it was probably very inefficient to use hundreds and hundreds of objects!

This engine I have coded can continue! I have 3 game modes so far,can use the same level for any mode, first person mode,as seen in video, platformer mode for a platform game obviously, and roller mode to tilt control a sphere..... I just change the value in the mode edit box to achieve this!

I have coded some pretty neat features editor wise,
multi select/edit objects with mouse
clone 3d cursor to any object simply by pointing to the object with the mouse and pressing v
master slave relationships between objects, pretty handy for door/lever setup or whatver really!
waypoints for enemies to follow
basic A.I fight or flee, if the enemy is near the player then it will break out from its waypooint patrol and attack.. by attack they simply move toward the player for now!
Pressing H hides/unhides the whole panel for full screen uncluttered editing of level.
and of course i can test the level anytime within the editor by pressing T!
But yeh,cool,just 6 objects used there..well... 5 really..

I doubt it will be polished enough to distribute this anytime ever, but it is solely for making my games the way i want, simple changing of values in boxes and a grouping system.
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 11th Jan 2019 00:10
hmm,thought I had the texturing right,but have not yet!
using the agks 3d box,and scaling it on the X axis:




the end faces gets the texture squashed onto them, how can I fix this,tried allsorts with code and a model from blender,trying all uv unwrap modes,but getting nowhere!
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 11th Jan 2019 00:39
I think you'll need to use meshmemblocks because there is only one UVScale for the entire shape.
With Mechmemblock you can set UV's for individual vertex
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 11th Jan 2019 02:05 Edited at: 11th Jan 2019 02:21
mesh mem blocks eh, better be easy to learn!!
do you have an example or maybe make one for me?

my engine simply clones objects,i just need something that friggin works with the scaling!
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 11th Jan 2019 04:16 Edited at: 11th Jan 2019 04:16
It not easy. So do you want to sale to any size x/y/z or are there maybe half a dozens sizes that will work?
Do you need to do this every frame or just at the beginning?
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 11th Jan 2019 13:42 Edited at: 11th Jan 2019 13:53
I need it to scale/repeat any axis within the editor, then I can test the level within the editor
most of the coding is done for all that, so just have to click a level together and like magic it runs from the editor
arf!
I could workaround the problem by placing a single block on the end of all long blocks,but well... that is crap and too inconvenient for level design
had a brief gander at mesh mem blocks,and yeh,i got lost, though i gathered it uses just 2 values still for uv?!
Thank you very much if you can help!!
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 11th Jan 2019 22:56 Edited at: 12th Jan 2019 00:53
ok,decided today to have a go myself,here are the results:

Obviously I am on the right track but not getting it still


Also I noticed it depends just how the model is unwrapped

here is the code use:




the model use d is AGK's built in box primitive
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 11th Jan 2019 23:51 Edited at: 12th Jan 2019 00:39
nope! still stuck! help anyone?
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Jan 2019 02:42 Edited at: 12th Jan 2019 02:43
I could do this but i would need to create a .obj file for each variation. Would that be ok?
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 12th Jan 2019 02:53
if that is the only solution then sure!
Anything helps as this is unreal,i nearly have it thoughl or at least better
It maybe be just finding the right vertex # for the job
Hail to the king, baby!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Jan 2019 03:04
I'm sure puzzler could do this with MeshMemBlocks but i have no idea. I'll have a go at creating a .obj
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th Jan 2019 09:32 Edited at: 12th Jan 2019 10:01
Think puzzlers already got a memblock solution to having multiple textures on a cube like that
But from my understanding I don't think the problem needs to be so hard. If you have a cube that
has been textured already with all the sides

for example a texture like below could be used

it should just be a matter of getting your textures for the sides sized and pasted to your main image like above

with the box obj like


PS I haven't been following this thread but thought that may help


and my MeshExtrude tool should help with moving vertex's
https://forum.thegamecreators.com/thread/223578

fubar
puzzler2018
User Banned
Posted: 12th Jan 2019 10:41
What would we like to acheive here -- im seeing memblocks , cubes and UVs.

Ill have a read further up

puzzler2018
User Banned
Posted: 12th Jan 2019 10:53 Edited at: 12th Jan 2019 11:03
@Shadey - i see it just been a conversation about multiple textures around a cube - it looks like a look and feel of a minecraft cube - is that right?

Ok cool - for a multiple textured cube, we require a texture atlas first... and then using UV coords that corresponds to the atlas map

Something similar to the attachd

The whole atlas image starts at

0,0 1,0

0,1 1,1

This is for a whole image as 1 texture, but if we split it up - the attached is split up into 4 small textures

so we half the textures UVs

0,0 0.5 , 0 0,1

0, 0.5 0.5, 0.5 0.5 , 1

0., 1 0.5 , 1 1, 1

Shall come back later today to implement this attatched image onto a cube for you

EDIT - will work out the correct scalling for it too - so it runs the same texture say if you had a long rectangular shape cube

We will use the Atlas map Capture3.png example, its a 256 x256 image that is quartuered up to 128,128 as the centre point - the UV for that centre will be 0.5,.0,.5 (half the whole image)

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 12th Jan 2019 12:18
Ok cool-something to get you on the way


Here is a meshmemblock version to create a multi-textured cube, use the OBJ and Texture.PNG attached into your Media folder too

Press Left button to rotate the final cube object to see


Attachments

Login to view attachments
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 12th Jan 2019 13:17 Edited at: 12th Jan 2019 13:18
ok thanks puzzler, dont quite know how I am gunna weld all that that into my engine though,i nearly did the problem myself in a wonkey kinda way and already suspected the way the model was UV'd
which kinda made me cringe coz i frigging hate messing with em!!
Hail to the king, baby!
puzzler2018
User Banned
Posted: 12th Jan 2019 13:28
ok- we will be here to help where ever any issues are

Here is a centralised version of the cube and scaled


puzzler2018
User Banned
Posted: 12th Jan 2019 13:48
Also chafari done some nice little tricks with Texture UVs on objects too

https://forum.thegamecreators.com/thread/223557#msg2636427
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 12th Jan 2019 15:19 Edited at: 12th Jan 2019 15:34
just a guess,but shouldnt the function CreateObjectFromMeshWithUVTexturing() be ending with cube and not id??
like..
Endfunction cube
ah never mind,i dont think it matters,but anyways try one is a fail to get this into my code...
hmmmmm


tried your code by itself,best thing, hmmm, what i need is the end of a scaled block on the x-axis to stay one size but the top/bottom and sides to repeat and not stretch!
Hail to the king, baby!
puzzler2018
User Banned
Posted: 12th Jan 2019 15:39
Got ya.... I thought that too.

Let me have a think on best how to acheeive that

Yes I need to review that function too
puzzler2018
User Banned
Posted: 12th Jan 2019 15:52 Edited at: 12th Jan 2019 16:06


Produces the pic

I see what you mean

Give me 2 ticks

EDIT -Try the attached Texture.PNG on the code above-bit messy way of doing it, but will work on it


Doubel EDIT - maybe use a UV texture which works with something like Txture2.PNG -top is top of cube, middle is the sides of cube and bottom (RED) the bottom texture of cube

Bear with me while I tweak the UV coords for that

Treble EDIT - Dang!!! Texture2.png idea wont work cause a full texture size needs to be power of 2 - that file isnt. The best one really would be the code above and Texture.png

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 12th Jan 2019 16:41
and that code i provided doesnt do the sides very well - they are also UV scaled too, so need to change the UV coords / scale# amount to rectify that



Enjoy!

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 12th Jan 2019 18:17
This is still not working,

What if we scale a box in all directions - its not happening..

But I have just had a brain storm

how about we build a box with 6 planes faces and make use of the MeshIndex to assign a different texture to them

top.png
side.png
bottom.png

and construct the planes to make a cube onto a different MeshIndex

MeshIndex 1 will be top.png
MeshIndex 2 will be side.png
MeshIndex 3 will be bottom.png

Ill construct this method a little later - brain requires a refresh

Attachments

Login to view attachments
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 12th Jan 2019 18:19 Edited at: 12th Jan 2019 18:20
man,this is a headache,i looked into chafari thread and it was basically the route i was going, but still i implemented his function as it works easy

Above is one single object for whole floor,and a few lights thrown in
I mean i could rotate the object for outer sides also but tis the inner walls of a maze, could use single scaled blocks for inside maze walls i guess.. or just cap off scaled ones with singles if you know what i mean..
messy stuff though
I will look into your code puzzler..tnx
Hail to the king, baby!
puzzler2018
User Banned
Posted: 12th Jan 2019 18:41 Edited at: 12th Jan 2019 18:42
Ok..

Programming can be tough at times

Here is how I would combine objects to 1 mesh with different colours/textures assigned to each MeshIndex



More tomorrow to build these planes into a cube - promise...
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 12th Jan 2019 19:12 Edited at: 12th Jan 2019 19:19
I use cloning of objects,dunno if that matters:
when i press space-bar to put down a object here is what i do


example:


this gets the pic above with as i said using the function by chafari
of course the asset[] array gets loaded with objects Id's that are preloaded...

If it can be made to be used like above,your stuff, then i would be well happy!!
Hail to the king, baby!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th Jan 2019 19:20
MY 2 CENTS
I think the following functions of puzzlers is dam close just doesn't use planes
fubar
puzzler2018
User Banned
Posted: 12th Jan 2019 19:22
You mean into a meshmemblock to save you FPS?? also to allow different textures for the top,sides and bottoms?

Sure, no worries ill have an attempt at that tomorrow for you
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 12th Jan 2019 21:06 Edited at: 12th Jan 2019 21:22
I dont think i will be cloning an asset your way,but that is fine,as long as i can say..


obj=getmeafunkycube(blahblah) type function call then all is good,as i can just operate if a cube is selected to use! every other will simply be cloned,if you know what i mean
so
if assetpointer=11 //where the cube asset is
obj=getmeafunkycube(blahblah)
else
obj=cloneobject(asset[assetpointer].assetid)
endif

or something along them lines,just slight moddin

in the engine I am using global variables sx#,sy#,sz# for scale vars, and cx#,sy#,cz# for 3d cursors coords, if that helps! when scaling/placing a object
when I do the scaling using the edit boxes I actually scale the cursor up also before placing a object.. hence the global stuff really.
Hail to the king, baby!
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th Jan 2019 21:11
still easier to just load a cube obj from the start that's texture mapped like above
then just use the drawing commands or pasting image commands to the image
the cube uses. This would also be a very quick way of doing it and doesn't need
extensive and complicated memblock work just AppGameKit normal commands
fubar
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 12th Jan 2019 21:13 Edited at: 12th Jan 2019 21:16
I dont think it is that easy though when you have just 2 uv values yet 3 ways to scale, a lot of it is to do with how a model uvwraps,which varies depending on who did it in what!
Then again seen as I am nearly clueless on this part I could be wrong
Hail to the king, baby!
puzzler2018
User Banned
Posted: 12th Jan 2019 21:22
We will get you there - dont worry

Login to post a reply

Server time is: 2024-04-16 21:28:21
Your offset time is: 2024-04-16 21:28:21