Author Topic: Glib : a 3D graphics axe library  (Read 91082 times)

0 Members and 2 Guests are viewing this topic.

Offline Dapianokid

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 539
  • Rating: +46/-27
  • That one dude
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #195 on: October 02, 2013, 03:38:16 pm »
I can see about maybe attempting to document the features of the lib better, if I ever get around to testing it myself. I may use it for a flying camera Rubik's cube sim for the 83+SE... It's very promising and extremely impressive. I wish Axe was for the CSe, too...
Keep trying.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GLIB a graphics axe 3d librairy
« Reply #196 on: October 02, 2013, 04:36:41 pm »
Axe for the CSE would probably not be able to handle 3D this complex, though. Textures would have to be made of small lines rather than an entire filled area.

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: GLIB a graphics axe 3d librairy
« Reply #197 on: October 14, 2013, 02:42:20 pm »
First of all, sorry for the late reply, I promised this post over a week ago, but something came inbetween and after that, I kinda forgot about it...

Anyway, I'll start with the final platform, the one you can walk under. It's basically the same as the previous one, but with an added condition:
if(X >= Floor.Xstart && X <= Floor.Xend && Z >= Floor.Zstart && Z <= Floor.Zend && Y <= Floor.height && Y > Floor.height-Floor.thickness){
    FallSpeed = 0;
    Y = Floor.height
}
This will give you a platform with the top at floor.height, and it isn't infinitly thick anymore. It is reccomended to give each platform a thickness of AT LEAST the terminal velocity (or the maximum speed the player can fall in that area of the level), otherwise, it is possible for the collision detection to 'miss' this platform, causing the player to just fall trough it.
If you don't add anything to this collision detection, it will act as a 1-way platform, which means that if you jump while you're beneath it, you will go trough and land on the top. If yoou don't want this, you can add a 2nd collision for the bottom, or a 2nd platform right beneath it, which on collision only sets the fall speed and doesn't set the Y-coordinate.

Before we start with walls, there's still something platform-related that may also be usefull for some games: ramps and tilted platforms.
It's actually quite simple: Where you first used a fixed value to determine the height of the platform (in the example: Floor.height), you use a simple calculation based on the X and/or Y coordinates. So, if you want a ramp with a 45° angle around the X-axis, you check if Y<Floor.geight+Z, where Floor.height is the lowest part of the ramp. If you want a different angle, you can divide the Z by a number, if you want it more steeph, multiply the Z by a number (multiply Z by the tangent of the angle, if you like angles better). You can also use a different axis than the Z-axis, and you can also use other functions than simple linear ones, but keep in mind that more complex functions take longer to compute.
Also, this is still simple, vertical-only collision detection, not a physics simulation. It wil allow you to walk up any ramp, no mather how steep, but it won't let you slide down a ramp.
If you want to use this for tilted platforms, it's often best to use the same function for both the top and bottom of the platform, to give it the same thickness everywhere.

If you still want some other kind of platform, feel free to ask, and I'll look into a way to code it.

Now, the walls. They are pretty simular to the platforms, just using other axes and you don't have to mess with the fallspeed.
Let's start with the most simple kind, as we did with the platforms:

World borders
This one is basically the same as the first 'platform', as it is an infinite plane and it's impossible to walk trough. The only practical use is 'locking' the player in a certain area. It might seem rather useless at first, but considering the limited hardware of the calc, overflows will occur if the player moves to far from the center of the world, so you might want to keep him close to the center.
The code is very simple:
if(X > Xmax){
    X = Xmax
}
This makes sure that the player can't move beyond Xmax on the X-axis. You can use 4 of those walls to define the uncrossable world borders.

single-sided walls
Because walls with infinite thickness are rather useless, we'll move straight to single-sided walls.
The code is quite similar to that of the one-way platform:
if(X > wall.X && X < wall.X+wall.Thickness && Z >= wall.Zstart && Z <= wall.Zend && Y >= wall.Ystart && Y <= wall.Yend){
    X = wall.X
}
You can leave out the part dealing with the Y-axis if you don't need walls with a particular height. It's reccomended to do this if you don't have an open space above or below the wall.

This will create a wall alligned to the Z-axis. To allign it to the X-axis, replace all Z's by X's and vice-versa. The thickness of the wall should be at least the (max) walk speed of the player, to avoid the player walking trough it. To avoid graphical glitches, offset this wall slightely from the graphical wall.

double-sideed walls
Simular to the platform, the single-sided wall will only stop players comming from the right way. If you need a full solid wall, you have to use two walls, like this:
if(X > wall.X && X < wall.X+wall.Thickness && Z >= wall.Zstart && Z <= wall.Zend && Y >= wall.Ystart && Y <= wall.Yend){
    X = wall.X
}
if(X < wall.X+wall.Thickness && X > wall.X && Z >= wall.Zstart && Z <= wall.Zend && Y >= wall.Ystart && Y <= wall.Yend){
    X = wall.X+wall.Thickness
}
This creates a wall that is solid from two sides, but if you walk into the ends, you'll ennd up at one side of the wall, instead of stopping there. If you want to stop there, add single sided walls at the ends, alligned to the other axis than the main wall.

You can make the top and/or bottom of a wall tilted, or follow a function, in the same way as with the platform. If you want to use walls as sides of a platform with a non-level top, it's reccomended to do so. And if you're dealing with a ramp, don't add a wall where the tilted edge connects to the ground, and if you make the walls of the triangular side stop a bit in front of that angle, then you don't have to walk up the ramp from the edge where it connects to the ground, but you can then also walk onto it from the sides where it is still low.

This ends the walls part. If you have any questions or if you want me to look into an other type, feel free to ask.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #198 on: November 05, 2013, 12:30:30 pm »
Well some screen about what I've done recently  :P  : polygon clipping

The shadow thing strangely make everything crash in Wabbit (it open the debugger automatically each time), whereas the prog work fine on the calculator  :crazy:
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: GLIB a graphics axe 3d librairy
« Reply #199 on: November 05, 2013, 12:53:51 pm »
This looks great, and it seems to be fast too.

However, sometimes, there seem to be glitchy horizontal black or white lines. Does this happen on a real calc as well or is it because of the screen capturing software?

BTW: does this already work for all polygons or only solid black ones?
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #200 on: November 05, 2013, 12:58:06 pm »
no, the glitchy line appears everywhere, due I think to a value who become is some case negative in the triangle draw routine and mess up everything  <_<
The clipping however work for every polygon, except quad in some rare case, when the clipping algo gave me 5 vertices, it's just draw only one triangle and exit.
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #201 on: November 05, 2013, 01:47:18 pm »
Mais ton clipping ne marche pas en hauteur ca vient aussi de ca le bug non ?

sorry i can't say this in english ^^
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GLIB a graphics axe 3d librairy
« Reply #202 on: November 06, 2013, 01:27:23 am »
Looks quite good :). I hope you can fix the bugs without too much trouble.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: GLIB a graphics axe 3d librairy
« Reply #203 on: November 06, 2013, 08:01:21 am »
Do you use a rom-dumped rom for wabbit? If not, do it, the others have some wierd bugs.

So yeah, looking awesome :P

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #204 on: November 06, 2013, 10:19:39 am »
Do you use a rom-dumped rom for wabbit? If not, do it, the others have some wierd bugs.

yep it's a calc dumped rom  :P, but this bug still weird
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #205 on: November 11, 2013, 07:47:30 am »
Update of the main lib !!  (the readme is not finalized, so please refer for the moment to the tuto)

*multiple camera handling
*vertex shader
*better system in general
*lot of optimisations

EDIT fixed version !!! shader now work proprelly, and file is clean : This is the final version =)
« Last Edit: November 12, 2013, 12:42:13 pm by TheMachine02 »
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #206 on: November 11, 2013, 09:24:45 am »
Awesome :D

Is GCORE fully functional and finished now ?

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #207 on: November 11, 2013, 09:30:36 am »
Is GCORE fully functional and finished now ?

Well there will have just some little modification in the shader code, but this is almost nothing  (and if I find optimization, I'll made update)
So, we can consider the GCORE as fully functionnal, yes
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #208 on: November 12, 2013, 01:28:35 pm »
some screen using vertex shader
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: GLIB a graphics axe 3d librairy
« Reply #209 on: November 12, 2013, 04:50:25 pm »
ui, that is looking awesome! How come you are so amazing O.O

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!