Debug Drawing Functions | Coding a 2D Game Engine in Java #24

preview_player
Показать описание

In this tutorial, I explain how to create a suite of debug drawing functions that allow you to add lines, circles and boxes to your game world at any point in your code. These are useful for visually finding bugs in complex code such as physics. This is also helpful for visually debugging game code, such as checking if a raycast is pointing in the right direction. We will use these functions to draw our grids in the next episode, right before we implement our snap to grid functionality.

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

Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :)

My Recommended Game Engine Books:

My Recommended Beginning Game Programming Books:

My Recommended Java Books:

Рекомендации по теме
Комментарии
Автор

If anyone else is having problems with the lines not showing, make sure you put the correct count in the glDrawArrays call in the DebugDraw#draw() method. It should be lines.size() * 6 * 2 and not just lines.size()

vedrankovacevic
Автор

Another amazing video from you! I really admire your work and the content of your videos is very focused and basically very helpful for amateur developers like me who have just got started in the graphics programming and game development.... So a very big thank you for that!

Just a thought came to my mind; while removing the dead-lines, can we just iterate the array backwards to skip that " i - - ; " step at 15:30 ? I don't know but the loop will be running for 500 iterations and in the worst case we will need to do the i - - calculation 500 times!

vedangjavdekar
Автор

Can you post the link about the game engine architecture by the naughtydog dev? As always thanks for these videos <3

vixellar
Автор

Gabe! I need ur help. Sometimes, like every 20-25 restarts off the app. The rendering breaks a bit. Just ONE Texture gets some artifacts, which change, based on their position.
By Artifacts, I mean, just 2% of the texture draw, but that 2% are only in one of the 2 Triangles of the quad.

youarenotanenemy
Автор

Good video, personally I would pass in floats though instead of new vectors so you don't have to create so many vectors every single frame

dooZyz
Автор

Do you think you could record your videos with your IDE more zoomed out, it would be nice to be able to see entire lines when they get long.

asherhaun
Автор

Exactly the same code. Line not showing. What could it be?

Now I tried putting it in update method of LevelEditor and it works. But when I put it in init() above the "loaded" it wont work. Neither will bellow loaded.
The glfw is working on vsync which my monitor is at 144hz so I tried putting in 2000

Edit: I had to put addLine2D two times in init functions and it worked after that.

Destroyer
Автор

Note. glLineWidth is deprecated and it may not work on some platforms.

johnnytw
welcome to shbcf.ru