Blog do Eduardo Costa Meu blog pessoal


Good bye, iOS 4

I'm planning to go back to iOS development, and I got the newsflash: XCode does not support iOS 4 anymore. Bad news for anyone who believes in iOS 3/4 market share. This means the end of torture to me. I can freely use Storyboards, Shaders, iCloud, Facebook and such.

I did not find anything official, but kind developers have graphs e stats. Numbers are depressive to iOS 3/4 fans. These devices does not reach 4% of market share. I doubt these users will pay dev's salary. On the other hand, cool features and brand-new iOS 6 users will probably pay for a cool app.


Filed under: programação No Comments

Tower Defense using Unity3D

Blender and Unity3D made my life so much easier. In less than a day, I created from scratch the basics of a simple "Tower Defense":

Blender takes care of the map (i.e. the Hulk-colored blocks) and Unity takes care of enemy proximity detection. I made a couple of simple scripts and I'm done.

Filed under: programação 2 Comments

Hello Unity3D World

After weeks studying Unity3D's tutorials, I finally made my own "hello world" game. It's a remake of an ancient game of ping-xong. The name I can't tell, because the owner of the copyright will sue me for good. Believe me - this happened when I published a game like this in Apple's App Store. Oh, and the game was 100% free...

This (also free) game is only an experiment. I made nothing more than base mechanics and some funny FX. I guess there are so many bugs that they can unite themselves and conquer the Earth. Anyway, click here to play. BTW, talking about suing me, this game is provided AS-IS. No warranty that it will work and I'm not responsible if evil overlord bug blows up your HD. One thing I assure: my HD didn't blow up...


Filed under: programação No Comments

Webdesign is now simpler

Back in 1999, I worked as a webdesigner, and the job was hard. Dreamweaver helped a lot, but Netscape and IE made my work impossible with their little market share war. It was an impossible mission to create a site compatible with both browsers. Solution usually was an "IE-only" icon.

In 2004, as a junior programmer, the HTML-compatibility problem morphed into JS/CSS-compatibility. No more ugly "blinks" or "marquees", but IE, Mozilla and the brand-new Firefox still didn't match.

Now, with Safari, Opera, Chrome, Firefox, IE and dozens of minor browsers, I could feel like Dante myself, but thanks God because "compliance is law" now. After twelve f***ing years, I only need a couple of workaround to achieve full cross-browser compliance using a Zen-like technique!

Together with Wicket and JS frameworks (jQuery), it got really easy to make a Java website in my spare time!

Filed under: programação No Comments

Vanilla unit testing in iOS

I guess I finally understood how to make unit testing for iOS using XCode 4. I'm used to the simple and pratical JUnit+NetBeans combo (sometimes "+Maven"), but I got no luck googling it.

There's a nice way to make vanilla tests. Add a new "testing bundle" target to your project. Make sure it don't have dependencies to the main project. Add any class you need for the test to the "target sources". Create your test classes and mocks for the non-tested classes. This way, you can create suites for testing specific classes/features by using mocks for non-related classes - and without using any mock frameworks.

Now, edit the scheme for the main target. Put your test targets into the "test" configuration. After this, you can run all tests (⌘-U) while working on your main target!

Filed under: programação 2 Comments

Cube optimization

I'm doing some tests with OpenGL and cubes. I found some impressive numbers and I want to share them.

If you really know OpenGL, you are aware that glVertex with GL_TRIANGLES stinks. It's the simplest way, but is also the worst way. Using Vertex Buffer ObjectsglDrawElements and GL_TRIANGLE_STRIP is always a better idea.

Let's go to the numbers. In a cube, we have 6 faces, right? Each face has two triangles with three vertices each. This is 36 (6x3x2) points. For each point, we have 3 coordinates (X, Y, Z), plus a extra one for shaders (W) , and two more for texturing (U, V). Using floats, we have 6 of them with 4 bytes, this is 24 bytes per "point". This means the cube has 864 bytes (36x24).

How to improve? First, we will change the floats with shorts for XYZW. This will lead to 16 bytes (4 shorts of 2 bytes plus 2 floats of 4 bytes). This reduces the cube to 574 bytes (36x24). Better, but not good, yet.

With triangle strips, we reduce the vertice count. The texture I need for the cube allows me to make a "strip" for the sides, one for the top and one for the bottom. I managed to describe my cube using only 22 points. Now, my cube has 352 bytes (16x22). Way better, but we have the final trick!

VBOs: these 22 points have only 15 unique occurrences. This means we have 240 bytes (16x15), plus 22 shorts for indexes. Total: 284 bytes (44+240)!

This means we have a 68% of memory optimization!