Author Topic: Raycaster map through new lib  (Read 2368 times)

Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Raycaster map through new lib
« on: 03. July 2014, 12:34:35 »


I'm working on a 3d library for naalaa 6 based on one of my old game engines. I wrote a loader for maps created with naalaa's raycaster editor and after running some pull functions on the floor and ceiling it already looks kind of cool. The engine DO support non-orthogonal walls, but since this is a raycaster map you don't see it here.

I've attached the example, but you need naalaa 6 to compile and run it.


Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Re: Raycaster map through new lib
« Reply #1 on: 03. July 2014, 16:46:11 »
Yes, I record everything: http://youtu.be/wM3mGohetfw

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 574
    • View Profile
    • Home of EGSL
Re: Raycaster map through new lib
« Reply #2 on: 03. July 2014, 21:57:02 »
Great. But could the spinning around be stopped if one moves the mouse to the right or to the left?
And is it possible to toggle the library to fullscreen?
« Last Edit: 04. July 2014, 21:08:01 by Cybermonkey »
Best regards,
Cybermonkey

Guilect

  • Regular Member
  • Full Member
  • *
  • Posts: 110
    • View Profile
Re: Raycaster map through new lib
« Reply #3 on: 04. July 2014, 22:35:45 »
Looking good Mopz.

Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Re: Raycaster map through new lib
« Reply #4 on: 13. July 2014, 15:32:57 »
I posted something yesterday night that didn't work at all (hardcoded paths). But the TD library and editor are soon finished. Here's a rather blocky example. Only mouse control this time: move and turn with arrow keys, look up and down with PgUp and PgDown.

Textures from opengameart.org.

I need to add support for water and change of lighting so that you can make parts of a map more gloomy. Also, you can't add models to your map yet (that's why things look blocky, only walls, floor, ceiling and heightmap are used).
« Last Edit: 13. July 2014, 15:46:15 by Mopz »

Guilect

  • Regular Member
  • Full Member
  • *
  • Posts: 110
    • View Profile
Re: Raycaster map through new lib
« Reply #5 on: 13. July 2014, 17:15:51 »
Hi Mopz,

Your demos keep getting better and better.

I agree with Cybermonkey regarding the motion when turning; it makes me a bit sea sick.

In looking at the sourcecode for the example, it is cool to see how little code is required.
Just load a map and add some controls for player movement.
I am curious how you modified the rc editor to allow for height.
I liked the spiral ramp in the demo map.
Being able to place lights would be a great addition.
What type of models and or billboards do you hope to support?

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 574
    • View Profile
    • Home of EGSL
Re: Raycaster map through new lib
« Reply #6 on: 13. July 2014, 17:41:41 »
Hm, I just thought if it might be possible to port that library to Pascal. You are only using default OpenGL/freeglut functions?
Best regards,
Cybermonkey

Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Re: Raycaster map through new lib
« Reply #7 on: 13. July 2014, 19:29:58 »
Hi Mopz,

Your demos keep getting better and better.

I agree with Cybermonkey regarding the motion when turning; it makes me a bit sea sick.

In looking at the sourcecode for the example, it is cool to see how little code is required.
Just load a map and add some controls for player movement.
I am curious how you modified the rc editor to allow for height.
I liked the spiral ramp in the demo map.
Being able to place lights would be a great addition.
What type of models and or billboards do you hope to support?

Thanks :) I've been sick for a couple of days, so there's not much else to do than to stay in bed and try to program. Probably back to work tomorrow.

The raycaster editor is not used anymore, but you can import such maps. I've written a new editor (see attached image) where you edit while running around :) I precalculate all lighting, so that the map can be rendered fast. So you'll be able to add light and darkness in some way. I've written loaders for my own mesh format and will include an old modelling program for generating those. Other than that I think I'll just go with OBJ for static things in the map and MD2 for characters. What do you mean with "billboards" in this case? For me, a "billboard" is just an image always turned in the player's direction :)
 
« Last Edit: 13. July 2014, 19:37:17 by Mopz »

Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Re: Raycaster map through new lib
« Reply #8 on: 13. July 2014, 19:35:10 »
Hm, I just thought if it might be possible to port that library to Pascal. You are only using default OpenGL/freeglut functions?

Yes, if you look at TD.txt most calls starting with _gl end up as normal OpenGL calls in the end. So most of it you can probably just move to pascal. But they go through a naalaa extension, gl_next. If necessary I or John will uppdate the c-part of the extension later to a less ancient OpenGL version.
« Last Edit: 13. July 2014, 19:38:21 by Mopz »

Guilect

  • Regular Member
  • Full Member
  • *
  • Posts: 110
    • View Profile
Re: Raycaster map through new lib
« Reply #9 on: 13. July 2014, 23:20:57 »
@Mopz,

Hope you feel better.
I like the idea of walking around and making the level.
For billboards, I guess I just meant 2d sprites in general.
They would be good for HUD's, text, and such things.

Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Re: Raycaster map through new lib
« Reply #10 on: 14. July 2014, 08:20:17 »
@Mopz,

Hope you feel better.
I like the idea of walking around and making the level.
For billboards, I guess I just meant 2d sprites in general.
They would be good for HUD's, text, and such things.

Ok, then I get it. And, of course, they are important in this case. The extension overrides the naalaa window, so you still get keyboard and mouse input, but normal drawing doesn't work. There'll be commands like TD_DrawImage and TD_DrawString for 2D drawing.

Code: [Select]
rem Render map without flush.
proc TD_Render false
rem Switch to 2D.
proc TD_Make2D
proc TD_DrawImage MY_IMAGE, 200, 100
proc TD_Redraw

All drawing is already cached because of how OpenGL works.

Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Re: Raycaster map through new lib
« Reply #11 on: 14. July 2014, 12:32:31 »
I added support for MD2 models and modified the attached example so that you run around with Blade  ;D


Guilect

  • Regular Member
  • Full Member
  • *
  • Posts: 110
    • View Profile
Re: Raycaster map through new lib
« Reply #12 on: 15. July 2014, 01:07:16 »
I must be doing something wrong.  :P
Your latest (td_example2) demo does not run for me.

I get "Line 1: Missing DLL function"
I can run the previous demo (td_example) fine.

Windows XP Service Pack 3

Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Re: Raycaster map through new lib
« Reply #13 on: 15. July 2014, 07:33:36 »
I must have forgot to put the latest version of gl_next.dll in the folder. Never mind, it was not that much of a difference compared to the other test.

I've tested many md2 models, and I must say it's a shame there's no standard at all when it comes to indexing the key frames. You always have to figure out which sequence of frames are for walking etc. Other than that I really like this old file format - I had never used it before. Do you know if people use (used) it only for animated objects or also for their static stuff?

Marcus

  • Globaler Moderator
  • Full Member
  • *****
  • Posts: 241
    • View Profile
    • NaaLaa
Re: Raycaster map through new lib
« Reply #14 on: 15. July 2014, 17:32:18 »
Weird. Downloaded it on a clean computer, and it ran fine with the included gl_next.dll. The messagebox is generated by naalaa, that I know since I wrote that part myself. But I'll ask John to add some more info like dll- and function name.