RetroBASIC

Retrogamecoding(.org) => Examples => Topic started by: Mopz on July 03, 2014, 10:34:35 AM

Title: Raycaster map through new lib
Post by: Mopz on July 03, 2014, 10:34:35 AM
(http://naalaa.com/img/td_rc.jpg)

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.

Title: Re: Raycaster map through new lib
Post by: Mopz on July 03, 2014, 02:46:11 PM
Yes, I record everything: http://youtu.be/wM3mGohetfw (http://youtu.be/wM3mGohetfw)
Title: Re: Raycaster map through new lib
Post by: Cybermonkey on July 03, 2014, 07:57:02 PM
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?
Title: Re: Raycaster map through new lib
Post by: Guilect on July 04, 2014, 08:35:45 PM
Looking good Mopz.
Title: Re: Raycaster map through new lib
Post by: Mopz on July 13, 2014, 01:32:57 PM
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).
Title: Re: Raycaster map through new lib
Post by: Guilect on July 13, 2014, 03:15:51 PM
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?
Title: Re: Raycaster map through new lib
Post by: Cybermonkey on July 13, 2014, 03:41:41 PM
Hm, I just thought if it might be possible to port that library to Pascal. You are only using default OpenGL/freeglut functions?
Title: Re: Raycaster map through new lib
Post by: Mopz on July 13, 2014, 05:29:58 PM
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 :)
 
Title: Re: Raycaster map through new lib
Post by: Mopz on July 13, 2014, 05:35:10 PM
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.
Title: Re: Raycaster map through new lib
Post by: Guilect on July 13, 2014, 09:20:57 PM
@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.
Title: Re: Raycaster map through new lib
Post by: Mopz on July 14, 2014, 06:20:17 AM
@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.
Title: Re: Raycaster map through new lib
Post by: Mopz on July 14, 2014, 10:32:31 AM
I added support for MD2 models and modified the attached example so that you run around with Blade  ;D

Title: Re: Raycaster map through new lib
Post by: Guilect on July 14, 2014, 11:07:16 PM
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
Title: Re: Raycaster map through new lib
Post by: Mopz on July 15, 2014, 05:33:36 AM
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?
Title: Re: Raycaster map through new lib
Post by: Mopz on July 15, 2014, 03:32:18 PM
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.
Title: Re: Raycaster map through new lib
Post by: Cybermonkey on July 15, 2014, 05:47:17 PM
Just to call in: it worked fine on my Windows 7 64bit.
Title: Re: Raycaster map through new lib
Post by: Guilect on July 15, 2014, 09:32:05 PM
I told you I was doing something wrong.
Seems like the new gl_next.dll did not overwrite the old one.
I downloaded the demo again, and made sure to use the new dll and presto...
Blade was running through the environment.
Title: Re: Raycaster map through new lib
Post by: Mopz on August 03, 2014, 12:33:30 AM
Getting somewhere: https://www.youtube.com/watch?v=98xfRIAtabM&feature=youtu.be (https://www.youtube.com/watch?v=98xfRIAtabM&feature=youtu.be)
Title: Re: Raycaster map through new lib
Post by: Guilect on August 05, 2014, 10:16:00 PM
Looking good Mopz.

Can you have rooms over rooms or is there just the one ground?
Title: Re: Raycaster map through new lib
Post by: Mopz on August 08, 2014, 12:23:33 PM
Looking good Mopz.

Can you have rooms over rooms or is there just the one ground?

As you may have guessed it's all quite limited.

It's grid based, just like the raycaster things. For each cube you can set four walls, a ceiling and a floor, and you can split it diagonaly. The differen parts of the cube aren't "connected" to eachother. In combination with a heightmap (almost all the floor, not only the outside dirt, in the video is part of the heightmap), you can have a maximum of two floor levels.

I'm sorry about the limitations, but it's an old engine :) Atleast it's easy to create maps ;)
Title: Re: Raycaster map through new lib
Post by: Cybermonkey on August 09, 2014, 08:11:20 AM
Reminds me of Quake I  8)
Title: Re: Raycaster map through new lib
Post by: Mopz on August 14, 2014, 12:47:02 PM
You can download the game (only three levels) from http://www.nalaadeveloper.com (http://www.naalaadeveloper.com)

Using the keyboard-only control style is not recommended.
Title: Re: Raycaster map through new lib
Post by: Guilect on August 14, 2014, 11:00:52 PM
Nice game Mopz.
You even had particles and see thru gates/doors.   8)
Title: Re: Raycaster map through new lib
Post by: Cybermonkey on August 15, 2014, 02:22:16 PM
It's great but really hard. I finished level 1 but have problems to kill all droids on level 2. (Where ist that railgun from DOOM?)  8)
Title: Re: Raycaster map through new lib
Post by: Mopz on August 15, 2014, 04:16:10 PM
With only three levels it has to be hard ;)  Save the "Whacker Weapon" for the bugs, you can switch with f1/f2.