So I was watching a video on someone making a doom 3d engine style thing and it looked pretty interesting, however he was using vector mathematics and matrices which I have basically no understanding of. Wondered if anyone on here has any experience or links towards good resources for learning this kind of thing?
The book I always recommend is the nature of code.
It explains the math of physics in super easy, understandable and fast way.
The book begins with basic math explaining what vectors are and moves on to more complex algorithms. Every step is followed by easy understandable code samples in simple java.
You will have no trouble to follow if you speak C(++).
There is a physical release which you can get on amazon but the whole book is available online.
Looks like a hefty tome… but thanks!
But it isn’t I promise! It’s super easy to digest.
The first chapter vectors alone should cover your questions.
Thanks, ill give it a go!
I didn’t check the other book linked but if you check a library for linear algebra books they occasionally will have code in them for each topic as well. You might need an older book though, mine had no code examples and the department recommended one had Matlab I think.
Then again you can probably find c examples for any topic faster on the internet, Wikipedia or stack overflow ect.
I can do a lot of it on paper but not in code.
If I remember right @pharap linked a couple of vids on vectors somewhere for character movement and there’s also at least 2 raycasting doom-lite engines for the arduboy as well
Thanks for the mention, I hadn’t got round to reading this thread yet.
The video series can be found here.
He discusses other stuff in later videos (like A* pathfinding),
so if you want to focus on just vectors the playlist for the simple vector stuff is here and the playlist for the advanced vector stuff is here.
(If you ever lose the link again, it’s in my ever-handy resource collection.)
As many will know, I usually prefer written articles to youtube videos,
but this is one of those rare cases where I recommend a video series.
I really like this series because Jorge dedicates a video to each aspect of vector arithmetic and ties it to a real-world situation.
(By which I mean a use-case in the context of a video game.)
- Vector subtraction in terms of finding the difference between two positions
- Vector magnitude (length) in terms of finding the distance between two positions
- A common videogame speedhack where the square of the magnitude is used instead of the actual magnitude
- (It cuts out the expensive square root)
- Vector multiplication with a scalar
- Unit vectors
- Vector addition in terms of character movement
(@Kea_Oliver, I apologise for all the people saying ‘math’ instead of ‘maths’.)
More useful info, i appreciate this too, between books and articles i found and videos I’ve been linked I’m sure I can put something together.
(@Pharap it’s fine I forgive them )
If it’s not just the theory you’re interested in and you’re planning to actually include some vector stuff in one of your games, let me know and I can give you some tips.
(I’ve written half a dozen different vector and matrix implementations over the years.)
Im a very easily distracted person, I was planning on POSSIBLY including something in one of my games and due to the arduboy not having access to any of the libraries to make this stuff super easy I decided I would at least learn some cursory stuff, whether This actually becomes a game or anything is up in the air.
Which libraries are you thinking of?
Or do you just mean it doesn’t have any vector libraries available in general?
I should have been more accurate in that my only existing experience with any sort of 3d graphics has been within things like Unity which abstracts it WAYYYYYY out.
Ah, that explains a lot.
This is one of the reasons I’m not a big fan of Unity.
It makes it easy to get things up and running,
but it makes it too easy to avoid having to learn the details.
I take it that means you know a fair bit of C#?
I suddenly remembered another good resource. My favourite maths website!
In general I hate maths and mathematicians because practically every maths explanation on the internet is overcomplicated and assumes too much foreknowledge.
‘Maths is fun’ is an oasis in the dessert.
“knew” would be more accurate, I havent programmed anything in a good few years and a lot of what I did know has vanished. You are dead on about maths sites though, finding a basic overview of something can be tricky.
Once you embrace the numbers into your being they’re not as bad.
Until the next day when you fall down another hole and suddenly all the numbers are missing and there’s only words and squigglies
Well, you managed to write something that uses bitshifting, so it can’t have all vanished.
I think it’s because historically the people who did maths were mostly wealthy well-educated people who liked to use Greek and Latin in their maths texts to show off how clever they were.
The numbers I can live with, it’s the endless over-formality and the dictionary of obscure mathematical terms that you have to carry around.
My favourite example is “An Elementary Treatise on Determinants” by Charles Dodgson.
(Or ‘Lewis Carroll’ as you may know him.)
(Unrelated: his uncle had an excellent name. “Robert Wilfred Skeffington Lutwidge”, who was a ‘Comissioner in Lunacy’. Honestly, you couldn’t make this stuff up if you tried.)