As posted in
another thread:
- 3D.love
- Even newer version than the one earlier tonight.
- (9.71 KiB) Downloaded 365 times
It is AS IS. No warranty. Work in progress. Whatever I was working on at the time I left it last. So don't complain!
Edit: Earlier version replaced with newer version I just did. I'm getting 60FPS with 100 cubes bouncing around inside a cubical area. Polygons are now attached to their object definition. The object is what is moved and manipulated and the points and polys inherit their properties.
The only problem is in Löve, 3D calculations are slow...
- Screen shot 2010-11-17 at 8.26.00 PM.jpg (70.52 KiB) Viewed 3850 times
40FPS on I think 190+ cubes. (The screenshot was taken with Hulu Desktop running fullscreen on another display) Each with 6 sides (I implemented 4-sided polygons to help cut down instead of having to always use two triangles for a square) and 8 points of their own. Which would mean over 1000 points and 1000 squares.
The more points there are and the more polygons there are, the slower it is. Also, it's not that easy to program clipping. (i.e. when a polygon intersects another and it clips the unseen stuff.)
Now, the problem with my program is that it recalculates the location of the points every frame because they're always moving. IF I were to turn off the calculations for each subsequent frame after the first, and have it use the same points every time, it wouldn't be moving, but it would be faster. With optimization, I could set it up to only recalculate objects that are moving and not unmoving ones. I fully plan on turning this into an FPS or something in the style of old-school late 80's 3D PC games.
IF Löve could do texture warping and clipping, it could do real 3D textured models.. but then again, it would be SLOOOOOOOOOOW. Löve just can't handle that large amount of looping.
See, the program needs to loop through both the points and polys tables a few times each frame. Even if I optimize it to only loop once for each, maybe I might gain some FPS but still it'll be slow. It goes through Points twice and Polys 4 times. It even has to go through the Poly table, then sort the polys by their lowest Z coordinate, then go through the Poly table again.
Future plans include marking objects as static so they don't get calculated every frame (i.e. once their points are plotted they don't need to be updated) to reduce FPS loss. Also, sprites. The old-school 3D game style with a flat image representing a 3D object. Also, not just a FPS game but maybe also a Kart style game.
Don't get too attached to this version. Just use it for reference. I want to rewrite the model loader and make models separate entities that can be moved independently and rotated and shrunk and everything.