Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Graf Zahl

GZDoom + GPL: Help needed

Recommended Posts

Ajapted said:

Lol, guess OpenAL was created at the time the OpenGL API was in fashion and everyone was copying it. Makes almost no sense for sound.

I believe OpenAL has added a 1/d distance model, last time I looked it was in an extension but it may have become base spec by now. And I think it's possible to, for example, set all the sounds 1 unit away from the listener and set the gain explicitly on them all, which defeats the whole point of OpenAL (positional sound for 5.1 and similar speaker setups) but would get the job done.


OpenAL is used in Doom3 so I guess it's a good choice.

Share this post


Link to post

DarkXL uses OpenAL too, unfortunately it's not yet open-sourced. (Lucius said he would open source it eventually, but not while it's still in alpha/beta status.)

The largest difficulty I had in installing OpenAL was hunting down an installer that wasn't on a 404'ed page. Creative Labs' servers are probably working now, though.

Share this post


Link to post
DoomKn1ght said:

OpenAL is used in Doom3 so I guess it's a good choice.



OpenAL is fine if you don't have specific needs. Unfortunately I can't find any means to control manually how distance attenuation is performed. None of the predefined algorithms is suitable for what I need.

The biggest problem I am having is that each single library is incomplete.

One offers decent file format support but absolutely nothing in terms of sound control.

Others have good sound control but no file format support whatsoever.

And of course most are somewhere in between.

The only one that seems to be complete is FMOD which ironically is the one that's off limits (otherwise we wouldn't have this discussion. :( )

Share this post


Link to post

What SDL's audio capacities *do* let you do, however, is pipe the output of literally anything into its audio stream with pretty much no effort.

The main issue with SDL_mixer right now is its multi-core problem, which I believe is some sort of race condition caused by an improperly checked semaphore. The SDL audio core isn't safely using the Win32 WaitForSingleObject function, and so if DirectSound kills off the buffer while the callback is still processing it, it throws an access violation.

If you could convince the SDL guys to FINALLY fix this, SDL_mixer's biggest current problem would disappear. I've already hounded them about it on the mailing list for the past couple of years and so far to my knowledge nothing has been done.

That's the main problem with SDL now. Nobody *really* works on it. Sam Lantinga is spending all of his time on the 2.0 branch, and the 1.2 branch is getting code rot. If you bring up any problems, you're just told to fix them yourself more often than not. The linux-centric attitude of some of the maintainers is not helping the quality of it on Windows either. Its ability to take advantage of DirectX has gotten steadily worse in every version since 1.2.8, to the point now where the GDI code is more stable and performs better in many circumstances. I never thought I'd be talking about preferring GDI over DirectX...

Share this post


Link to post

Here is what I'm doing for DarkXL - if it helps at all.:)

Ajapted said: And I think it's possible to, for example, set all the sounds 1 unit away from the listener and set the gain explicitly on them all, which defeats the whole point of OpenAL (positional sound for 5.1 and similar speaker setups) but would get the job done.

I've had to do this for some sound types in DarkXL. Honestly getting the attenuation right is the most annoying part of using OpenAL - I've never really been a fan of quadratic attenuation for sound or lighting. Anyway I have a sound driver wrapped around OpenAL that keeps track of active sounds and so on, so its easy enough to manually adjust the attenuation if necessary.

Apart from sound attenuation though, I've had no real problems with OpenAL - when using the software driver. When using hardware it has problems under some OS'es. The API is actually very easy to use, has no memory leaks, is fast, etc. Its pretty easy to write sound loaders as well. I use a "plugin" style system that just feeds OpenAL the PCM data. For example I have a VOC loader for Dark Forces sound effects.

For Midi (iMuse in this case), I do the parsing and iMuse processing myself and use the Windows midiStream API. The iMuse system uses a similar "plugin" like architecture, so replacing the low-level midi player with Timidi or something would be easy enough. The midi playback is threaded, so even synchronise midiplayers would work fine.

Finally I have looked at SDL and I pretty much have the same opinion as many people here - its just too bloated and wants to do too much. I like to keep my API usage low level and use them for very specific features (such as sound playback), not everything at once.

Share this post


Link to post

So, after reading some stuff about OpenAL I think I might be able to do all the processing I need.

However there's one thing that really makes me scratch my head:

What kind of moron decided that notification callbacks are a bad idea?
There's no decent way to find out if a sound has ended without constantly polling its status!
And of course streaming also becomes a headache. It all has to be done in a loop that constantly polls the sound status and queues new buffers.
Am I the only one who thinks that this is utterly shitty design for a sound library?


That said, I still could use some help implementing this. So far nobody has shown any interest. :(

Share this post


Link to post
Graf Zahl said:

I still could use some help implementing this. So far nobody has shown any interest. :(

You are surely capable of doing this yourself. You re-implemented Fragglescript all by yourself, added 3D floors and DECORATE all by yourself (afaik anyway). I hope your are not implying that you will only GPL GZDoom if somebody writes an fmod replacement for you.

The EDGE CVS snapshot of 2006_08_05 (in the Miscellaneous package) contains the OpenAL code we used (win32/i_sound.cpp, s_sound.cpp, oggplayer.cpp). That code was not written by me so I can't explain much about how it works, but at least it is something to look at.

I'm sure everyone here familiar with OpenAL will answer any questions you have as well as they can.

Share this post


Link to post

I took a look at the GZDoom source code around a week ago and I'm not exactly sure which parts belong to the fmod source and which don't, and what needs to be changed where to replace the fmod source.

What my guess was, was that you need the files with "fmod" in them replaced and all the calls to functions in the fmod files replaced with calls to functions in a similar file or files but one that is open source. Since the source code is licensed but the algorithms aren't, and all of the code is visible, I'm guessing it wouldn't be too hard to rewrite it from scratch in open source if you can figure out 100% of how it works.

But which files call to fmod functions and where in those files are those calls made?

Since I am not a very experienced programmer, trying to figure this out was like trying to find a needle in a haystack, so I didn't bothering posting before. But if even help from someone like me could be useful (and since nobody else seems to be stepping forward), then I'll try to do what I can. Can anyone else here try to help me figure this out?

Also one last thing: since OpenAL is open source, can't you just modify it to suit your needs, and add in what it lacks? Maybe it's not the best but it might be better than starting from scratch.

Share this post


Link to post
Ajapted said:

You are surely capable of doing this yourself. You re-implemented Fragglescript all by yourself, added 3D floors and DECORATE all by yourself (afaik anyway). I hope your are not implying that you will only GPL GZDoom if somebody writes an fmod replacement for you.



Unfortunately the time I have for Doom is not what it used to be thanks to a new job. The problem is not that I can't do it but that it might take too long. So far all I did was reading specifications of libraries handling a subject I never invested any time in.

Spleen said:

I took a look at the GZDoom source code around a week ago and I'm not exactly sure which parts belong to the fmod source and which don't, and what needs to be changed where to replace the fmod source.

What my guess was, was that you need the files with "fmod" in them replaced and all the calls to functions in the fmod files replaced with calls to functions in a similar file or files but one that is open source. Since the source code is licensed but the algorithms aren't, and all of the code is visible, I'm guessing it wouldn't be too hard to rewrite it from scratch in open source if you can figure out 100% of how it works.


The one file in question is fmodsound.cpp. I'm already working on moving non-FMOD related code out of it so that it can be shared between different sound libraries. None of the calls to this file need to be changed because they are all done with an abstract interface. What needs to be done is to implement this interface for OpenAL.

music_spc.cpp is also a problem but I already have the older version of it that doesn't require FMOD to work.

Share this post


Link to post

I struggled for years with ZDoom (from version 1.22) but I gave up on it two or three years ago. Randy's coding style was just not for a hobby coder. From selfmodifying assembler to templated classes, extensive makro usage, dependency on the MS compiler, man, how much I struggled to compile that thing with MinGW until Randy decided to go portable.

At least now I got MS VC Express to compile ZDoom and GZDoom without hassle, but my skills are limited to Windows and DirectSound for a sound solution.

Share this post


Link to post
Quasar said:

The main issue with SDL_mixer right now is its multi-core problem,

That, and the Native MIDI backend is broken almost everywhere except Windows.

Share this post


Link to post

Well, I learned some C++ and looked at the code again. Turns out the fmod code is actually not even in the source, and fmodsound.cpp is actually code that *uses* the real fmod code. So I'm hoping you wrote fmod.cpp yourself so I can try to change it around function by function instead of rewriting the whole thing. I mean, having the same basic algorithm where possible but replacing fmod library calls (such as the createSound() function) with OpenAL or other calls might be easier than trying to rewrite fmodsound.cpp from scratch. Of course if the algorithms for the fmodsound.cpp functions are copied too, I'll try to rewrite them also. And I do remember your mention of OpenAL and other libraries not being as flexible as FMod, I'll just try my best to work around that.

Maybe this is obvious to some people but this might help other less experienced people like me understand it if they want to help. Basically, the way I understand it is you include the fmod.h/fmod.hpp files and link the fmod libraries, thus you can call the library functions without actually seeing or compiling the fmod source. That's why I had trouble finding the createSound() function and such until I figured out that the libraries being linked to weren't actually in the source.


Looking at http://zdoom.org/wiki/Compile_ZDoom_on_Windows , and http://forum.drdteam.org/viewtopic.php?t=3528 , it seems like I need to grab the ZDoom source and a couple other things listed there as well for it to compile, then I'm guessing it will have the libraries it needs. Hopefully it will compile in MinGW, because compiling a future GPL game in a Microsoft compiler seems kind of funny.

Share this post


Link to post
Spleen said:

Hopefully it will compile in MinGW, because compiling a future GPL game in a Microsoft compiler seems kind of funny.

Why? The license that a piece of software is under has nothing to do with the compiler used to build it. Personally I use MingW/MSYS for Chocolate Doom because it gives me the same compilation platform that I get on other systems, but I'm pretty sure ZDoom uses MSVC and I doubt that's going to change soon.

Share this post


Link to post
fraggle said:

Why? The license that a piece of software is under has nothing to do with the compiler used to build it. Personally I use MingW/MSYS for Chocolate Doom because it gives me the same compilation platform that I get on other systems, but I'm pretty sure ZDoom uses MSVC and I doubt that's going to change soon.


Well, not necessarily. Sometimes Microsoft's compilers (such as the DreamScape version) have a non-commercial use clause, which will contradict the GPL, I think (since commercial use is specifically allowed in the GPL). I'm really not sure what kind of restrictions the regular editions have.

But if you're right and they're compatible, Microsoft always reserves the right to stop releasing new versions with which one can make GPLed software.

However, at least it probably won't stop releasing free-of-charge versions of its compilers as Express editions any time soon because they're Microsoft's way of competing with the Open Source movement. Thankfully both the 2005 and the 2008 versions are free now. If people have to pay money to tinker around with the source, again it might limit some of the younger people of the DOOM community, as well others who aren't sure whether they want to pay.


Legally you might be right that it makes no difference, but from the point of view of the Open Source movement it might seem like a strange move to Open Source a piece of software made for a Windows compiler, in my opinion.


But it's still a great thing to release the source under the GPL either way, and I shouldn't be criticizing people who wrote so much code for this while I'm still only trying to get started on working on this thing. If anything I'll just try and make it work under MinGW myself.

Share this post


Link to post

GCC has no own IDE (it even has no proper all-in-one installer) and is not able to be integrated into MSVC environment in one click like Intel Compiler does. CodeBlock IDE sucks. Programming without debugging sucks also. It hard to find a Windows guy who will wish to use stone age methods like command line compiling.

Share this post


Link to post

I am one person to respect licenses, but as for stallman and his fosstard followers, throwing crap at MS just because they are a "monopoly" and hold a large market share. I have no respect for them.

Anyways, I doubt the vc++ express compiler will affect any non-commercial projects legally. Hell I even use it to compile and test Odamex with. It also has turned out to be a far better compiler than gcc in the sense of finding extremely bad code (ie: its very sensitive, your program will crash if you do something bad, gcc sometimes covers these bad ways up)

You do have to register it (the IDE) after a certain amount of time, but I just use codeblocks with the compiler instead. It doesn't come with a debugger, but you can get the Debugging Tools for Windows package from the microsoft website.

Share this post


Link to post

Did you try Intel Compiler? By default it generates too many warnings. MSVC has "disable" state with settings "by default" for most of them. MSVC even does not generate warning if you try to use uninitialised variable.

In PrBoom-Plus I have

/* Shut up warnings */
#ifdef __INTEL_COMPILER
  #pragma warning(disable : 94 144 175 177 186 188 279 556 589 810)
#endif // __INTEL_COMPILER
for Intel Compilre

and
#ifdef ALL_WARNINGS
  #pragma warning(error : 4701) // local variable *may* be used without init
  #pragma warning(error : 4189) // initialized but unused variable
#endif // ALL_WARNINGS
for MSVC

Share this post


Link to post

I haven't used the intel compiler, but I have heard good things about it.

Its true that they do have issues with generating way to many warnings, just switch on /Wall in msvc and you'll be drowning in them!

Share this post


Link to post
RTC_Marine said:

I haven't used the intel compiler, but I have heard good things about it.

Yeah, it creates ~15% faster executable for prboom+ without any processor specific optimizations, just plain -O3 or something

Share this post


Link to post

Of course I use VC++. As an overall package it's just a far better deal than GCC.

Although I own a VC++ 2008 standard edition I still use 2005 Express to compile ZDoom to stay compatible with the official development platform.

Regarding the license, the Express editions are free for commercial and non-commercial use so there's no problem with that.

ZDoom can be compiled with MinGW though but why should I subject myself to such torture when it isn't necessary?

Share this post


Link to post
entryway said:

GCC has no own IDE (it even has no proper all-in-one installer) and is not able to be integrated into MSVC environment in one click like Intel Compiler does. CodeBlock IDE sucks. Programming without debugging sucks also. It hard to find a Windows guy who will wish to use stone age methods like command line compiling.

You just summed up my own feelings about the GNU toolchain perfectly. I want to spend my time programming writing programs, not writing programs to compile my programs. autoconf and make are based on scripts, and I find I generally do not have the patience to deal with their ancient, cranky, and sometimes downright bizarre 1970's UNIX paradigms.

It's about time that free software programming moved beyond that state of affairs IMNSHO.

Share this post


Link to post
Quasar said:

It's about time that free software programming moved beyond that state of affairs IMNSHO.


I couldn't agree more. This is one of the reasons why I never bothered with Linux so far. I don't want to deal with such obsolete shit (and in this context one should not forget that abomination of an editor called 'vi'. I always find it amazing how some people hit 10 keys to write 5 characters. :P)

Share this post


Link to post

fraggle said:
Why? The license that a piece of software is under has nothing to do with the compiler used to build it.

Wouldn't you need Windows, or something that emulates it properly, to run the compiler? Assuming it is required, which would be the issue. That sounds like a reason to try to avoid such a situation.

Granted, coding something like the Doom engine is generally much less serious that some stuff on which the management and control of information may depend, so I can imagine you guys caring less about these problems than people coding free operating systems or more general programming tool sets. DOOM itself, to which the source is heavily related, isn't something free.

I mean, you have RTC_Marine abruptly bitching at Stallman and FOSS proponents not necessarily because he knows better about dealing legally with a huge and powerful pro-proprietary corporation prone to lobbying or globally with the free software movement as a whole, but because he's an individual Doom engine coder in this rather eclectic and accessory environment, or a similar one.

Share this post


Link to post
Graf Zahl said:

I couldn't agree more. This is one of the reasons why I never bothered with Linux so far. I don't want to deal with such obsolete shit (and in this context one should not forget that abomination of an editor called 'vi'. I always find it amazing how some people hit 10 keys to write 5 characters. :P)

It's probably difficult to understand if you aren't already a vi/vim user. Although it is true that to insert a single character, for example, takes three keypresses, if you learn how to use all of the commands, it actually makes editing more efficient.

I know quite a lot of people (friends, colleagues, etc) who use vim like it's notepad: they only learn the very basics (like "i" to insert text). That is insanity, because when you use it like that, it is just wasting time. I don't dispute it for a minute. It's incredibly frustrating to watch someone using insert mode to delete text. But if, like me, you actually learn all of the commands that it gives you and incorporate using them into your normal habits, it is hugely more efficient.

For example, "swap two lines of text" is three keypresses (ddp), "replace five words at the cursor" is also three (5cw), while you can repeat the last action you just did with a single keypress (.). You can record your actions with macros and then play them back again to automate tasks. You can select a block of text and pipe it out to an external process to apply a transform to it. These are just some basic examples.

What it comes down to in the end is, as a programmer, text is the raw medium that I work with. Editing text is the main activity involved in programming. You can joke about "tools from the stone age", but the fact is that it allows me to cut up, slice and dice text files more efficiently than any IDE. I'm a more efficient programmer as a result.

I highly recommend reading a book called The Pragmatic Programmer. While having lots of sane advice about programming in general, it has a chapter dedicated to the subject of editors. Quote: "The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable". It doesn't have to be vim (there are several other editors just as powerful), but learning a "power editor" is an incredibly useful skill to have.

Share this post


Link to post
fraggle said:

It's probably difficult to understand if you aren't already a vi/vim user. Although it is true that to insert a single character, for example, takes three keypresses, if you learn how to use all of the commands, it actually makes editing more efficient.

I know quite a lot of people (friends, colleagues, etc) who use vim like it's notepad: they only learn the very basics (like "i" to insert text). That is insanity, because when you use it like that, it is just wasting time. I don't dispute it for a minute. It's incredibly frustrating to watch someone using insert mode to delete text. But if, like me, you actually learn all of the commands that it gives you and incorporate using them into your normal habits, it is hugely more efficient.

For example, "swap two lines of text" is three keypresses (ddp), "replace five words at the cursor" is also three (5cw), while you can repeat the last action you just did with a single keypress (.). You can record your actions with macros and then play them back again to automate tasks. You can select a block of text and pipe it out to an external process to apply a transform to it. These are just some basic examples.

What it comes down to in the end is, as a programmer, text is the raw medium that I work with. Editing text is the main activity involved in programming. You can joke about "tools from the stone age", but the fact is that it allows me to cut up, slice and dice text files more efficiently than any IDE. I'm a more efficient programmer as a result.


It's a matter of preference.

I use emacs when I'm using Linux or Unix and it isn't too bad.

On Windows I use Textpad, because Notepad is crap.

My personal belief is that a combination of GUI and command line is the best because it gives the power of both. Also, I don't like massive GUIs like Eclipse because they tend to be slow at times. Pure command line interfaces don't slow down nearly as much, but when they do something you sometimes have to wait for it to finish completely. A combination of GUI and command line allows you to have several command lines each having its own thread/process open, and thus solves this problem. For example when on Unix I would have emacs open in one XTerm and the command line for compiling open in a second XTerm, and sometimes another command line for running/testing in a third. A completely pure command line interface is just a command line where you can only edit, compile, or run, but not all 3 at the same time.

So anyways I'm allowed to try and slowly replace the code in fmodsound.cpp with OpenAL code instead of replacing it all at once, right Graf? Since only the part that relies on FMod directly is unoriginal .. Just wanted to verify this...

Oh yeah and I found this: http://kcat.strangesoft.net/openal.html
Which is probably what I'm going to use. I can't figure out how to use SVN to download the regular OpenAL for the life of me.

But darn I might be way in over my head. I'm beginning to truly realize how big of a project this can turn out to be, it might take me months to figure out how everything works. If anyone more experienced here wants to do this don't feel held back by the fact that I'm already attempting this. Because you'll be done by the time I figure out *how* to do it.

Share this post


Link to post
fraggle said:

What it comes down to in the end is, as a programmer, text is the raw medium that I work with. Editing text is the main activity involved in programming. You can joke about "tools from the stone age", but the fact is that it allows me to cut up, slice and dice text files more efficiently than any IDE. I'm a more efficient programmer as a result.

Whilst I agree in principal I'm more than happy to give up a bit of text entry gymnastics in return for an integrated, interactive debugging tool chain and high-level refactor operations. In my book, they are far more valuable to me during general day-to-day development.

Share this post


Link to post
fraggle said:

I highly recommend reading a book called The Pragmatic Programmer. While having lots of sane advice about programming in general, it has a chapter dedicated to the subject of editors. Quote: "The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable". It doesn't have to be vim (there are several other editors just as powerful), but learning a "power editor" is an incredibly useful skill to have.



I still think it's insane. I had my first encounter with this abomination 19 years ago and never managed to use it.

Your quote got one thing right: It's not the only 'powerful' editor. But it's the only one that is unusable for normal people.

That said, I think the best type of editor is the one that exposes its features without the user having to learn inane key combinations.

Some less frequently used features are better placed on the toolbar or in a menu.

Share this post


Link to post

I use Cream as my text editor, which is basically a "mod" for VIM that makes it behave like a program from the 21st century (more or less). It still lets you enter "VIM mode" so you can use all those scary functions (although the only thing I really use is the regex tool).

The regex tool is absolutely invaluable, though. Need to write a bunch of repetitive boilerplate code? Turn a CSV file into XML? Regex to the rescue!

Of course, if I actually bothered to learn the VS regex syntax I probably would never use this thing:)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×