Skip to main content
GameDev.net gamedev.net
🔒 Locked

memory shared between programs

Started by spliter Apr 23, 2009 at 11:36 AM 4 replies 1.1k views
Original Post
spliter
spliter
Hello! [boringPart] Currently I'm developing a set of small applications for my first advanced game. On my search about tool development I came across a developer video that showcases the tools used in Love, an indie game. One thing that struck me was the use of a program that allowed to share certain resources between applications and so you can see the newest changes in real time. Of course it interested me right away, and so I decided to implement such feature between the model editor and the game itself. So I can easily see the changes done in real time inside my game, and not having to export the models first. However there's one problem: I have literally no Idea on how to create that. Initially I was thinking of multithreading, but the problem is that I want separate applications to share resources, and not one application with several threads. [\boringPart] So here's the question: How can I create a program that will allow me to share the same resources over two separate applications? So far I use c++ with SDL. I'm trying to make my programs to be as platform independent as possible, or at least run on both windows and linux. Thank you in advance: Spliter
Toolmaker
Toolmaker
I have no idea how to implement this under Linux, but under Windows, there is Shared memory between processes.

I'm not sure on how to fully implement the changes in real time, because you obviously need to push the new data to your GPU in some way, but it should be do-able.

I've considered using a same technique before which pre-loads all my application data in a seperate application, and after re-compiling my game, it would use the shared memory for it's game data instead of using loading it itself each time. Never got around to implement it tho.

Toolmaker
 
Sneftel
Sneftel
The most straightforward way would be for the editor to save its data to disk, then signal the game to load it from disk using a socket. Sharing memory directly would be a recipe for headache.
haegarr
haegarr
If one has no fear for headache: Memory mapped files can be used (the method mentioned by Toolmaker) under windows as well as under linux and other unixes. Sites dealing with multi-threaded problem solutions probably have descriptions of how to use mmapping.
Dancin_Fool
Dancin_Fool
I think you'd be better off going with some kind of hot swapping technique. Either with one program scanning for updates to a file every n number of frames. Or have the other modelling tool signal the other program via a socket or pipe. I think the actual sharing of memory would just result in a giant unneeded headache.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.