Author Topic: 3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D  (Read 4243 times)

0 Members and 1 Guest are viewing this topic.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D
« on: December 03, 2019, 05:17:48 pm »
Hi !

Sorry to open a new topic. I opened a new topic because I want to put it here if there is an update to the game.
I changed the game to MAPTRINGLE3D. Much better! The CPU is barely working, other tasks take more time. The rendering is beautiful, the text is the highest.

In maptriangle2d, I had to sort the tiles in order. That's a lot of time. You don't need maptriangle3d. Just "print" the 3d data and then the wonderful

_DISPLAY command displays. In addition, he hardly works in cpu.

I improved the game, added a little bit, has a finish, tried to enhance the game experience.

Thanks to those who are developing qb64, there are tremendous graphical opportunities.

https://www.youtube.com/watch?v=TFSOcD6jUbA

download (with source code)

https://drive.google.com/open?id=13TMm1HYUu0RIbToY4NF49qwReS5mNCxO


« Last Edit: December 20, 2019, 07:18:31 am by MasterGy »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D
« Reply #1 on: December 04, 2019, 09:55:29 am »
Hi.
It really looks great. The flickering of textures from the previous version is completely removed, it's very nice.
My version 3D crawling with MAPTRIANGLE3D i been doing here https://www.qb64.org/forum/index.php?topic=300.msg109293#msg109293 even though it's still not full finished.

Great job, MasterGy.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D
« Reply #2 on: December 05, 2019, 08:00:37 pm »
thank you Petr !

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D
« Reply #3 on: December 05, 2019, 08:04:34 pm »
I was really surprised by the maptriangle3d speed and I got a lot of ideas, but I'm just experimenting. if anyone can get out of it, use it. I was thinking of flying game, but I don't have time. but as a basis for someone to be good.

use W,S, and mouse !

Code: QB64: [Select]
  1. DIM terep(39999, 49), pont(39999, 49), kellkocka(99, 99, 99)
  2. CONST pip180 = 3.1415 / 180
  3.  
  4.  
  5. res3dx = 1024
  6. res3dy = 768
  7. ivx = 200 'X-dimension size
  8. ivy = 200 'Y-dimension size
  9. ivz = 200 'Z-dimension size
  10. ks = .1 '1 box size
  11. kockadb = 1600 'piece of cubes
  12. msens = .3 'mouse sensitive
  13.  
  14.  
  15.  
  16.  
  17. mon = _NEWIMAGE(res3dx, res3dy, 32)
  18.  
  19.  
  20. 'create box texture
  21. kep0 = _NEWIMAGE(200, 200, 32): _DEST kep0: CIRCLE (100, 100), 60, _RGB32(255, 255, 255)
  22. LINE (0, 0)-(199, 199), , B , _RGB32(255, 255, 255)
  23. PAINT (100, 100), _RGB32(122, 139, 200), _RGB32(255, 255, 255)
  24. PAINT (2, 2), _RGB32(55, 0, 0), _RGB32(255, 255, 255)
  25. kep(0) = _COPYIMAGE(kep0, 33)
  26.  
  27.  
  28.  
  29. 'if you have a picture, use this
  30. 'kep(0) = _LOADIMAGE("d:\3dtext.bmp", 33)
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. kezdpontkocka = pontdb: pontdb = pontdb + kockadb * 8
  38. kezdterepkocka = terepdb: terepdb = terepdb + kockadb * 6
  39.  
  40. GOSUB objadd '3d data to array for boxes
  41.  
  42.  
  43.     lepes = 2: 'speed me
  44.     px = 0: py = 0: pz = 0: GOSUB enlepes
  45.     IF _KEYDOWN(119) THEN px = en(5): py = en(6): pz = en(7)
  46.     IF _KEYDOWN(115) THEN px = -en(5): py = -en(6): pz = -en(7)
  47.     GOSUB egerkezelo: en(0) = en(0) + px * lepes: en(1) = en(1) + py * lepes: en(2) = en(2) + pz * lepes
  48.  
  49.     GOSUB pontcalc
  50.  
  51.     FOR t = 0 TO terepdb - 1
  52.         IF terep(t, 14) THEN
  53.             szorzo = 10
  54.  
  55.             x0 = pont(terep(t, 0), 20) * szorzo
  56.             y0 = pont(terep(t, 0), 21) * szorzo
  57.             z0 = -pont(terep(t, 0), 22) * szorzo + addz
  58.             x1 = pont(terep(t, 1), 20) * szorzo
  59.             y1 = pont(terep(t, 1), 21) * szorzo
  60.             z1 = -pont(terep(t, 1), 22) * szorzo + addz
  61.             x2 = pont(terep(t, 2), 20) * szorzo
  62.             y2 = pont(terep(t, 2), 21) * szorzo
  63.             z2 = -pont(terep(t, 2), 22) * szorzo + addz
  64.             x3 = pont(terep(t, 3), 20) * szorzo
  65.             y3 = pont(terep(t, 3), 21) * szorzo
  66.             z3 = -pont(terep(t, 3), 22) * szorzo + addz
  67.  
  68.             akep = terep(t, 4)
  69.             sx0 = terep(t, 5)
  70.             sy0 = terep(t, 6)
  71.             sx1 = terep(t, 7)
  72.             sy1 = terep(t, 8)
  73.             sx2 = terep(t, 9)
  74.             sy2 = terep(t, 10)
  75.             sx3 = terep(t, 11)
  76.             sy3 = terep(t, 12)
  77.  
  78.             limit = 12000
  79.             felt1 = x1 > -limit AND x1 < limit: felt2 = x2 > -limit AND x2 < limit
  80.             felt3 = x3 > -limit AND x3 < limit: felt4 = x4 > -limit AND x4 < limit
  81.             felt5 = y1 > -limit AND y1 < limit: felt6 = y2 > -limit AND y2 < limit
  82.             felt7 = y3 > -limit AND y3 < limit: felt8 = y4 > -limit AND y4 < limit
  83.             felt9 = z1 < 1 AND z1 > -10000: felt10 = z2 < 1 AND z2 > -10000
  84.             felt11 = z3 < 1 AND z3 > -10000: felt12 = z4 < 1 AND z4 > -10000
  85.             felta = ((felt1 AND felt2) AND (felt3 AND felt4)) AND ((felt5 AND felt6) AND (felt7 AND felt8))
  86.             feltb = (felt9 AND felt10) AND (felt11 AND felt12)
  87.  
  88.  
  89.             IF felta AND feltb THEN
  90.  
  91.                 _MAPTRIANGLE (sx0, sy0)-(sx1, sy1)-(sx2, sy2), kep(akep) TO(x0, y0, z0)-(x1, y1, z1)-(x2, y2, z2), , _SMOOTH
  92.                 _MAPTRIANGLE (sx3, sy3)-(sx1, sy1)-(sx2, sy2), kep(akep) TO(x3, y3, z3)-(x1, y1, z1)-(x2, y2, z2), , _SMOOTH
  93.  
  94.             END IF
  95.         END IF
  96.     NEXT t
  97.     LOCATE 1, 1: PRINT "en3"; en(3); "en4"; en(4)
  98.     LOCATE 2, 1: PRINT "en5"; en(5); "en6"; en(6); "en7"; en(7)
  99.     _DISPLAY: CLS
  100.  
  101.  
  102.  
  103. egerkezelo:
  104.  
  105.  
  106.  
  107. makt = 0: mousex = 0: mousey = 0
  108. FOR t = 0 TO 100: makt = _MOUSEINPUT
  109.     IF makt THEN
  110.         mousex = _MOUSEMOVEMENTX + mousex
  111.         mousey = _MOUSEMOVEMENTY + mousey
  112.  
  113.     END IF
  114.  
  115.  
  116.  
  117. en(3) = en(3) - mousey * msens
  118. en(4) = en(4) + (mousex * msens) * neg
  119. zslimit = 89
  120. IF en(3) >= 360 THEN en(3) = 0
  121. IF en(3) < 0 THEN en(3) = 360
  122. IF en(4) >= 360 THEN en(4) = 0
  123. IF en(4) < 0 THEN en(4) = 360
  124.  
  125.  
  126.  
  127. enlepes:
  128.  
  129.  
  130.  
  131. x5 = SIN(pip180 * en(4)) * 1
  132. x7 = COS(pip180 * en(4)) * 1
  133. neg = SGN(COS(en(3) * pip180))
  134. x5 = neg * x5: x7 = neg * x7
  135. x6 = (SIN(pip180 * en(3)) * 3)
  136.  
  137.  
  138.  
  139. s = (ABS(x6)) + (ABS(x5)) + ABS(x7)
  140. en(5) = 1 / s * x5
  141. en(6) = 1 / s * x6
  142. en(7) = 1 / s * x7
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149. pontcalc:
  150. FOR t = 1 TO pontdb - 1
  151.     x = pont(t, 0) - en(0): y = pont(t, 1) - en(1): z = pont(t, 2) - en(2)
  152.     rotx = pip180 * en(3): rotz = 0: roty = pip180 * en(4)
  153.     x2 = (x * COS(rotz)) - (y * SIN(rotz))
  154.     y2 = (x * SIN(rotz)) + (y * COS(rotz))
  155.     x3 = (x2 * COS(roty)) - (z * SIN(roty))
  156.     z2 = (x2 * SIN(roty)) + (z * COS(roty))
  157.     y3 = (y2 * COS(rotx)) - (z2 * SIN(rotx))
  158.     z3 = (y2 * SIN(rotx)) + (z2 * COS(rotx))
  159.     pont(t, 20) = x3: pont(t, 21) = y3: pont(t, 22) = z3
  160. t = 5
  161. qx = pont(t, 20) - pont(t, 0)
  162. qy = pont(t, 21) - pont(t, 1)
  163. qz = pont(t, 22) - pont(t, 2)
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178. objadd:
  179.  
  180. ks = 5: REM kocka merete
  181. koc(0, 0) = -1
  182. koc(0, 1) = -1
  183. koc(0, 2) = -1
  184. koc(1, 0) = 1
  185. koc(1, 1) = -1
  186. koc(1, 2) = -1
  187. koc(2, 0) = -1
  188. koc(2, 1) = 1
  189. koc(2, 2) = -1
  190. koc(3, 0) = 1
  191. koc(3, 1) = 1
  192. koc(3, 2) = -1
  193. koc(4, 0) = -1
  194. koc(4, 1) = -1
  195. koc(4, 2) = 1
  196. koc(5, 0) = 1
  197. koc(5, 1) = -1
  198. koc(5, 2) = 1
  199. koc(6, 0) = -1
  200. koc(6, 1) = 1
  201. koc(6, 2) = 1
  202. koc(7, 0) = 1
  203. koc(7, 1) = 1
  204. koc(7, 2) = 1
  205.  
  206. FOR t = 0 TO kockadb - 1
  207.     DO: lehetx = INT(INT(ivx / ks) * RND(1)): lehety = INT(INT(ivy / ks) * RND(1)): lehetz = INT(INT(ivz / ks) * RND(1))
  208.     LOOP WHILE kellkocka(lehetx, lehety, lehetz)
  209.     kellkocka(lehetx, lehety, lehetz) = 1: ap = kezdpontkocka + t * 8
  210.     FOR t2 = 0 TO 7
  211.         pont(ap + t2, 0) = lehetx * ks + koc(t2, 0) * ks / 2 - ivx / 2
  212.         pont(ap + t2, 1) = lehety * ks + koc(t2, 1) * ks / 2 - ivy / 2
  213.         pont(ap + t2, 2) = lehetz * ks + koc(t2, 2) * ks / 2 - ivz / 2
  214.     NEXT t2
  215.  
  216.     at = kezdterepkocka + t * 6
  217.     atx = at + 0: p1 = ap + 0: p2 = ap + 1: p3 = ap + 2: p4 = ap + 3: GOSUB terepmake
  218.     atx = at + 1: p1 = ap + 5: p2 = ap + 4: p3 = ap + 7: p4 = ap + 6: GOSUB terepmake
  219.     atx = at + 2: p1 = ap + 1: p2 = ap + 5: p3 = ap + 3: p4 = ap + 7: GOSUB terepmake
  220.     atx = at + 3: p1 = ap + 4: p2 = ap + 0: p3 = ap + 6: p4 = ap + 2: GOSUB terepmake
  221.     atx = at + 4: p1 = ap + 4: p2 = ap + 5: p3 = ap + 0: p4 = ap + 1: GOSUB terepmake
  222.     atx = at + 5: p1 = ap + 7: p2 = ap + 6: p3 = ap + 3: p4 = ap + 2: GOSUB terepmake
  223.  
  224.  
  225.  
  226.  
  227. terepmake:
  228.  
  229. terep(atx, 0) = p1
  230. terep(atx, 1) = p2
  231. terep(atx, 2) = p3
  232. terep(atx, 3) = p4
  233. terep(atx, 4) = 0: REM kep azonosito
  234. terep(atx, 5) = 0
  235. terep(atx, 6) = 0
  236. terep(atx, 7) = _WIDTH(kep(0)) - 1
  237. terep(atx, 8) = 0
  238. terep(atx, 9) = 0
  239. terep(atx, 10) = _HEIGHT(kep(0)) - 1
  240. terep(atx, 11) = _WIDTH(kep(0)) - 1
  241. terep(atx, 12) = _HEIGHT(kep(0)) - 1
  242. terep(atx, 14) = 1: REM terep aktiv
  243.  
  244.  
  245.  
  246.  
  247.  
« Last Edit: December 05, 2019, 08:06:07 pm by MasterGy »

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D
« Reply #4 on: December 05, 2019, 08:09:11 pm »
i like the solution in the edit. the level building !! take a lot! good luck with the game!

Offline Jack002

  • Forum Regular
  • Posts: 123
  • Boss, l wanna talk about arrays
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D
« Reply #5 on: December 06, 2019, 11:05:03 am »
Wow, that's so cool! Thanks for sharing it!
QB64 is the best!

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D
« Reply #6 on: December 09, 2019, 07:46:44 pm »
Hi ! I'd like to do a "fülöpke2". I wanted it to be such an airplane mode, but the problem is that you can get bored quickly. but the course gives you the opportunity to jump on it. if that's the case, i want to put the old batteries in it. for example, flying only under certain conditions. it would be a lot of ideas if anyone has any, i would appreciate it. I want it to be boring. but they would need simple solutions. if someone has good ideas.

https://www.youtube.com/watch?v=binF_L_BwRM&feature=youtu.be

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)_MAPTRIANGLE3D
« Reply #7 on: December 20, 2019, 07:18:12 am »
Hi !

I did some minor tweaks to it, improved the presentation to further enhance the ecstasy, the action.

I put it on google drivre to be accessible at any time:

https://drive.google.com/open?id=13TMm1HYUu0RIbToY4NF49qwReS5mNCxO