Saturday, November 29, 2008

ODE auto-disable and a Windows build

I got two things working today: ODE's auto-disable feature and a Windows build.

Auto-disable is great for performance when there are lots of objects just laying around doing nothing. Stacked objects tend to stay enabled just because they're wiggling slightly (worsened by my coarse 10 ms steps), but a once orderly stack strewn across the ground will usually be completely disabled within seconds.

The Windows build was the really hard part. I have Windows XP running in a VirtualBox VM (my host OS is Ubuntu). Installing MinGW and MSYS was easy enough, but I had to manually download and compile eleven source packages (including an updated GNU make) to get my code to compile and link. It doesn't help that the GL libraries have different names (opengl32 and glu32 vs. gl and glu), and that you need different complier switches to make everything happy. In the end, I got freetype, GLEW, libjpeg, libpng, ODE, SDL, SDL_image, SDL_ttf, libtiff, and zlib to configure, build, and install! The result is a monstrous 9.4 MB statically linked executable that should only depend on opengl32.dll, glu32.dll, and a few windows DLLs for the underlying SDL implementation.

Saturday, November 22, 2008

Tool chooser

I added a simple tool chooser to the HUD. When the HUD is instantiated it asks the ToolFactory for all of the tools' names and generates some textures. Moving the mouse wheel pops up the text menu and clicking selects a tool. It's not shiny yet, but it works well enough for now.




This is a stack of 100 crates. I am not deactivating motionless objects (yet), so they are all fully active and generating lots of contacts each step. The CPU usage was about 90% when I took the first shot below. I switched to the Move tool and ripped out one of the bottom ones, and they scattered beautifully with no slowdown. The Open Dynamics Engine is pretty nice.

Thursday, November 20, 2008

Tools updated

I had some time today (not really, but I pretended that I did), so I rewrote the tool system the way it should have been done. Gone are arrays of function of pointers, replaced with a Tool class which is the base of the classes TableTool, DeleteTool, and MoveTool. The Table and Delete tools are like the old ones, but the Move tool is new and interesting. It's basically a clone of gmod's physics gun's primary fire. Click and drag to move objects. It is currently possible to use the arrow keys to spin it in the air, but I'm going to make this mouse controlled at some point.

I made another model because I was getting bored with just the tables. At the moment the two objects' collision models and mass distributions are hard coded. One of my next goals is to come up with a simple text format for those two and load them in from files (it's already doing this for the display models). I also need to get trimesh collision models working.

Here's a colorful picture:

Friday, November 14, 2008

Enumeration!

Thanks to this website I got Windows to accept the driver INF. After implementing two more USB standard device requests I can do this:



\o/

Thursday, November 13, 2008

Success! The configuration descriptor was malformed.



Now I just have to figure out what "The required section was not found in the INF." means. It's basically a copy-paste from Microsoft WinUSB documentation so I don't know what's going on.

Windows seems to read the string descriptors three times while enumerating the device, with longish pauses between. It doesn't complain about it to the user, but the device is identified as "USB Device" before the Found New Hardware wizard pops up. I think the string descriptors could be all wrong but Windows doesn't think it's important enough to abort.

USB

(posted from work)

I'm playing around with an Altera DE2 board which has an ISP1362 USB controller chip. The idea here is to get Windows to accept the board as a real USB device so I can transfer lots of data into and out of the FPGA accelerated encryption engine. The results so far are negative but entertaining:

Sunday, November 2, 2008

Table gun

Based on recent [lack of] progress I've put the floatsinspace project on hold for a while. It's tricky to deal with multiple physics spaces when I still haven't written the basics, so I made a new project folder (called "mod" for +1 Creativity) and started over. The goal with this one is to get an entity system, player movement and interaction, and Wire kind of stuff working. If it goes really well I will use it as a base for some tests with networked play and we will kill Garry's Mod and probably rule the world (waaay out there though).

I put in some basic player movement a few weeks ago. The player is represented by a capsule object (a cylinder with hemispheres on the ends) and is moved by applying equal and opposite forces to the "ground" (whatever is below the player) and the player itself. It works, but I got bored with walking around and jumping so I thought a weapon/tool system would be a good next addition.

The code for the tool system is a complete mess (polymorphism by arrays of void* and lots of reinterpret_cast) but it will work until I rewrite it as an object hierarchy. The first set of test tools I created were a table making tool and a deleter. The table maker spawns tables (roughly like the one my monitor sits on) wherever you are looking. The deleter deletes stuff.

Here's a picture of the table maker in action (BAMF! Look at that table!):


The underlying system is about as simple as it can be right now. I'm using the Open Dynamics Engine as both a physics engine and collision system. The world state is stepped at 100 Hz and the renderer goes as quickly as it can without exceeding 60 FPS or the speed of the simulation. Performance seems to be okay even with lots of tables in weird positions.

This was going at 60 FPS (good sign that performance won't suck too much):


The two problems I'm seeing right now are some interobject penetration and some stacking instability. Dropping a table on another at a right angle results in the falling table shoving through the stationary one and they end up stacked in the wrong order. The table top is only 2 cm thick so this will probably be less of a problem for collisions between big things, but it means I may have to up the physics step rate. Uniform stacks of a few tables are no problem but they wobble if you stand perfectly still on them. Again, this might be helped by increasing the physics step rate but there are definite limits to doing that. I was originally testing with a 1 kHz step rate which looked good until I realized how slow it got with more than ten objects in existence.

Old blog

This is my second blag thing. I have an old account on LiveJournal (http://mvanbem.livejournal.com/), but it's kind of annoying to use so this will be the one I update. If you're bored you can come here to read about what I've been programming while bored.


Hey, uploading images is easy. LiveJournal doesn't look like it lets you do that without a paid account. (looks like animated GIFs don't work, though)