Author Topic: 3D Entity System [EN]  (Read 55916 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
3D Entity System [EN]
« on: 2008-Jun-17 »
« Last Edit: 2011-Sep-09 by Kitty Hello »

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Re: 3D Entity System [EN]
« Reply #1 on: 2008-Jul-04 »
So how is work progressing on this code? From what I see on the german thread there is a lot going on, is it stable yet? Should I bother look at it or are you going to change lots of stuff and only deliver german documentation?

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: 3D Entity System [EN]
« Reply #2 on: 2008-Jul-04 »
for me it's working great just as it is. I'm trying to create a simple Space-Shooter with. The basic movements are very simple to realize. Give it a try ;) Perhaps if you work with it, you will have new ideas what's missing.

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Re: 3D Entity System [EN]
« Reply #3 on: 2008-Jul-05 »
Well, one idea would be to announce here (in english) when there is an update instead of having to download and do a file-compare to figure what was done :-)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: 3D Entity System [EN]
« Reply #4 on: 2008-Jul-06 »
Apologies! The changes are at the top of the T3D.gbas file (or whatever it's called)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: 3D Entity System [EN]
« Reply #5 on: 2009-Jan-25 »
Hello,

It did work/compile mid 2008 without problem.
I downloaded the new system and tried to compile it, the program crashes now.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5116
  • O Rly?
    • View Profile
Re: 3D Entity System [EN]
« Reply #6 on: 2009-Jan-26 »
Work fine....
No Crash :|
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: 3D Entity System [EN]
« Reply #7 on: 2009-Jan-26 »
You try it on win xp ?

I will debug the crash if you cant find the problem.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Re: 3D Entity System [EN]
« Reply #8 on: 2009-Feb-08 »
Is there any way of rendering shadows with the Entity system? Or is there some way I can get shadows anyway?

I tried EntityEnableShadow(new_obj.obj, TRUE) but this just makes all textures darker...
« Last Edit: 2009-Feb-09 by Moru »

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: 3D Entity System [EN]
« Reply #9 on: 2009-Feb-09 »
Yes, see the demo. Did you put the light source to a proper place?

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1622
  • Particle Hawk
    • View Profile
Re: 3D Entity System [EN]
« Reply #10 on: 2009-Feb-09 »
Definetly some bug, i redownloaded, and recompiled, the demo crashes on startup. (see screenshot)

I think its an issue with the arrays....i find this is typical, it is what usually causes a program to crash.
I tried different ways of solving it, but i have not succeeded.

This is the source of the crash:

Code: (EntityInternSetCamera()) [Select]
X_CAMERA o.Mg[12], o.Mg[13], o.Mg[14], o.Mg[12]+o.Mg[8], o.Mg[13]+o.Mg[9], o.Mg[14]+o.Mg[10]

If i REM this out, the program starts , but as i move the entity with the arrow keys, it crashes again.

[attachment deleted by admin]
« Last Edit: 2009-Feb-09 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Re: 3D Entity System [EN]
« Reply #11 on: 2009-Feb-09 »
The demo runs just fine for me as long as I don't press the [ and ] buttons.

Light is placed above and to the side, like this:
Code: (glbasic) [Select]
light = EntityCreateLight(RGB(255,255,255))
EntityMove(light, -150, 150, 150)

also, if I activate the bumpmap with just a plain white .png the program just exits without errors when I add the second type of objects. One type is fine but the second (in whatever order) I add just gets me thrown out.

When I add a camera with this code:

Code: (glbasic) [Select]
RESTORE cameras
FOR n = 0 TO 4
READ cam.x, cam.y, cam.z
READ cam.rx, cam.ry, cam.rz
cam.obj = EntityCreateCamera()
EntitySetCameraRange(cam.obj, 1, MAX_RANGE)
EntitySetPosition(cam.obj, cam.x, cam.y, cam.z)
EntitySetRotation(cam.obj, cam.rx, cam.ry, cam.rz)
DIMPUSH camera[], cam // Add the camera to the array of cams
DEBUG "obj:"+camera[n].obj+"\n"
NEXT
The entity ID I get back is as follows:
obj[0]:0
obj[1]:1
obj[2]:0
obj[3]:1
obj[4]:0
When I try to activate those cameras nothing happens except the skybox disappears. Is there some problem with creating the skybox as in the tutorial?

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: 3D Entity System [EN]
« Reply #12 on: 2009-Feb-09 »
hmm the entity id should never be 0. In this case something went wrong when creating the entity. Is it possible you post your complete project?

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1793
    • View Profile
    • Homepage
Re: 3D Entity System [EN]
« Reply #13 on: 2009-Feb-09 »
I have cut out everything except for this part of the project, the rest is not used:
CreateSphere() is from the samples.

Code: (glbasic) [Select]
Init3d()
END


TYPE OBJECT // The 3D objects
obj // Object ID
x; y; z // Position
dx; dy; dz // delta for movement
rx; ry; rz // rotation
ENDTYPE


FUNCTION Init3d:
LOCAL cam AS OBJECT

// Load textures
gfx.brick1 = DynLoadSprite("texture/brick1.png")
gfx.concrete1 = DynLoadSprite("texture/concrete1.png")
gfx.concrete2 = DynLoadSprite("texture/concrete2.png")
gfx.concrete3 = DynLoadSprite("texture/concrete3.png")
gfx.concrete4 = DynLoadSprite("texture/concrete4.png")
gfx.concrete_purple = DynLoadSprite("texture/concrete_purple.png")
gfx.cracks = DynLoadSprite("texture/cracks.png")
gfx.diagonal = DynLoadSprite("texture/diagonal.png")
gfx.sand = DynLoadSprite("texture/sand.png")
gfx.sunrise = DynLoadSprite("texture/sunrise2.png")
gfx.white = DynLoadSprite("texture/white.png")

RESTORE cameras
FOR n = 0 TO 4
READ cam.x, cam.y, cam.z
READ cam.rx, cam.ry, cam.rz
cam.obj = EntityCreateCamera()
EntitySetCameraRange(cam.obj, 1, MAX_RANGE)
EntitySetPosition(cam.obj, cam.x, cam.y, cam.z)
EntitySetRotation(cam.obj, cam.rx, cam.ry, cam.rz)
DIMPUSH camera[], cam // Add the camera to the array of cams
DEBUG "obj:"+camera[n].obj+"\n"
NEXT
active_cam = 4 // The last added camera is the active camera

light = EntityCreateLight(RGB(255,255,255))
EntityMove(light, -150, 150, 150)

// Skybox (or ball in this case)
CreateSphere(0, 2, 35, RGB(255,255,255))

ENDFUNCTION


//! Load sprites. Animations and sprites seems to share ID's
FUNCTION DynLoadSprite: file$
    LOCAL free_texture
    free_texture = EntityGetFreeTexture()
    LOADSPRITE file$, free_texture
    RETURN free_texture
ENDFUNCTION

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: 3D Entity System [EN]
« Reply #14 on: 2009-Feb-09 »
its hard fo find an error in this snippet. Is not running without several edits.

a few remarks:
- did you define variable MAX_RANGE ?
- your function DynLoadSprite is not needed, use EntityLoadTexture instead, it does what you want

perhaps you could post the complete code without graphics?