Ray Optics in C++ banner

Ray Optics in C++

3 devlogs
9h 19m 52s

It is an attempt to build a Simulator to simulate ray optics in C++ using SFML.
This project demonstrates how does light interact with mirrors and undergoes refraction and reflection.
The project is solely being built by me.

This project uses AI

I have used ChatGPT to learn about the concepts and to learn SFML. I use AI to improve the speed of searching through the documentation of SFML. The Readme included in the project/repo is generated by AI.

Demo Repository

Loading README...

serwin.dev

Shipped this project!

Hours: 4.19
Cookies: 🍪 41
Multiplier: 9.76 cookies/hr

I have already shipped this before and with those feedbacks – i have made it again.
But the compilation process using emscripten was so hard that i abandoned it – and decided to go with normal .exe format.

serwin.dev

I went through the feedback and i tried to improve my UX.
After that, instead of just being a simulator – i made it into a game.
Yeaa, it was fun to make and hope it will be fun to play too.

I changed the process of adding mirrors – instead of just a straight mirror. I made it so you can create mirrors however you want – diagonal, short, long.
The concept of the game is also very simple – use the mirror to direct the rays into the given point (Which will be in blue circle)

Also, I found very complicate to compile the game into web – so i am preferring to export it into just an exe file..! It’s hard to compile into wasm.

I hope y’all will enjoy the game :)

Attachment
0
serwin.dev

Shipped this project!

Hours: 5.14
Cookies: 🍪 51
Multiplier: 9.91 cookies/hr

I built a simulator that simulates how light interacts with mirror.
I tried to implement both reflection and refraction but it seems to be harder than i thought,
I don’t have much experience in c++ and initially i selected SFML but it doesn’t support web and so i switched to Raylib – after completing mirror and rays.
I gained a lot of experience on using c++ and changing from SFML to Raylib.
The project is still under development and will be continously developed.

Future plans: Better UX, Mirror and kinda puzzles.

serwin.dev

I changed SFML into Raylib…
Since i have to provide demo in web – but it changed everything.
Fought with it but still a lot of bugs to be cleared.
So far, I cleared some bugs.. will work on it later

A good news: I added multiple mirror system

Attachment
0
serwin.dev

Just updated the ray of light.
So far, on right click of mouse, the simulator will emit light from the source as rays. The rays will collide with mirror and disappear.
Soon, the mirror will reflect the light or refract based on medium.

Attachment
0