I’m back for today’s update and I’m really impressed at how fast I’m getting things done in this project. This is the first time I try to create a 3D game and I’m still learning a lot of OpenGL-related things but everything I had planned to do was simple and easy to implement. Let’s hope this continues until the competition deadline.
The new features for today are the mouse cursors and inventory/items manipulation as shown in the video below.
Okay, day 4 started with some changes to my Map class to support a number of items on each tile. I’ll be using billboards for the items and monsters rendering. The good thing about billboards is that they are extremely simple to implement and the result won’t be worse than Wolfenstein 3D(that is awesome). The screenshots below show some items on the dungeon floor, the new mouse cursors and some items in the player inventory.
For next step I had to implement some sort of 3D selection so that I could render the tooltips for items on the floor and allow the player to interact with them. I read about OpenGL selection and polygon picking features but it seemed too complicated for such a simple task. Fortunately, the OpenGL Red Book mentions a technique for object selection using unique colors and the backbuffer. This technique consists on rendering a simplified version of the scene(with lighting, fog and texturing disabled) where you render all selectable objects using unique colors. Then you check the color of the pixel on the backbuffer corresponding to the cursor position and using some sort of list of selectable objects you get the object associated to the obtained color. The screenshots below show a normal rendering and the associated selection backbuffer for the scene.
Upcoming features for the next update: multiline tooltips, initial monsters implementation and maybe some combat.