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 / 3D Tank !!!! and loadobject + childs + textures help need

Author
Message
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 26th May 2020 09:15


it occurred to me to create a model of a tank and share it, so they can make a game with this model, if they want, and they can also help me understand how this model could be loaded with AGK.

I think in the history of every developer, there was, or should be, a tank game ... right?

Tomorrow, I will try to load the 3D model in AppGameKit, if anyone wants we can do it together.

the model is free to be used by you.

regards!!!
Santiago

Attachments

Login to view attachments
swift-au
4
Years of Service
User Offline
Joined: 13th Apr 2020
Location:
Posted: 26th May 2020 11:20
Cool tank! Definitely a fun idea to build an old school tank battle game!

I've attached a simple example for loading the model and applying the textures (no guarantee the textures are assigned to the right parts, but that's easily fixed!)

Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 26th May 2020 11:43
should be able to set an image to each child object ie
SetObjectImage(GetObjectChildID(tankID,1),loadImage("cannondif.png"),0) should be possible but GetObjectNumChildren ( objID ) reports 0

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
swift-au
4
Years of Service
User Offline
Joined: 13th Apr 2020
Location:
Posted: 26th May 2020 12:13
Quote: "should be able to set an image to each child object ie
SetObjectImage(GetObjectChildID(tankID,1),loadImage("cannondif.png"),0) should be possible but GetObjectNumChildren ( objID ) reports 0
"


It consists of multiple meshes, not multiple child objects.

Here's some updated code (download "Tank Test.zip" first) which also rotates the turret and cannon. Just a quick hack, but demonstrates that the model works quite nicely.

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 26th May 2020 12:43
Quote: "It consists of multiple meshes, not multiple child objects."

that's fine aslong as the meshes are in the correct order which they seem to be with your first example

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 26th May 2020 16:09
Hi, i load your zip and works perfect... is excelent!!

what change you make to make it work?, what is the diference in your .x and my?, i am exporting in bad way?

the idea is get all entity to control, like wheels, and tracks...

but in your example i can't get the wheels...


that you open the model and textured is a very good thing, how you do that?

Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 26th May 2020 16:46
i download the ultimate Unvwap, but its 'pay licence,

I export now my .x to text, but anyway, AppGameKit dosen load, why if i export my .x agk no open it?
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 26th May 2020 18:38
i make the wheels turn, but i can't make it with my own 3d .x exporter. only works with your file





swift-au
4
Years of Service
User Offline
Joined: 13th Apr 2020
Location:
Posted: 27th May 2020 04:34
Quote: "i make the wheels turn, but i can't make it with my own 3d .x exporter. only works with your file"


If you have your vertex groups match your materials, it can then be easily loaded as per my example. I'm sure you could make the model work as you have it, but you'd have to manually assign the textures to each mesh.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th May 2020 05:19 Edited at: 27th May 2020 06:46
thought you may want to keep track of the id's and names


PS uses the tank in swift-au zip file but I added the files if that's easier for anyone

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk

Attachments

Login to view attachments
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 27th May 2020 15:25 Edited at: 27th May 2020 15:27
ohhh

thanks for this example!

i have to add this line, because no work when try to open 3dfile







This part is very usefull for me, because until now i don't know hot to have arrays in types

i'm feels like a prehistorik man who found a spaceship. (im the prehistorik man, and agk the spaceship)

Quote: "If you have your vertex groups match your materials, it can then be easily loaded as per my example. I'm sure you could make the model work as you have it, but you'd have to manually assign the textures to each mesh."


i need to learn how to do that, or understandit, maibe i allready do it and i don't know.
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 27th May 2020 15:26
What i noted, AppGameKit load the 3D files with bones or childs, only if you set KEYFRAMES in 3d software.

without keyframe, you don't have this bones or childs....

i think this is how AppGameKit read the 3d file, because in other software i get the bones and childs without set keyframes...

(keyframes) i only use when i have animations.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th May 2020 17:33 Edited at: 27th May 2020 17:52
Hi there.
I will try to show how appgamekit works...sorry if erratas as I'm writting with my left hand....I can't use the mouse and this is being hard for my to send you my snippets.
In most 3D proggraming lenguages we load our 3D objects and it will appear textured ...in agk this is not like that....we have to load our 3D files , load an image and then assign the image as texture.
When we make our objects in any 3D software, for example just two boxes and we assign a texture to both boxes for example wood1.png ....when we load the object in agk ...say boxes.x we will realize that our objetc load correctly but when we load an image and texture our object boxes.x both boxes will have the same material "texture" we can not add a differnt texure to the second box....why? tha is because appgamekit will make groupes with all meshes that share rhe same texture.....knowin this...we only have to add different texture image to every mesh in scene in 3DMax Blender or whatever sofware you use. Imagine now 20 boxes all with different texture ...we export to .x and we load it in agk...we will have 20 boxes on screen and now with code we can texture all different meshes with a different image. Now imagine your tank completly textured ...when you load in agk an you try to rotate one of wheels... you will see that all wheels rotate in a wrong way because probably you use the same image and agk just made groupes to all meshes using the same texture.
When we export to .x from 3DMax and we have all textures in a single image you will see your object correctly when you assing te image to it, but you won't be able to animate the turret or wheels. So we have to make our object as ever we made, but when we prepare to export to agk just remember...make a copy an modify one by one the texture image of all limbs and when you finally use ir in agk jus load an assing one by one meshes your atlastexture. Sorry for this long explanation and as an exercisr, just make two boxes and export from Max to .x
I ever use .x as this format is easy to edit even in notepad.

Cheers.
Edit.
Sorry for all erratas...i can not edit them from my phone and left hand
I'm not a grumpy grandpa
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 27th May 2020 18:21
Hello Chafari, thanks for your effort, everything is very clear.
consult off topic, do you speak Spanish?


Quote: "knowin this...we only have to add different texture image to every mesh in scene in 3DMax"

Without a doubt, this solution is not ideal to work properly, it is easy when we have a box, a chair, but with more complex objects this generates an absurd method of working.



I think this is misfocused, and would be fixed by a properly working 3D file upload. which generates a tremendous complication when working with 3d models.

Currently I get recognized by "Bones" with which I can modify elements, such as the propeller of my plane.
I can control the bone, which controls a mesh, but I don't have access to the mesh.

I can't find a function that tells me, that mesh is tied to a bone, and a bone is not a mesh, so I can't make that object invisible or manipulate.

"Childs" lose their name when loaded into AppGameKit, making it impossible to manipulate them. they are not loaded properly either because they get lost in the pool.

Why would you want grouping? In some cases it is very useful, but it should not be the only way to load a 3D model by default.

Imagine that a user of a game wants to make his plane or ship, or tank, and put it inside your game. That user would have to be an expert on the subject in order to generate a 3D file that aligns with all these requirements.

I can't find an example of how to work properly.
Thanks to the zombie.3ds file that was shared with me, I could see that only if you generate the Keyframes will you be able to load the childs and bones to manipulate them.


I believe that all this would be solved with an adequate load of the 3D file. that grouping is optional, and not having to generate different materials in order to obtain childs or elements.

Materials, technically, are applied to objects, but you should not control them.
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th May 2020 18:39 Edited at: 27th May 2020 18:44
Hola Santiago3D. Yo soy de España y hablo español.
I know what you mean about the way agk works. The mentioned method if not the best and are better for static scenes. To automatize the whole prosses we have to fiddle with de code.
Edit
No se cuanto tiempo tendre que estar sin tocar un teclado....me rompi el codo y la muñeca y eso me llevara algun tiempo.
I'm not a grumpy grandpa
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 27th May 2020 18:43


now i am using .3ds temporarily, because .x is not taking my bones or childs.

thanks to the bones, I can manipulate the helix (Bone15 "helice1")

but the bone is not a object, is like a node that control a mesh? i think.

If only you could have childs properly loaded, with your name and presence, it would be ideal to manipulate.

For example, if I know where my wheels are, I can do the landing physics.

there are other childs, like the pilot, it should only be visible from external view, and be hidden when I am in the camera inside the pilot.

but the pilot, is a mesh like the rest, with the same treatment but it does not appear in childs, or bones.


canon1,2,3, .... I use them to detect if the plane has cannons, and from there the shots would come out, I don't need it to be a bone. I just need to know if it is present, position and orientation.

Nor are "Hardpoints" visible, objects that indicate where a plane hangs torpedoes or bombs.


maybe they are among the children who have no name ... I don't know
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 27th May 2020 18:46
Quote: "Yo soy de España y hablo español."

excelent!!! i send my discord


my discord id
Santiago3D#5672
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th May 2020 18:50
Exactly! In most lenguages bones are the skeletal rigging of animated objects but we can animate objests just rotating meshes.....agk works i n a different way. In the case you are not going to export to android, you could use Dbpro instead.
I'm not a grumpy grandpa
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th May 2020 18:55
I'm an old man and I have not facebook nor tweeter nor wassap....I woud like to help you here somehow
I'm not a grumpy grandpa
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th May 2020 19:57 Edited at: 27th May 2020 20:03
arrays in types are very handy and I know you just learnt types
that's why I gave you examples of [] and [7] so you could learn

and its been done in such a way that its easy to have 100 tanks with the same parameters


Quote: "SetCurrentDir("")"

that's a handy command but all images models etc should be placed in the media folder then its not needed

PS anyway I love your work and were all here to help, help like TGC forums you wont get with other programming forums theyre rude

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 27th May 2020 20:09
thanks guys!!!

yes, im very happy with all the help i recive, and happy to know new people!, thas is good for me, know people crazy for coding like me... im not the only one!!!



now i using .dae format, and i make some progresss

Santiago3D
3
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 27th May 2020 20:22
ok, i have my .dae airplane

i use .dae, better than .3ds

i have childs and bones.

this is a very good progresss!!





i share the function that i using now to load3dmodels





this is the best result at the moment...

with childs, i can manipulate, hide, objects, and bones i go to use to move and rotate parts...


thanks to all for the help!!


fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th May 2020 20:58 Edited at: 27th May 2020 23:42
the function is great you may want to pass your types as reference
https://www.appgamekit.com/documentation/guides/12_array_changes.htm

It may be handy in the future if you keep track of all image ids
so with the code I supplied above you could function load_3d_object(path$, file$, scale#,mytank ref as tank[])
and call it with load_3d_object(path$, file$, scale#,tank)
this would keep track of all the ids and modify the tank array in main loop

for example making it easy if you wanted to flash or tween different images, delete them etc
rather than just have images etc and having no idea of which id they have


the missile function needs work
I thought this line in the missile function setobjectrotation(projectiledirbox,GetObjectBoneWorldAngleX(tank.ID, tank.cannon),GetObjectBoneWorldAngleY(tank.ID, tank.cannon),GetObjectBoneWorldAngleZ(tank.ID, tank.cannon))
the x angle was out so I thought would fix it

but i was wrong

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk

Login to post a reply

Server time is: 2024-04-19 22:13:22
Your offset time is: 2024-04-19 22:13:22