Advanced Raycasting

Creations

drummyfish

5 years ago

RELEASE UPDATE:

I got my GameBuino, tuned this a bit and set it as released. To check out the demos, download the code and put the three folders (raycasting1, raycasting2, raycasting3) on your SD card.

The first 2 demos are running a bit slower, but could still be workable. Demo 3 runs much more smoothly (due to absence of textures).


UPDATE:

Since a few people liked this, I have now ported all three demos plus the hello world program, made a GitLab repo


https://gitlab.com/drummyfish/gamebuino-raycasting ( this website doesn't support adding a GitLab repo, only GitHub :-[ )


and cleaned the code a bit. Hopefully it can be useful to someone who wants to make a game based on this.


The bin uploaded here is demo1, but you'll find all 4 bins in the GitLab repo.

--------------

Very WIP port of my raycasting demos from Pokitto as a proof of concept.


Hello all! Regarding the demo, please read this:


I am new here. I don't own Gamebuino yet, but am planning to buy it (probably Christmas). I do own other open consoles though. This is a super quick attempt at trying to run one of my demos on Gamebuino emulator. Don't take the source or the bin seriously, it's only a proof of concept ATM. On the Pokitto console, the demos look like this:





My wish is just that there is a raycasting engine for everyone to use, the sooner, the better.


Unless you want to wait for me to get my Gamebuino and finish some project I'm busy with right now, some experienced folk here should port this in a nice way. It should be easy. What you see I've been able to do within an hour, including setting up the Gamebuino environment and learning the API.


The demos can be found here. They use a C library I made for the demos, but I made it specifically so that it is portable, independent of any platform, fast and simple to use. I've already tested it on multiple very different platforms. No need to change anything in the library. Just take the frontend source code (*.cpp, *.hpp) and change the API calls to Gamebuino calls. Start with helloRay.cpp as it's a very basic program to show you how it all works. You can take inspiration in the source I uploaded here.


DO NOT FORGET TO ADD -O3 FLAG TO COMPILER FLAGS! (otherwise it's gonna be slow) If you don't know how, Google around a bit... it involves finding a file named platform.txt under some Gamebuino subfolder (mine is ~/.arduino15/packages/gamebuino/hardware/samd/1.2.1/platform.txt) and editing the flags in there... then don't forget to check the compilation console output to see if it's actually using the flags (turn verbose compilation on in the Arduino IDE).


(To convert textures to the format used in the source code use the Python script in the original demos' repo, it's all documented in there.)


If you figure this out and wanna just make a game with it right now, by all means go ahead please! That's the goal here. It's all CC0, you do NOT need any permission or giving any credit (it's nice of course, but not needed), just take it and use it. (All on your own risk thought, no guarantees whatsoever.)


From a quick look it seemed like META is similar to Pokitto, so I think it should run comparably as fast (Pokitto has a bigger resolution and still I've been able to get as much as 60+ FPS). But if not, there are ways to lower the quality in order to improve performance -- e.g. if you disable floor texture coordinates and apply some horizontal subsampling, you should get this running reaaaaly fast.


PLEASE, if you do, share your code under some free and open source license. Thank you :-)

View full creation

drummyfish

NEW 5 years ago

EDIT: moved the description from here to a proper place.

jicehel

NEW 5 years ago

To have something like, we should use the system exposed by Aoneil here :https://gamebuino.com/community/topic/high-resolution-without-gb-display#c3386 to use hi-res with ay casting textured. I don't know wich frame rate will be able in these conditions. Aoneil maintened a good frame rate with his game so, it could be possible. I hope that some of our best programmers wil have time to works on this motor and fix the possible deformations of the textures. Your demo is awesome, levels, textures, animations...

MAybe 3 raycastings system have been launched you'r seems the moe advanced atm. I hope that someone will complete it and optimise (i think that if we want add informations about player (live, ammo, keys, ...) we should use hi res, but it's only what i think, you may not share this idea. Some try of it could be fine.

makerSquirrel

NEW 5 years ago

looks pretty cool! thanks for sharing! Within the next 4-6 weeks I hope to come to a level where I could work on a game which could use your engine. If I ever produce something playable, of course the code will be shared and of course you will be in the credits.


cheers!


The CPUs of Pokitto and Gamebuino Meta are not far away from each other. the only noticeable difference is the RAM, where Pokitto seems to have 36kB and the Meta has 32kB.


Edit: the systemshock-like demo looks pretty cool!

drummyfish

NEW 5 years ago

Okay, so I've cleaned it up a bit, now there are sprites and you're able to jump, and the code is a bit nicer etc.


The important thing: I've put -O3 to compiler flags which made it several times faster! Don't forget to do this when fiddling with it (you have to edit compiler flags in a file named platform.txt that is buried somewhere under Arduino folders under Gamebuino subfolder... Google it up... and check the compilation output to see it's actually using these flags).


Could someone please test it on the actual hardware? :-)


Edit: the systemshock-like demo looks pretty cool!

Thanks, I've actually never played System Shock, but people keep telling me it looks like it :)

deeph

NEW 5 years ago

Awesome :)

One of my projects is also a raycaster :

I'm currently trying to optimise it using fixed point, but it's not quite working right now. And I will also try the -O3 to compiler flag, thanks for the tip !

Anyway I quickly tested yours and it runs great, as far as I can see :

drummyfish

5 years ago

Looks great! My engine is still missing some features because I focused on making it very configurable and portable etc., so it's good to have multiple projects like this. Fixed point is a must... you don't even need any library for that -- simply suppose you're working with small units like millimeters and use normal integers. In the end I found the biggest bottleneck to be the per-pixel operations such as texture sampling, fog and so on... it's understandable, since there are typically a lot more pixels than rays or squares you're tracing.


I quickly tested


Wait, this is recorded on the real Gamebuino? If so, it looks running well. Looks like the porting is real easy. I think I could port the other two demos as well then.

drummyfish

NEW 5 years ago

deeph deeph

Looks great! My engine is still missing some features because I focused on making it very configurable and portable etc., so it's good to have multiple projects like this. Fixed point is a must... you don't even need any library for that -- simply suppose you're working with small units like millimeters and use normal integers. In the end I found the biggest bottleneck to be the per-pixel operations such as texture sampling, fog and so on... it's understandable, since there are typically a lot more pixels than rays or squares you're tracing.


I quickly tested


Wait, this is recorded on the real Gamebuino? If so, it looks running well. Looks like the porting is real easy. I think I could port the other two demos as well then.

deeph

5 years ago

Yes it's recorded on the gamebuino, though the .gif is about 1.5 to 2 times faster than the reality. I haven't checked the source yet, so maybe it wouldn't change anything, but you could maybe try to increase the frame rate (withgb.setFrameRate();).

jicehel

NEW 5 years ago

I have try it. Well done, it's playable. It's could be a little quickest but it's already good. A problem some times appear with background textures showed on in front sprite. I hope you will port your others demos and more than that i hope you'll continue to works on your version of the motor. As you see some have already works on a motor (deeph, alxm, ANARKAVRE) (you can see cool info from alxm in this post: https://gamebuino.com/creations/raycaster)  I have not retrieves the old posts of alxm and deeph with their codes.

Your system as already alot more options available but you may could have found some optimisation ideas in their sources.

What is to do for me: Correct tis background texture shown on infront sprites. Be able to aligne texture fro top or background to avoid the problem of textures when floor is not flat and a little more optimisation to be able to have time to manage futurs ennemies and shots but i like alot this motor and i think we have never been so near of a  doom like game. I talk now of a doom and no more of a Wolfenstein game with what i have seen... Many thanks for this demo. I'll have very good dreams tonight    :)


deeph

NEW 5 years ago

drummyfish drummyfish

Yes it's recorded on the gamebuino, though the .gif is about 1.5 to 2 times faster than the reality. I haven't checked the source yet, so maybe it wouldn't change anything, but you could maybe try to increase the frame rate (withgb.setFrameRate();).

Sorunome

5 years ago

In the online recording to gif conversion tool a framerate of 25FPS is assumed. If the game actually runs at a lower framerate it'll appear sped up

Sorunome

NEW 5 years ago

deeph deeph

In the online recording to gif conversion tool a framerate of 25FPS is assumed. If the game actually runs at a lower framerate it'll appear sped up

drummyfish

NEW 5 years ago

gb.setFrameRate();


Nice, I haven't seen this in the reference, I set it to some 50. It doesn't seem to have done much in the emulator, but may be better on the HW. I really need to get my Gamebuino soon :|

Party_Pete

NEW 5 years ago

I hope this engine takes off on Gamebuino!

drummyfish

NEW 5 years ago

I've ported all the demos now! I can only upload 1 bin here, but you'll find all of them in my repo.

drummyfish

NEW 5 years ago

 doom like game

There is a project, Freedoom, which offers free resources (sprites, textures, sounds, ...) for such a game. I suggest if anyone wants to make a doom clone, no need to start from scratch, just reuse these assets.