NaaLaa Community

Code dump => Libraries => Topic started by: Marcus on May 21, 2017

Title: GLOOM, a new raycaster library
Post by: Marcus on May 21, 2017
I'm working on a new raycaster library. Currently it's not even a library, just a big test program. I'm not quite sure what all the features will be yet, but if you look at the old Amiga game GLOOM (https://www.youtube.com/watch?v=Zq0la57PIVA (https://www.youtube.com/watch?v=Zq0la57PIVA)) that's about what I'm aiming for.

The latest version is attached to this post.

(http://naalaa.com/img/gloom_170521.jpg)

Title: Re: GLOOM, a new raycaster library
Post by: X54321 on May 22, 2017
Looks pretty neato!
I did not know that you could make NaaLaa libraries in C...
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on May 22, 2017
Looks pretty neato!
I did not know that you could make NaaLaa libraries in C...

Transparent and moving/rotating walls coming soon, hopefully :)

It's possible to write "extensions" in C, but it's a bit awkward since communicating with the naalaa runtime is messy. You pass all information to/from a C function through a naalaa object. "PARAM_GET_FLOAT("x");" in C fetches a float value set in naalaa like:

  params?.x# = 3.14
  params.dummy = 42
  params.a_string = "hello"
  DLL_CALL myDLL, "functionName", params

And you can get pointers to images, the window and such in the C program.
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on May 25, 2017
Here's a new zip with gloom in a separate lib and dll and three example programs. There's also some html documentation that I haven't read through yet. Many more examples will come, and the library will have more functionality added as I discoved the needs. There will be some kind map editor, but it will be pretty simple. In one of the examples included here, I use a polygon created with the Poly Editor to build static and moving wall structures.

I know the forum is kind of dead and that it's my own fault. But if anyone tries the stuff out, feel free to provide some feedback :)

There's basicly no "error checking" in the entire naalaa or C part of the library yet. So if you're not careful the whole thing might just decide to crash :D  But it'll come.


Edit:  I can already see the need for "invisible" walls, if you want to add barrels, tables and stuff in the form of sprites.
Title: Re: GLOOM, a new raycaster library
Post by: Rick3137 on May 25, 2017
  I tried the examples on my HP Pavillion laptop. ( 64 bit )
  No problems yet. Works fine.
Title: Re: GLOOM, a new raycaster library
Post by: X54321 on May 25, 2017
My 64 bit Dell laptop is getting good results as well. I even modified it to try and make the rotating walls crush me into the level boundaries, but I never clipped through them. That's pretty impressive, I suppose.
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on May 26, 2017
Good to hear :)  I'll see if I can write a proper map editor tonight.
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on May 27, 2017
I finally have a simple editor up and running. It took the whole day to write, since I couldn't figure out how make resizing the map image work with IUP. You don't deal with images/textures, just walls and grid cels with values.

(http://naalaa.com/img/gloom_ed.jpg)
Title: Re: GLOOM, a new raycaster library
Post by: Rick3137 on May 27, 2017
   Looks awesome. Can't wait to try it out.





Title: Re: GLOOM, a new raycaster library
Post by: Mr Nutz on May 28, 2017
Awesome ! Works fines with my old pc (win 7)

When Naalaa will work on Android and IOS, it will be the best and easiest programming language in the world  ;)

Very very good work !
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on May 29, 2017
Happy it works! I haven't tried it on a low spec PC, but I have a notebook that I'll test it on.

Much work to do still on the editor. But it's included in this zip with a new example. Yeah, I'm being pretty inspired by the graphics of the actual Amiga game GLOOM :)

Title: Re: GLOOM, a new raycaster library
Post by: X54321 on May 29, 2017
The editor works well. However, I noticed that when you make the map smaller, and you get that little warning message, clicking "abort" does not stop the map from resizing. : p
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 02, 2017
Ah, yes, some work left to do on the editor. Right now you can't see what 'value' a wall has nor change it without first deleting the wall, very annoying.

It's been a busy week at work, but here's a new version with two more examples for using sprites as obstacles and "pickups" and simulating sliding doors. There's no direct support for "items" or doors, and I'm not planning to add it. But not much code is required for these things. You can make doors that function and move in many ways, but the ones in this example work like the ones in the old raycaster library, which is probably the simplest to implement (but I'll show more ways later on).



Title: Re: GLOOM, a new raycaster library
Post by: Rick3137 on June 02, 2017
 Looking good. No problem getting the door open.

 One thing I noticed about the map editor. If I save a 32x32 map and reload it, the numbers still say-- 16x16
Title: Re: GLOOM, a new raycaster library
Post by: cherbert on June 04, 2017
Here's a new zip with gloom in a separate lib and dll and three example programs. There's also some html documentation that I haven't read through yet. Many more examples will come, and the library will have more functionality added as I discoved the needs. There will be some kind map editor, but it will be pretty simple. In one of the examples included here, I use a polygon created with the Poly Editor to build static and moving wall structures.

I know the forum is kind of dead and that it's my own fault. But if anyone tries the stuff out, feel free to provide some feedback :)

There's basicly no "error checking" in the entire naalaa or C part of the library yet. So if you're not careful the whole thing might just decide to crash :D  But it'll come.


Edit:  I can already see the need for "invisible" walls, if you want to add barrels, tables and stuff in the form of sprites.

Thank you. This is really exciting. I love you can have double height walls.

Would it be possible to have a skybox and make levels look like they are outside? Would be nice to build towns similar to the look of Daggerfall.

https://www.youtube.com/watch?v=BjB6OFiDasU
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 05, 2017
I've now added the sky-cylinder thing that I wrote a while ago, shown in this video by tinblue: https://www.youtube.com/watch?v=ofUxqSIuZ5Q (https://www.youtube.com/watch?v=ofUxqSIuZ5Q)  I'll upload some more examples soon, showing that and some more things. You won't really be able to build (much) more advanced things than those present in the Amiga game GLOOM, I'm afraid. So no fancy houses with sloping rooftops. Maybe I'll try and go Doom- or Quake-like when I've finished this library (if I can just stop spending so much time with my Nintendo Switch ...).
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 07, 2017
Added examples for sky textures, switches and bullets.

The one big thing left to show (add functions for) is probably how to manage sprites with eight directions (wolfenstein/doom style). I just have to draw or render some sprites first :)

Title: Re: GLOOM, a new raycaster library
Post by: Mr Nutz on June 09, 2017
 :D :D Awesome ! (especially with fov = 85)

Just a small problem : it's much slower in fullscreen :(  I suppose it's because in Naalaa 6 the screen mode is not changed.
Title: Re: GLOOM, a new raycaster library
Post by: Rick3137 on June 09, 2017
 Looking good.
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 10, 2017
Yeah, the backbuffer is stretched over the entire display these days. Maybe I can add something to poll possible resolutions and a way to switch in the library, but it feels like it should be part of naalaa rather than GLOOM. I may update naalaa when I've finished this library though, we'll see.

I tried making some human looking model that I could render into an 8 directional animated sprite for the examples. But, I'm terrible at 3D modelling, so I went Minecraft style instead:

http://naalaa.com/shorties/gloom_dude.mp4 (http://naalaa.com/shorties/gloom_dude.mp4)

I'm rendering it through naalaa 5:s software 3d renderer, so it will be quite easy to write a program for rendering all the frames into a single image. Easy to change textures for the different body parts too :)

Edit: Resulting image of walk animation, with angle on the x-axis and animation frame on the y-axis

(http://naalaa.com/shorties/cube_dude.jpg)

(http://naalaa.com/shorties/cube_dude_2.jpg)
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 10, 2017
These kind of dudes fit ok in a world of large pixels:

http://naalaa.com/shorties/dudes.mp4 (http://naalaa.com/shorties/dudes.mp4)

But they scare me a little.
Title: Re: GLOOM, a new raycaster library
Post by: Mr Nutz on June 11, 2017
Maybe these Gloom deluxe assets could hep you for the demo...
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 14, 2017
Maybe these Gloom deluxe assets could hep you for the demo...

Aye, I found those assets a while a go, but I dare not use copyrighted stuff :)

Haha, I just remembered having some talks with the guy behind Gloom 3 on IRC back in the days. But that version of the game wasn't very good.
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 14, 2017
Here's the example with the walking dudes. A bit hard to explain what's going on, but I just calculate the sprite angle (image cel) from the view's (player's) position and the dude's looking/walking direction. It is simple, but awkward.
Title: Re: GLOOM, a new raycaster library
Post by: Rick3137 on June 14, 2017
 Cool.  8)

 Nicely done.
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 24, 2017
The library feels pretty complete (atleast for my needs) now, but the editor may need some more work. I've fixed some bugs and started working on a "game", Zombie Tumult, which is included in the zip. The game uses mouse and AWSD control. You can shoot some zombies, but they won't harm you yet :)

Title: Re: GLOOM, a new raycaster library
Post by: Mr Nutz on June 26, 2017
Nice !  :)
Is it possible to detect the type of keyboard with Naalaa?
I ask this because WASD controls works fine with a QWERTY keyboard but not AZERTY ;)
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on June 28, 2017
Nice !  :)
Is it possible to detect the type of keyboard with Naalaa?
I ask this because WASD controls works fine with a QWERTY keyboard but not AZERTY ;)

I totally didn't know there were other types of keyboard layouts :D  For WASD control, you can just let W and Z, and A and Q, do the same thing. I'll fix that for this game. There's no way to detect what type of keyboard the user has in naalaa, and I couldn't find a simple solution to it from some quick google searches.
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on July 02, 2017
Just another level for Zombie Tumult, nothing's changed in the library. Won't post more until I have a fun game :)

http://naalaa.com/Marcus/gloom.zip (http://naalaa.com/Marcus/gloom.zip)
Title: Re: GLOOM, a new raycaster library
Post by: Rick3137 on July 02, 2017
 Looking good . Those zombies are a little hard to stop. I don't know if its me or this key board.
 I tend to get overrun. Maybe it needs an easy level . (or bigger guns). An option to use the arrow keys would be nice.
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on July 03, 2017
Looking good . Those zombies are a little hard to stop. I don't know if its me or this key board.
 I tend to get overrun. Maybe it needs an easy level . (or bigger guns). An option to use the arrow keys would be nice.

Yeah, the first zombie type should be easier. I'll remove the run-at-ya part from it and save it for the second type. Bigger guns will come too. I can add the option to use Wolfenstein 3D controls (no mouse, just arrow keys for movement).
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on July 28, 2017
Here's the first area (four levels) of the game. I've added some music and sound effects, and you can now also use the arrow keys to move (the title screen explains the controls). There's even a boss at the last level, but you still can't die, so ... :)

I forgot to mention on the title screen, that you can HOLD the TAB key to show a map.
Title: Re: GLOOM, a new raycaster library
Post by: Rick3137 on July 29, 2017
 Nice!!! I did good until I got to the fire throwing Zombies. The arrow keys work good except for one little detail...

 Too large an angle between clicks. Makes it hard to hit the target. ( unless it was done to make it harder)
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on July 29, 2017
Ah, good :)  Usually strafing left and right, by holding down Z, makes distant enemies easier to hit. But I'll add some options for tweaking the controls later. I wanna make 12 levels before I'm done with this game :)
Title: Re: GLOOM, a new raycaster library
Post by: PacoMan on August 02, 2017
Awesomeness! I defeated the mighty box boss. :) Way better than tf2. :P
Fire-zombies are scary!

Though the hardness of the fog disturbs me a bit, the rest of the game is so good looking. Would it be possible to maybe interpolate it in some way so you get rid of the very hard and noticeable edges/zones of the fog?
Title: Re: GLOOM, a new raycaster library
Post by: Marcus on August 03, 2017
Aye, just set the last parameter for GLOOM_SetFog to 0 :)  Just trying to make it look retro:er with that fog effect.