Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 16 Jan 2010
Offline Last Active Jun 06 2015 01:13 PM

Topics I've Started

Perfect Directory Structure for Game + Tools

01 August 2013 - 04:20 PM

Hello Guys,
I am an experienced C++ programmer and have been using several project structures, like simple src and obj folders and using the command line, default structures provided by IDEs such as the Code::Blocks, etc. With my experience the complexity of my projects grow and again I am thinking of an efficient directory structure for my projects... of course I have already searched the internet, but I didn't find any examples perfectly fitting my needs... so I think, I show you my beta structure to gather opinions, modification and improvment suggestions.

My structure is of course meant to be used for developing platform independent games (mostly basing on SDL, SFML etc.). In addition, most of my projects would also need tools (either command lines, or GUI using Qt) for level editing, file converting etc. Here is my current structure (EDITED):
    └ [the executable file (Windows, Linux, ...) including DLLs (Windows)]
    └ [project-title]/
      └ [all program data, like graphics, level files, etc.]
    └ [program or tool name]/ [for project specific libraries: lib*]
      └ forms/
        │ └ *.ui [QtDesigner files => ../../../build/[program-name]/ui/ui_*.h]
        ├ *.cpp [=> ../../build/[program-name]/deps/[debug/release]/*.d; ../../build/[program-name]/obj/[debug/release]/*.o]
        ├ *.h
        └ *.rc [Windows Resource script for version information => ../../build/[program-name]/obj/[debug/release]/*.o]
    └ lib*.a, lib*-d.a [second one for debugging]
    include/ [project specific libraries' includes]
    └ [library name]/
      └ *.h
    resource/ [Icons, ... for the tools; for the generation of the .rcc file]
    ├ appicon/ [application icon, e.g. for the desktop or window icon]
    │ └ *.png, *.ico [second one for Windows Resource file]
    ├ icons/ [UI icons, e.g. "open" or "paste" icon]
    └ *.qrc [an XML file listing all files for the .rcc output file => ../share/[project-title]/tools/*.rcc]
    doc/ [source documentation generated by doxygen]
    └ [program or tool name]/
      ├ obj/
      │ └ [debug / release]/
      │   └ *.o
      ├ deps/ [might have debug and release subdirs as well]
      │ └ *.d [Dependencies of the .cpp files from the .h files; for Makefile]
      ├ ui/
      │ └ ui_*.h [translated .ui files for including in the source code]
      └ moc/
        └ [debug/release]/
          └ moc_*.cpp [Qt MetaObject files => ../../obj/[debug/release]/moc_*.o]
    dist/ [distributable files]
    ├ source/
    ├ windows/
    │ ├ inno-installer/ [or nsis-installer, etc.]
    │ │ ├ [installer script, not distributed]
    │ │ └ [generated .exe file for distribution]
    │ └ [portable archive file]
    └ linux/

 - the windres tool (MinGW) can generate a .o file from a .rc file
 - the debug executable might have a suffix, such as -d or -debug (tool-name-debug.exe)
The end user shall receive the bin and share folders.
Maybe the structure is more than good enough and some of you might find it useful for himself.
I ask for feedback smile.png

OpenAL Streaming (Queue Buffers)

14 August 2010 - 09:42 AM

I have written some code that plays an ogg vorbis file with OpenAL.
My code opens the ogg-file and reads from it whenever a buffer is to be filled.

As a "simple" loop would cost me 100% CPU, I have to sleep a little bit somewhere.
So I set up 4 buffers which will be queued and played one after the other.
After one processed buffer is filled again and queued on the source, I sleep as long as 1 buffer should need to be played. That is (float)PCM_PER_BUFFER/44100*1000 ms.

But it can still happen that the stream stops playing (e.g. when computer is busy I think), which means that all 4 queued buffers were played before new buffers are filled and queued.
But how can that be? I can't imagine that some of my code in the thread takes as long as 3 or 4 buffers.

Does anybody has a tip how I might solve that problem? Is it possible to use callbacks that OpenAL automatically calls as a buffer on a source was processed?

My code looks about like that (pseudo-code):
n = getProcessedBuffers(); // should be 0, 1 or maybe 2. Never 3 or 4...
while(n--) // while there are processed buffers to fill
// unqueue processed buffer
alSourceUnqueueBuffers(Source, 1, &b);

cur = getCurrentBuffer(); // buffer num (0-3) to fill
alSourceQueueBuffers(Source, 1, &(Buffer[cur]));

My Song - Your Opinion

20 January 2010 - 01:13 AM

I'm usually just a programmer, but I also try to make some music sometimes. The day before yesterday I've composed a song I find really cool, and I'd like to know your opinion about it. When composing it, I was thinking of using it for the credits, later for the title screen of a game. Actually the song doesn't really have a name yet, but I just called it "Everybody Travels Through Time", without any further meanings ^^. You can download the song here: Everybody Travels Through Time.mp3 Everybody Travels Through Time.ogg (Genre: Techno/Instrumental, Length: 3:45) Please tell me your opinion to this song. You can also give me some tips for the song :).