• Content count

  • Joined

  • Last visited

Community Reputation

187 Neutral

About coyote-development

  • Rank

Personal Information

  1. I generally see two ways, I'd reommend you. Either, you use tools like Unity or Game Maker, which - as far, as I know - support mobile devices and allow you quick game development, or you choose the same way like I used and start developing PC applications first. I have never really done Java, I rather started with C++, so I wanna suggest you my personal way how I got into game development: Write some basic "command line" application in C/C++ with stuff like printf or using std::cout to understand how to work with the language itself. There are possible ways for Java as well, but I have never really worked with it. Decide yourself whether you wanna continue with Java (on the computer) or try C++. If you got some basics working with C++, the next step would be to create a "real" window on the computer, draw something there and react on user input. I recommend you the SFML library, as it is really easy to use. You find good tutorials on the homepage about all these next steps. If you kind of understand how everything worked so far, you should learn about the general specifics of the mobile platforms - such as Android apps are usually coded in Java and iOS apps, I think, in Objective-C. At least for Android I know you can use C++ code (more complicated then pure Java for Android) using only a bit of Java as "glue code". If you like Lua, you could first try to use Lua on a PC app, embedded in a small C/C++ application. Lua is really easy to embed in a C application, and I think, there are good binding for Java (Android) and Objective-C (iOS) available. That way, you could write just the basics (such as draw something on the screen) in C/C++, Java AND Objective-C and make these functions available to the embedded lua scripts and then write most of your game in Lua; you could use frameworks like Corona too, which already did all that for you, I guess. If you really want to start with mobile development (and not trying some stuff on the computer itself), I'd recommend you to use Unity etc. as mentioned first or at least use some an IDE like Eclipse and focus on one platform first (e.g. Java Android).
  2. Perfect Directory Structure for Game + Tools

    I haven't split up the headers and sources...? I've edited the directory structure. All program and tool sources come into the same src-directory (with subdirectory). The src-directory might also have lib*-subdirs, which include the source files of project specific libraries. Such a library might be used for reading and writing custom file formats (e.g. level files), which might be used by both the final game and the level editor (a tool). In addition the tree now have a certain place where to put the distributable files (in general copies of the bin and share folders, packed in archives, installers, etc.).
  3. 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):       bin/     ? [the executable file (Windows, Linux, ...) including DLLs (Windows)]     share/     ? [project-title]/       ? [all program data, like graphics, level files, etc.]     src/ ? [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/ ? 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]     build/     ? [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] tags/ dist/ [distributable files] ? source/ ? windows/ ? ? inno-installer/ [or nsis-installer, etc.] ? ? ? [installer script, not distributed] ? ? ? [generated .exe file for distribution] ? ? [portable archive file] ? linux/ Notes: - 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
  4. SDL vs. SFML

    I also want to add some points to the both libraries, as I'm also not always sure which one I should take: [b]SDL (1.2)[/b] + direct draw on surfaces: might be useful in special cases, such as emulators, dynamic images or regularly rendered maps + 8-bit sprites: very useful if you want to code retro-like games (such as a Super Mario fan game), as you can play with different palettes ? I'm not sure, but I think there are some problems on Windows switching to fullscreen or back during game play - it has got it's own cursor for the window, what some people might not really like [b]SFML[/b] + native PNG and other image files support without any add-ons + native Ogg and other audio files support without any add-ons + native network support without any add-ons; simple intereface for HTTP + native TTF and other font files support for text drawing without any add-ons + multiple windows + fast sprite transforming (scaling, rotating etc.) without any add-ons - might not work on every hardware where SDL does: for me it didn't work with Linux on one of my PCs - no 8-bit sprites for playing with palette switches
  5. OpenAL Streaming (Queue Buffers)

    Okay, I changed sleep time from 92ms to 20ms, and I don't notice any more CPU usage (program uses 0-3% CPU). I listened to a stream for many minutes and there seemed to be no interrupt. Maybe that's really the solution now :)
  6. OpenAL Streaming (Queue Buffers)

    Quote:Original post by KulSeran Quote: What might be the problem? Could it be that the program "miss" the time to update the stream and the source stops? Seems you didn't read what I said about sleep. If you say "sleep(92)" the program won't return for ATLEAST 92ms. It doesn't mean it will return after exactly 92ms or before 92ms. It will only return sometime after 92ms have passed. There is a really good chance that you are going to miss your window (windows is granular on sleeps with about 15ms of jitter). You need to sleep for less time, and poll OpenAL to see if the buffers are ready to be filled (looks like "number of processed buffers can be detected using an alSourcei call to retrieve AL_BUFFERS_PROCESSED"). The calculation of buffer duration results (~)92 ms. That means, with all the lost time for other code in the thread and somewhere else it should be VERY propably that 1 of 4 buffers is processed. That means after sleeping there should be a buffer to fill. Even if I haven't slept enough and there's no buffer to fill, after 92 more ms there must be 1 or even 2 (of 4) buffers to fill, but (usually) never 3 or 4. (I have a "semi-solution": If the source stopped for some reason I just resume it. Still I might get a short moment in the stream where just nothing is to be heard.) Quote:Original post by KulSeran There is a really good chance that you are going to miss your window (windows is granular on sleeps with about 15ms of jitter). What do you mean by that? What does a thread in the background have to do with a window? Quote:Original post by KulSeran You need to sleep for less time, ... But if I sleep less then 92ms (the duration of a single buffer) it is more propably that one buffer is processed yet and I waste CPU.
  7. OpenAL Streaming (Queue Buffers)

    It happened again. I listened to a (looping) song for some minutes and it suddenly stopped again. Buffer size is 16384 bytes, and there are 4 buffers. The calculated sleep time is 92 ms and the song is played at 44.1 kHz. But the program itself does nothing which might "stop" the song. The main program code just waits for user input (cin.get()) while the thread is updating the processed buffers and sleeping 92ms after all buffers filled and queued. What might be the problem? Could it be that the program "miss" the time to update the stream and the source stops? Is it maybe possible to tell the source to loop the last buffer or something until there are new buffers queued?
  8. OpenAL Streaming (Queue Buffers)

    Quote:Original post by TTK-Bandit why do you get the buffer with getCurrentbuffer, etc ? alSourceUnqueueBuffers writes the buffer that is unqueued into b, which you can use then: *** Source Snippet Removed *** Okay, I didn't know about the third param on alSourceUnqueueBuffers(). Quote:out of curiousity, how big is your buffer ? I use 4 buffers, each has 16384 bytes, and my audio thread sleeps 20 ms + some work in between, and I have no problems. Well, I first tried with 2 buffers sized 1024 bytes each (note that 1 sample might need 4 bytes: Stereo+16Bit), and now I was hoping it works all right with 4 buffers sized 4096 bytes each (1024*4). As you are saying using 4 buffers sized 16384 bytes each, I should try it. I was just thinking that it is not usual using 4, and not 2 buffers, or at least not sizing them more than 4096 bytes. If there is still any problem, I will tell.
  9. OpenAL Streaming (Queue Buffers)

    Quote:Original post by KulSeran sleep causes your thread to go to sleep for AT LEAST (x) time. It will not return before that time, but can return any time later (there is nothing that says it is reasonable either, it could be seconds or minutes later depending on what else is running). You'd probably be better off with condition variables or locks or something. That way you have some control over when the thread will wake up. If I don't use sleep the thread would use 100% CPU. I can't lock something from somewere out of the thread as I am working on something else outside that thread. Using for example a condition variable wouldn't solve it, if I understand what you mean: while(playing) { if(buffersToFill) // <-- the "condition" variable { // fill buffer... } // else loop will loop and causes 100% CPU in any case }
  10. OpenAL Streaming (Queue Buffers)

    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): while(playing) { 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 fillBuffer(Buffer[cur]); alSourceQueueBuffers(Source, 1, &(Buffer[cur])); } sleep(sleepTime); }
  11. My Song - Your Opinion

    Okay, thanks for your post :).
  12. My Song - Your Opinion

    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 :).