Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.






Pixel-perfect orthography

Posted by polyfrag, 03 July 2014 · 516 views

Some open source linux enthusiast person has been helping me with my project.

https://github.com/polyf/corpstatesc/commits/master

Thanks to his final nudge, the RTS runs on linux now.

Posted Image

Though it's very slow on his Core 2 Duo, mid-range NVidia setup, though he runs HL2 Ep2 fine. Attempts at fixing possible causes of the problem and profiling didn't help. My mom's 2007 Dell Inspiron 530 happens to be a Core 2 Duo, so I thought I'd try optimizing on that. But then I found out it doesn't even have a real videocard, just an integrated Intel GPU on the motherboard, and only supports OpenGL 1.4.

I thought, like my laptop, that it had a real videocard in addition to the integrated one, and couldn't understand why it wasn't being detected, until I opened up the case. All that was inside was an ATI TV tuner.

Posted Image

So, with difficulty, for the sake of getting the game to run at at least 60 FPS, I decided to make it isometric and make my mom's computer the test (and development) bed. So goodbye to 3D.


Posted Image


Boring details

Making it isometric allowed me to make use of my sprite renderer. After a week or two I ported my sprite renderer to linux and OpenGL 1.4. Though I found out it was too slow on my mom's computer with a moderately complex scene. So I decided to work on my laptop making the art and making the RTS isometric until it was fast enough to run on my partner's computer.

Posted Image
Getting the math right required some thinking.

Posted Image

Posted Image

I also learned a lot about making pixel-perfect tile renders. For the last couple of days I was struggling with getting the tiles rendered without gaps. GL_POINTS and GL_LINE_LOOPS occupied more space than GL_TRIANGLES. I wondered how no gaps ever showed up when I rendered tiles in 3D. Examining screenshots, I discovered that the exact pixels rasterized depended on world coordinates of all the triangle vertices.

For example, how could these tiles fit without gaps? There's a 1-pixel-high gap between the top and bottom tile, yet if you look at their left and right corners, you'll see that they're too stubby to fit in the gap.

Posted Image

However they do fit because the other tiles will have a shape that fits.

Posted Image

It seems it didn't matter. Rounding the the tranformed vertex coordinates instead of truncating them when converting them to integers allowed me to get the correct pixels off the framebuffer.

Brilliant preprocessing ideas
I look forward to optimizing the RTS to run on 2007 hardware. I will do heavy duty sprite rendering and preprocessing on my workstation laptop, while the game will run on 2007 hardware. What preprocessing can I do? Something brilliant like BSP maps like Id Software did on NeXTSTEP computers back in the day (and Quake 3 AI/pathfinding preprocessing). Maybe training neural net AI or balancing the economy?

I'm looking forward to making it multithreaded.

Though I wonder what the problem with 3D was.




Looks like that video card could use a good burst of air!  Even so, I applaud the optimization efforts.  You can always switch back to a 3D based isometric view later on when better hardware comes along.

It's not a video card. As I said the video card is integrated into the motherboard. In the photo is an ATI TV Tuner for hooking up to a TV.

November 2014 »

S M T W T F S
      1
2345678
9101112131415
16171819202122
23 242526272829
30      

Recent Entries

Recent Comments

PARTNERS