Blender Game networking test

Now that I am working on a game, using Python cPickle and Socket, i was able to create a peer to peer, symmetrical network implementation for the multiplayer aspect of the project.   Using some 30 lines of Python, each player would ‘trade’ data with its peers.

I am using UDP, so it’s naturally faster than TCP/IP, but delivery is not guranteed.  But for realtime games latency is the main concern, so UDP is definitely the way to go.  The video shows me controlling a cube on the desktop computer (monitor to the right), it’s position data is sent across the internet* to the laptop which displays a similar cube.

Close to the end of the video, I turned off the Wi-Fi on the laptop, killing the network connection.  As expected, the cube stops updating, when I turn it back on, it takes a few second to reconnect, and then the cube starts moving again.

*I route the network traffic through another computer somewhere in town to simulate a more realistic network delay.

Blender, Memory issues and 64bit

RAMs are cheap, and that blender project you’ve been working on is taking up too much memory.  So you did the obvious: you bought 2GB of DDR2 memory and put it in the computer, fire up Blender and expect everyting to work as usual, right?

Maybe, maybe not.

Well, if you are still stuck on 32bit for some reason, chances are, you might run into a few memory related problems.  If you are running a 64bit Operating System with 64bit Blender,then you can safely ignore the rest of this post.  In a pure 64bit environment (meaning 64bit CPU, 64bit OS, 64bit app), the memory addressing space is virtually unlimited.   So the more memory you have, the better, 64bit can use it all.

Theory

Addressing Space can be seen as the maximum amount of memory and virtual memory the operating system can utilize. It is independent from the actual amount of RAM a computer has. For 32bit Operating System, the total Addressing space is ALWAYS 4GB, or (2^32 bytes). For 64bit, this number is a LOT bigger: 2^64 bytes is about 16000000 Terabyte.

Think of 32bit as a city where the phone number is 5 digit long.  In such a city, there is approximately 90,000 unique phone numbers, because of this, the number of phones(analogous to physical memory) can not exceed 90,000, it doesn’t make sense to have more phones than phone numbers, since there will be no way of reaching these phones.  Now, in a 64bit city, their phone number is 10 digit long, that gives them about 9 billion unique phone numbers.

32bit Limitations

32bit Windows is designed so that EACH application can only utilize up to half of the 4GB addressing space, or 2GB. (the other half is reserved for the system). Again, this is a software limit inherent to the architecture of the operating system, and has nothing to do with how much RAM is actually installed. This does not cause a problem for day-to-day applications because they usually stay well below this limit. But when working with Blender, especially baking fluids, or rendering high resolution images with composite node, a single application can easily reach 2GB of memory usage. From my testing, Blender crashes at the 1.8GB mark. Remember this is a software limitation due to the design of Windows, you can install 4GB of physical RAM on your computer, and set-aside a 4GB swap file, Blender will still crash at the 1.8GB mark.

Fix

Thankfully there is a fix for the problem:

The fix forces the system to give up 1GB of additional addressing space to the application.  This way, each application can get up to 3GB, while the OS reserves 1GB for itself.

Once you have completed teh above, find a version of Blender that is compiled with the LAA (Large Address Aware) flag. The LAA flag tells the Windows operating system that the application is aware and capable of handling the extra large address space. ‘Official’ Blender releases are now compiled with LAA.

So that’s it. With the above 2 steps, your 32bit Blender should be able to utilize slightly more memory than before.

FAQ
Q: I only have 2GB of physical RAM (or less), should I worry about LAA and /3GB or go 64bit?

A: The short answer is no. It is unlikely that you will truly hit the 1.8GB barrier, since the OS takes up some memory as well, by the time Blender is using 1.8GB of RAM, your computer is probably going very slow, due to the performance hit of using the swap file.  What you should be doing is either optimize the scene or get more physical memory.

Q: Does blender do [rendering, baking, sculpting] faster with more memory?

A: It depends, more memory helps only if you are running out of it.  If Blender is only using 200mb, adding another 4GB of memory will not speed up anything.

Q: I hate you for this lengthy and yet still confusing post!

A: I know.