Excitement/frustration of building a game sound engine in Max/MSP

eleven_t's icon

Hey,

I am currently developing an audio engine for a future video game/interactive music system from scratch and while Max/MSP feels like a great tool to prototype, I am not sure whether I have enough knowledge or its Max/MSP approach that might be limiting when scaling the engine for the proper public release. I would love to hear from someone with experience in video game sound to advice me so if you are reading this, don't hesitate to drop a quick response.

My friend is developing the graphics side with Ogre3d and it'll communicate with my sound engine via tcp/udp. In the future, when we are ready to go out of prototyping, I am planning to rewrite the sound engine using a library, such as libpd, and fully embed it within the game. At this very moment I am just trying to get my head around how I want my sound engine to act therefore Max/MSP seems like a great sandbox environment.

Through my research I got obsessed with procedural audio and started experimenting with dynamic and modular programming in Max/MSP. I sort of found a way how to use object oriented logic in my patches using OO externals which made me super excited. New features of Max such as Dict and Jitter physics introduced a new perspective on how to do some things very easily. I love them. However, I am rewriting the engine for the third time now as I am constantly learning but I am not sure if the direction I am going is good or just plain stupid.

The issues that I face right now are to do with memory management in Max. As I am using poly~ objects to do my dynamic loading/unloading of patches and Dict's to keep track of those objects, memory just keeps increasing and I can't pinpoint those leaks. I am not using sprintf's to generate symbols - I am using [tosymbol @separator ] objects to avoid filling up the memory. Well, it seems that my extreme use of linked dicts and calls to them causes those leaks, but I can't figure out what happens with dicts generated by jit.phys.world collisions: do they get deleted when world updates or do they stay in memory. I have many more questions but I suppose the best way to start talking about this is first to look at my patches. My project is hosted here:

and here's a quick demo video:

I need your voices :]

jamesson's icon

I seriously doubt that tcp/ip is the way to go for game audio. This situation is already under discussion here;

My suggestion is that somebody who owns latest Max (which I dont yet) should get in touch with cycling74 and report back.

Many thanks in advance

Joe

eleven_t's icon

Well, tcp or udp is used only for our in-house protype. When we have some sort of working prototype then it'll be time to embed the code within the main engine. Anyways, comm between sound engine and graphics is not an issue right now, what I need to understand is how to smooth out memory issues and further strip the code off unnecessary methodologies (those which me, as non-programmer doesn't even know of)...

Would be amazing if someone from Cycling74 chimed in ;]

btw - can't wait for the bug fix of collision reporting crashing Max when phys.body has children...

jamesson's icon

That, I might have some useful comments about.

Post your patches so far and I'll see if I have useful suggestions.

eleven_t's icon

@jamesson, if you are interested download the source via github link above, you might need to add few externals though (listed in readme.txt). Let me know if you run it at all ;]

jamesson's icon

gimme a couple days, I wanna finish my thing.

Rob Ramirez's icon

hi eleven_t

phys.world collision dicts are created and deleted each frame.

the phys.body @shape compound bug has been fixed and will be available in the next update.