ssloy / tinyraycaster Goto Github PK
View Code? Open in Web Editor NEW486 lines of C++: old-school FPS in a weekend
Home Page: https://github.com/ssloy/tinyraycaster/wiki
License: Do What The F*ck You Want To Public License
486 lines of C++: old-school FPS in a weekend
Home Page: https://github.com/ssloy/tinyraycaster/wiki
License: Do What The F*ck You Want To Public License
Hi!
Please, add #include <cmath>
after
Line 5 in 13447bb
no member named 'sqrt' in namespace 'std'
.Hi!
First of all thank you for great tutorials on 3D graphics.
There is an issue when building project on Windows with GCC. In initial commit in file tinyraycaster.cpp
in function drop_ppm_image
you have:
std::ofstream ofs(filename);
ofs << "P6\n" << w << " " << h << "\n255\n";
On Windows GCC replaces \n
in output file with platform specific code 0x0D0A
, what is incorrect (it should be 0x0A
in the file). This result in incorrect *.ppm image representation.
This happens because of opening file in "text" mode. To fix this, file should be opened in "binary" mode, for example like this:
std::ofstream ofs;
ofs.open(filename, std::ofstream::out | std::ofstream::binary);
ofs << "P6\n" << w << " " << h << "\n255\n";
Then everything works correctly. I think this patch would not affect other platforms.
How much faster is the way to render without graphics libraries, and with the help of standard language functions as you have in the game? Would it be better to switch to sdl?
Currently it is rand()%255 but it should be rand()%256,
because of this 195841 colors will never be generated.
Thanks for your project!
I made a small port of it in rust: https://github.com/fistons/rust-tinyraycaster
Maybe this can interest you?
Cheers!
When I try to run this the assert on line 64 always fails
assert (sizeof(map) == map_w * map_h + 1); // +1 for the null terminated string
because they are different sizes. When I checked with a std::cout statement it returned that sizeof(map) was 165 while map_w * map_h + 1 was 257. Is this not an issue on other computers? I'm just curious to see if I'm the only one that ran into this issue.
I used CLion, C++ 17, mingw.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.