FPS development

(Miloslav Číž) #61

I found this video

Grabbed the code and tried adding fog:

Note that I didn’t bother to polish it so the dithering is weird etc., but I think it gives it real sense of dimension. Have you tried adding this feature?

EDIT: LQ video

(Holmes) #62

Any way you could make a video of it?

(Michael Gollnick) #63

Cool work. I have not yet thought about adding fog but the idea is cool. Maybe I will leave it open to the community to add this.
I am not a game programmer and all I do for this game takes ages :thinking:
Currently I try to improve performance for sprites if there are many of them in the FOV. I think it will only be fun with lots of enemies.
Real occlusion algorithms take too much performance so I am still trying different approaches.

After that I think I will publish the code so the community can help me. :heart_eyes:

(Miloslav Číž) #64

After that I think I will publish the code so the community can help me. :heart_eyes:

You know I like to hear that :slight_smile: I’ll be curious to see how you deal with the sprites, I’m not sure about the most efficient way either.

(Holmes) #65

WOW! The fog REALLY makes this look good!!! I am very impressed!

(Miloslav Číž) #66

For some reason it doesn’t look that good in the video though, but playing it really gives it an awesome dungeon crawling atmosphere. I think it has a huge potential, just waiting for someone to implement it properly :slight_smile: I’d really love to see it combined with this project as there are already very nice things like the head bob. Would be some next level stuff.

(Michael Gollnick) #67

Silly question but I kind of forgot what the maximum size of the binary is. Does anybody know?
Small update:

  • finished the flyweight pattern for the sprites (enemies and items)
  • could improve performance when many sprites are visible
  • saved some PROGMEM

Still there are a few glitches left which I need to fix. Also I need a small game menu. Does anybody has a good example for this? Something small. I think it can be kept tiny, maybe just play and help. Start screen is also missing but I think I will shift this (I am not a good artist).

About the features, for the engine can do:

  • doors with key support
  • flaky doors that open close randomly
  • moving walls at different speeds that can do damage to the player and enemies
  • enemies that move around with 4 visible sides
  • items that move up and down
  • dynamic mapping of textures on walls that can change during gameplay (have not shown this in a demo)
  • 4 weapons
  • 4 enemy types, some item types (e.g. ammo, health, etc) all 16x16 pixel
  • player movement with strafe support (needs some more attention)
  • 8 wall textures (at the moment) all 32x32 pixels
  • some door and frame textures
  • hud with weapon display, health and ammo
  • status messages at the top of the screen
  • level size of 2048x2048 pixel or 64x64 blocks (this can be enlarged easily if required)

Still I think it needs something like a wall switch or the like so the player can be more interactive with the environment. Or a terminal type to add more story but I am not sure it will fit into memory. I am open for any ideas.

Btw, sorry for the late updates. I have not that much time I want to have to work on this.

(Pharap) #68

The ATmega32u4 has 32KB of flash (progmem), but 4KB is used by the bootloader, so about 28KB of flash is usable.

Depends what kind of menu you’re after. The only thing I have pre-made is this:

(I should really remember to put a licence on it.)

(Michael Gollnick) #69

Many thanks for your example code. This is a good starting point for me.

So if the bootloader takes up to 4KiB then there should be 28672 bytes in total for the application. I was just asking because I am using platformio for development and sometimes I am not sure if it respects the maximun size correctly. Some time back I already bricked one Arduboy with this and it took me quite some time to get it back to work.

So working on the switch right now then probably create some nice level to check if there are enough features to make some interesting game with that engine.

(Miloslav Číž) #71

Hey @veritazz, I very much love this project :slight_smile: I’ve been watching it for some time.

I’ve been working on my own raycasting library for a few weeks now (it started as a Pokitto project but the library is intended for any low-resource computers). Here it is running on the Arduboy:

If you or anyone else would like to reuse the code, here it is, completely free of copyright. (Just beware it’s not complete yet. Once it is, I’ll probably release it as a separate demo here on the forums.) Thanks for your awesome project, hope we can make some awesome raycasting games :slight_smile:

(Michael Gollnick) #72

Hey @drummyfish! Thank you very much for sharing your code. I sometimes check your progress on the pokitto forum and it is really amazing what you achieved. You code looks very cleaned up and inspiring. Funny how different our engines seem to be.
I will also release my code soon. Actually I wanted to do so earlier but I didn’t just want to release the demo code but instead a playable game. So I started to create a map and while doing so I though I need more features like switches and maybe a game menu, death sequence. So I am currently adding these things before I release it so I will not end up just as a demo but as a real little raycast like game that people can enjoy.

After the release I hope people can help me to get better graphics and improve the engine so we will gain more speed and PROGMEM. I am not a game developer nor an artist so every change takes ages :smiley:
I am giving my best to finish it up soon. I have an hour or so per day to work on this while heading to work and back but meanwhile most of my problems are gone and I just need to stop myself to add more features and get it done for release.

So I hope you can finish your engine/game for the pokitto as well. Hope you will join the efforts to improve my engine for the Arduboy as well. But be prepared, my code is mostly C with a little dash of assembly here and there (and some not so pyhthonic python code :wink: )

I saw you released under CC0. I also want to keep my code free and thought about MIT or GPL 2.0 (like the Linux kernel). Any advice here?

(Simon) #73

@drummyfish can you post the Arduboy code that generated that sample?

(Miloslav Číž) #74

Thank you :slight_smile: Your engine is definitely more suited and optimized for Arduboy than mine, and I’ve seen it has some feature which mine doesn’t yet have, e.g. doors in the middle of the squares. I am looking forward to try it out.

Also take your time with the release, no need to rush :slight_smile: I really just wanted to share my code with you and other raycasting enthusiasts.

My library is also C, so no problem at all :slight_smile:

Actually yes, I do have an advice! There have been recent events in the Linux world (I’ve discussed it with @Pharap a lot, you can read about it here), which put all GPLv2 software (sadly including Linux) in danger. So if you want to go with GPL, go with GPLv3 (that one should be safe as far as we know). I don’t know if this is the case with MIT as well, people are now confused a lot about the situation. (@Pharap pointed out to me that the Apache 2.0 license is safe if that is also an option for you).

(Miloslav Číž) #75

I can, but


this has to be noted:

Everything is extremely WIP and I put the Arduboy demo together quickly without the intent to release it at that stage – I just wanted to make the GIF. You can do whatever you want with the code, but on your own risk :smiley: No warranty whatsoever. I have planned to make a nicer demo, but that’s a few weeks away right now. So here are the files (it has currently experimental floor rendering => low FPS, you can turn that off):

arduboy-fps.zip.pdf (14.0 KB) <— strip the pdf extension (I couldn’t upload pure zip)

(James Howard) #76

@drummyfish Had a quick look at your raycasting library and it looks pretty cool! (Also reminds me I need to do something fun with my Pokitto)

I love these old school pseudo 3D techniques, looking forward to your demo @veritazz!

I might have to have another crack at something like this on the Arduboy too. My last game like this was Wolfenduino on the original Gamebuino:

(Pharap) #77

Yeah, don’t use the GPL :P

Stick to MIT, Apache 2.0 or BSD 3-clause, like most Arduboy games.

The GPL’s viral nature means that people won’t be able to go “hey, I like that one little function, I think I’ll use it in my code” unless they also release their code under the GPL.
Using one of the other licences lets them borrow just the one function and use it in a library with a non-GPL licence whilst still retaining the copyright notice for that one function.

Also the GPL requires people to both document and date their changes, which gets annoying pretty quickly.
(The Apache 2.0 licence also requires that you include a ‘prominent notice’ that you’ve changed things, but really it only amounts to a small comment at the top // modified by X, and doesn’t have to be dated.)

Fortunately Apache 2.0 has always been my go-to licence, so you can rest easy knowing that I can’t redact any of my Apache 2.0 licensed code. :P

By which I assume you mean ‘the C-like subset of C++’ and not actual C?
Or are your files actually .c files?

(I know, I’m being pedantic, but the difference does have implications.)

(Michael Gollnick) #78

Images and lookup tables are .c files and the engine is a .cpp file in a “C-like subset of C++” style.
As said in an earlier post I think you might need to scream for a week or two after looking at the code. But I am willing to learn and maybe we can find a way to make proper C++ code out of it :sweat_smile:

Ok so for the license I might need to choose between the Apache 2.0 and CC0 or MIT. If the latter two are the candidates then probably CC0 will be the winner.

(Pharap) #79

There’s not much point in putting the images and lookup tables in .c files, they may as well just be in .cpp files, it’d save the compiler having to switch to C mode for the sake of a few files.

There almost certainly will be a way.
I’d be happy to chip in a bit with making it more C++ friendly.

You never know, it might even result in some space savings or speed-up.
(I’m sure I could find some either way.)

I prefer Apache 2.0 or MIT because they’re more well-know and more widely used but I can live with CC0, since that allows re-licencing under MIT or Apache 2.0 anyway.

(Miloslav Číž) #80

I’m absolutely in love with these visuals. I’ve noticed with your games you have a big talent to work with the limited resolution and colors.

I’d personally try to make it a bit more different from wolf because of the copyright, trade dress and all of the other members of the so called intellectual property family :slight_smile:

Until recently I would have recommend MIT, but I’ve been looking at it and its simple wording doesn’t seem to contain any protection against what’s happening with GPLv2, so I no longer know whether I can trust it (it’s sad that AFAIK exactly MIT and GPLv2 are currently the most widely used licenses).

All this legal hassle is making me only more strong in my belief that I personally want to keep giving up all of my rights with CC0. I’ve been reading through it now too, and it tries as hard as possible to express giving away all of the copyright and the neighbouring rights (such as the moral rights) and in case this fails under some jurisdictions, there is a fallback license. It’s funny how difficult it is to give up your rights (and sometimes, e.g. with the moral rights, it’s legally not even possible) :slight_smile:

So personally I’d love to see the code as CC0, but your choice has to always be informed and you have to know you give up all the rights, even the right to attribution etc. If you insist on attribution, probably go with Apache.


That looks totally awesome. Love to work/help on a Arduboy port.