Basic2DP
- 13 Devlogs
- 26 Total hours
Basic2DP (Basic 2 Dimensional Physics) is a 2D physics engine that will feature translation of the bodies. It is made in C++17 and SFML library is used for displaying the graphics.
Basic2DP (Basic 2 Dimensional Physics) is a 2D physics engine that will feature translation of the bodies. It is made in C++17 and SFML library is used for displaying the graphics.
I am working on CLI system for giving input to the app
As of now I have added a couple of features like updatevelocity, applyforce, setgravity and exit
I did not do a commit yet I will do it in the next session
I will add more features into it and I currently I am adding a way to get some information from the app which I will tell about in the next devlog
AAAAAGHHHHHHHHHHH MY HANDDD
all i did was some exercise and since then my hand hurts very bad which is why I can type properly
just a bit of weird movement and it feels like its going to fall off
soo i am gonna tell whatever I have done till now
I am done with the physics and collision and now I need to make a CLI for user to do things
For that at first I was going to pause the physics and then let the user enter but then I found out about threads
Basically when we code everything happens in a straight manner like one step at a time, imagine this like a single assembly line for producing things.
Now that I use thread I can do multiple tasks without having to stop the other task which is why I wont have to stop the physics process this is like having two assembly lines (i am not sure what that analogy means but I dont have a proper example
, basically I can do things alongside other things without having to pause)
Noww next devlog when I add something new and my hand gets better
cya!!!
Dayum today’s time is kinda long cuz i was being a dumdum
What happened was since in a physics system we have the graphics, collision and physics so I thought of making different classes which was not a good choice so I spent a REALLLLLLLLYYYYYYYYYYYYYYY long time making those classes and since I wanted it to be inherited the system got really messy and I just kept getting error and errors.
So, I stopped and now I am no longer fighting for my life.
But then I spent some time making the wall collision a bit better, I improved the logic and also the way positioning happens in it and now the collision is extremely smooth and good looking and it no longer overlaps.
After that worked I added gravity which was simple unless you are like me who spent a lot of time but the solution was just one line away.
I just had to decrease velocity as per gravity * dt because gravity is second derivative but I kinda tried to mix things and update the velocity and position as the same time.
I also added a reference to delta time in main class this way the delta time stays consistent
Now I am gonna add a position correction system for object to object collision and then I will be more than 60% done with my project (or so I hope)
Soo the COLLISION SYSTEM IS COMPLETE
I can finally start working on the physics it could be easy I think.
As for collision I followed this document: collision reponse
Oh wait I need to add collision response for boxes as well
I JUST REMMEBERED THIS AS I WAS WRITING THIS DEVLOG 
I am more cooked than the food when I cook it
the collision system
i am starting to understand it now
well i cant really explain much in this session sooo i will explain everything in one go after this is done
for some reason i have been using things that need x and y components as different variables which i dont know why i was doing so i shrinked(if thats a word) them and joined everything info sf::vector2f
other than that i spent the time trying to implement things that i did not properly understood
gonna spend some time studying a bit better
well didnt do much today got busy here n there
today i finally implemented the functions and classes and they are working smoothly rn, at first i did run into some weird errors which i fixed
now i am gonna work on adding object to object collision now that i am done with the regular collision.
I added header files and seperated things to make them cleaner to look at
i havent updated the code to work with the headers they are seperate now but I will change it later
uhh i forgot what else i had done cuz my hackatime was not working
MY EXAMS ARE OVERRRRRRRR
and now im back on work and I will try to do a devlog almost everyday.
I have been working on making the collision system for now i worked with the borders each time I will run into some problem like velocity being updated each frame time after it collides or getting garbage values because I forgot to initialize the variables.
Now they are fixed and now I will work on implementing collsion with other physics objects and before that I noticed that the circle will sometimes do slightly behind the border which is what I will fix.
Soo the last time I wrote the code everything was messy and since I had done not so much work I thought of doing everything from the beginning.
So I did and this also helped me to understand and improve everything by making the code a bit cleaner and making some functions and classes
I also made a struct vector for storing information of the entities.
For now I am working on adding only when the objects are circles also since I am implementing only the translation for now thats why I dont think someone will be bothered by not having rotation cuz they probably wont notice any.
I couldnt do much today my exams are going on.
But I made some changes to the coordinate system before this the +Y was going downwards now it is upwards
Now I have a better grid system such that every coordinate is positive and I wont have to deal with negative numbers
Soo I realised that making new shapes gets kinda lengthy sometimes so I added a class an object that will help me make a new shape
Also before I make anything related to translation and collision I will have to design the grid system
I am still thinking of how I should implement the grid and where I should keep the origin
Also I specified a fixed size of the window and including the border it is 840x640 pixels and without the border it is 800x600 pixels
Soo I just started making things and I have never really used a graphics library before so I spent quite a lot of time learning about how I am supposed to be using this library
Things went good and it was actually pretty easy to get used to
From tomorrow I think I will probably work on implementing movement first
or collision first……we will see