Author Topic: Nemesis- a new axe 3d rpg  (Read 35133 times)

0 Members and 3 Guests are viewing this topic.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Nemesis- a new axe 3d rpg
« on: May 22, 2012, 10:04:06 am »
Bonjour je suis nouveau sur le site et j'essaie de créer un nouveau rpg en 3d avec un moteur raycasting.
Les menus sont quasiment terminés.
J'aimerai de l'aide pour le moteur raycasting

voici le code source

Hello I am new to the site and I try to create a new RPG with 3D ray casting engine.
The menus are almost completed.
I'd like to help with the ray casting engine

here's the source code

. Full3d
[1111111111111111->GDB1  //test map
[1000000000000001
[1999100000000001
[1888100000000001
[1777400000000001
[1888101199100001
[1999101199100001
[1999101199100001
[1999100100100001
[1555100100110001
[1111100100010001
[1111111111111111

E0->S
E500->X->Y
Diagnosticoff
Repeat getkey(15)
Repeat getkey(0)
Pause 11
Disgraph'
End
Disgraph'Clrdraw''
getkey(2)-getkey(3)*8+S->S
sin()->Q
cos(S)->P
If getkey(4)+getkey(1)
If getkey(1)
-P->P   // negative symbole (not operator)
-Q->Q   //  the same
End
!If Check(X+P,Y-Q)->U*(U<4)
X+P->P
Y-Q->Q
End
End
E3->A
cos(-45)->L  // negative symbole
S+45->S
While -S+45  //operator
cos(Z)->I
sin(Z)->J
E0->C-32->G  //oper.
X->P
Y->Q
EF->K
Ray()
A+2->A
cos(-48)->L  //operator
Z-2->Z
End
End
Return

Lbl Check
nib{/256*156+{°r1+1}+(GDB1*2)}
Return

Lbl Draw
!If H-r2-G->r2<<0
Rect(A,G+32,2,r2,r1)
End
Return

Lbl Ray
P+I->P
Q-J->Q
If Check(P,Q)->§*(K>=§)
180/(L*C/256+8)->H*§/5->W
G+H>256?-H->G  // negative signe
If Check(P,Q+J)->V+§-2*V
Draw(L6,V*H/5
End
V-§?Draw(L3,W),Draw(L6,W
Return!If §->K-1
G+r2->G
End
ReturnIf C++>50
Goto Ray

Need optimization
(6 MHz)

->  is sto symbole

§  is theta

« Last Edit: June 12, 2012, 12:14:27 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 turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Nemesis
« Reply #1 on: May 22, 2012, 10:56:31 am »
Est-ce que tu as un screenshot?

BTW, I'd recommend moving this to the french section?
« Last Edit: May 22, 2012, 10:56:54 am by turiqwalrus »

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Nemesis
« Reply #2 on: May 22, 2012, 11:24:22 am »
it isn't only french, and more people will see it here.
what past experience do you have?
basically, the idea in raycasting is that your character moves around on a 2d plane with walls and things, and a pseudo-3d projection of that area is made by casting rays out from the character's position in the direction he's looking, one for each column of pixels, measuring the distance to the nearest wall using trigonometry, and drawing walls either taller or shorter, depending on their distance away from the viewing point. what all do you need help with?

EDIT: this is a really helpful tutorial.
« Last Edit: May 22, 2012, 11:27:31 am by shmibs »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Nemesis
« Reply #3 on: May 22, 2012, 12:21:22 pm »

 no screenshoot sorry  :-\

I need help with the DDA system: I'm not sure to have very well understood
  :w00t: :w00t:
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 shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Nemesis
« Reply #5 on: May 22, 2012, 01:12:06 pm »
the DDA system is way for me to determine the intersections of walls with the ray
On my engine, precision and speed are decreased    :banghead:
because of a detection system (so that I would like to change)  :)

On your tutorial (which I knew), I did not understand how you did to determine the first point of intersection with the map
 ;D
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 shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Nemesis
« Reply #6 on: May 22, 2012, 09:08:36 pm »
as in, the closest point to the viewer?
well, you literally "cast rays" at them. check points at intervals along a line pointing out away from your viewing point and stop when one of those points is inside a wall.
so if your map is broken up into blocks of 8*8 blocks, you would have to get the truncated integer value of the point's cartesian (x, y) coordinates in order to find what block it's inside, and then check that block on the map to see if it's inside a wall.
« Last Edit: May 22, 2012, 09:10:48 pm by shmibs »

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: Nemesis
« Reply #7 on: May 22, 2012, 10:40:02 pm »
Est-ce que tu as un screenshot?

BTW, I'd recommend moving this to the french section?
Actuallly projects can  go in here regardless of the language (although some english and/or images are recommended).

Anyway welcome here. As for raycasting I cannot help but I know Runer112 was working on a raycaster before. Maybe that could help too? Anyway good luck :)

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Nemesis
« Reply #8 on: May 23, 2012, 12:10:59 pm »
Ok......  I will try this  :thumbsup:

I also forgot to say that the walls have a variable height and you're done making the program a little more complicated
Here, I have a variable height from the top, but not the bottom ....
And I did not succeeded to put the two together ... :'(

Furthermore, and this time the game, I'll try to put a program on the site to show you a costume of a character team.

Errrr ...... :w00t:
I can't find the link to post a program
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 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: Nemesis
« Reply #9 on: May 24, 2012, 02:11:18 am »
Hmm variable wall height might be complicated. What I would suggest is you edit the first post to mention it's a raycaster in the title and say you need help there, or ask in the help section so more people see this topic. Keep in mind that if you're new to programming, raycasting is a huge undertaking, though. Most people who tried raycasting had 3-5 years of programming experience before. Hopefully you can get some help to point you in the right direction, though.

Also to upload a program I think you need 5 or 20 posts on the forums.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Nemesis-raycasting
« Reply #10 on: May 24, 2012, 03:25:45 am »

 Ok. Thank you !!

The raycasting isn't so complicated.
I had good results with my ray casting engine, although there is no textures (which is not that bad).  ;D
I think I will reduce the quality to increase speed: the whole is to find a good arrangement  :P

Otherwise I start to create an artificial intelligence (it's just a point following a other point) and I do not see too how to make the point that moves avoids the walls

Here the code

.IA
20->C->D->X->Y
New()

Repeat getkey(15)
X-C<<0?-1->I,1->I  // -1 is the signe
Y-D<<0?-1->J,1->J  //same
Y-D=0?0->J
X-C=0?0->I
X-C//32+I->S
Y-D//32+J->T
!If pxl-test(C+S,D+T
C+S->C
D+T->D
End
pxl-on(C,D
pxl-on(X,Y
If C=X*(D=Y
New()
End
Disgraph
Pause 300
Clrdraw
End
Return

Lbl New
rand^20+3->A
!If rand^2-1
-A->A   // the signe
End
rand^20+3->B
!If rand^2-1
-B->B  //same as follow
End
!If pxl-test(X+A,Y-B
A+X<64*(A+X>0)?X+A->X
B+Y<64*(B+Y>0)?B+Y->Y
Else
Goto New
End

Basically, this code just create a point, which is the objective of the other point

(here it stops when it hits a wall, and I want that the point continues to try to reach the other point ...)
Thank for help!  :thumbsup:
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 shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Nemesis-raycasting
« Reply #11 on: May 24, 2012, 09:42:34 am »
builder's RTS that he's making has AI that finds paths to places, so if you really wanted to you could talk to him about it. that means adding in a fairly complex algorithm that would slow everything else down a lot, so it probably isn't worth it.
EDIT: wikipedia link for good measure
[wikipedia]https://en.wikipedia.org/wiki/Pathfinding[/wikipedia]
« Last Edit: May 24, 2012, 09:44:34 am by shmibs »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Nemesis-raycasting
« Reply #12 on: May 24, 2012, 11:19:39 am »
Thank you.
I think I find a way to do a limited and quick AI
So, I will try this and I wil tell you if it's work.  :)

Also a picture showing the possibilities of my engine

Better on calc !!!
« Last Edit: May 24, 2012, 11:20:22 am 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 shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Nemesis-raycasting
« Reply #13 on: May 24, 2012, 11:30:15 am »
do you have a demo of some sort yet?
and once you have everything else, variable wall heights are pretty simple. just apply different scaling factors according to tile type. remember that you won't be able to see over shorter walls, though, unless your engine draws both the first and second wall a ray encounters, which, again, would slow it down a lot.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Nemesis-raycasting
« Reply #14 on: May 24, 2012, 11:41:02 am »
I'm just working on a playable demo so I'll post you when I had finished

Feature:
Character animation ..... in progress    >:(
Cool menus ....... almost done    ;)
3d    >B)
find the treasure    ^-^
Boss ...... with animations (and everything in 3d) ;D
Save game  ....done (and  very funny)
« Last Edit: May 24, 2012, 11:42:36 am 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