Tuesday, 1 February 2011

Developer Journal 48

2:58 PM

I just saw some footage of another version of Polyworld. It looks really good. Kind of bums me out. I've been working on my simulation for so long!

The video is foodotrope-hill-flying-pill-session.mpg by toomalf. I recommend you visit toomalf's channel for more great videos.

5:13 PM

I just spent a few hours trying to figure out how to scale textures with code.

I managed to get a pointer to my material by going from class Entity to class SubEntity to class MaterialPtr to class Material.

I through the way to change scale was to use Material::setParameter().

The problem was Material::getParameter().size() was 0.

After a lot of searching on the forums I found.

How i can change scale textures programmatically?

Thanks to makiolo and madmarx I now know how to do it.

You start at class Material then class Technique then class Pass then class TextureUnitPass.

Then you can use TextureUnitPass::setTextureScale( float uScale, float vScale )

6:35 PM

I tried setting a texture to be 1 unit. Took me a while to figure out, textures automatically scale to the size of your object. If you want a texture to be 1 unit by 1 unit on a ground that is 100 units by 100 units, you need to scale your texture by dividing its u scale and v scale by 100.

10:16 PM

Grr. I rotated a cube by 45 degrees and it looked like the cube rotated and then rotated back. Nope. The cube was rotating.

I then rotated they cube by 90 degrees and 180 degrees the cube looked like it didn't move. Nope. It did move.

Grr. Must make the front of the cube look different.



  1. Hi Binh,

    It sounds like we are on similar paths. The general idea to which I ascribe is that there is little difference between animal and human intelligence on a fundamental level, and that much of the disparity between them can be roughly attributed to: 1. physical abilities (with respect to manual dexterity, vocalization, bipedalism); 2. larger cortices; and 3. socio-cultural development.

    My current goal is to be able to simulate a system of ~30-50 units with large cortices (~800mb/unit) in real time (~60 fps for rendering and physics; hopefully more for the neural networks). The number of units is based on the optimal group size for intelligent primates living in complex social structures. I realize that this will only leave me with one or two groups, and this is something that we can discuss further. For now, suffice it to say that this is only a starting point, and my next stage of development will involve many groups.

    Given the performance concerns, I decided to start from scratch. The problem that I am currently working on is sharing the necessary information between threads while keeping synchronization time to a minimum. I hope that keeping the system highly modular will allow it to scale up to multiple cards/machines more easily.

    Do you mind if I ask where the new Polyworld video was, and why it has you bummed out?

  2. Hi Anonymous,

    Thanks for letting me know about your ideas, much appreciated. I'd love to know what led you to these ideas.

    It took me a lot of time and a lot of reading to get to mine. A lot of my ideas come from What Computers Still Can't Do (Hubert Lederer Dreyfus, 1992), Consciousness Regained: Chapters in the Development of Mind (Nicholas Humphrey, 1984), and more.

    I really like your approach and you're going the right way with the size and number of groups. Please keep me updated on your progress. Is this an academic, industrial, or personal project?

    I'm impressed that you're starting from scratch and that you're tackling the performance problem with threads. I can't wait till you get the chance to scale up with multiple cards and machines.

    I'll embed the video in this post. The video got me down a little because firstly it looked really good. Secondly, I've worked for a while to integrate a Ogre graphics and Bullet physics but the developer in the video seemed to get along just fine without them. Irrational, I know, since we probably have different goals but still :)