Initial AGS Engine Source Code release

Started by Pumaman, Wed 27/04/2011 01:55:57

Previous topic - Next topic

Pumaman

Now that 3.2.1 has been released, AGS seems to be in a stable enough state to release the source code.

So, to that end I've added it to the SVN repository here:
https://svn.adventuregamestudio.co.uk:7743/svn/ags/trunk
you will need the Common, NativeLibs and Engine folders within this.

I know there's been a lot of interest in this, so if you're a C++ programmer then the code is now available for your perusal. It's released under the Artistic License 2.0, as with the editor code.

You will need Visual C++ Express 2008 (this is a free download from MS). Do NOT use the 2010 version, this will probably not work and let's not complicate things at this stage by trying to use it.

In the VC++ Options, you'll need to add the /Common and /Common/libinclude folders to the VC++ Include Directories list.

You will also need to install the DirectX SDK from Microsoft if you don't already have it.

DO NOT use this source code as a learning resource or a guide on best practice.
The state of the source code is VERY BAD and should in fact be considered an example of BAD PRACTICE.
Unlike the AGS Editor code which is relatively modern and a generally good standard, the engine code dates back 12 years to 1999, and has a severe case of the another-bit-being-bolted-onto-the-side disease. It also retains compatibility with old versions which means that some of the old and particularly dire code paths cannot yet be removed.
So just to be clear, YES I KNOW that the code is in a bad state. You don't need to tell me that.
I also know that AGS is used by thousands of games with thousands of combinations of game settings and script functions, and that any attempt to refactor the code into a better state is likely to inadvertently break something in someone's game, which is why I haven't attempted to do it yet.

The first important question is, does it compile for you? I'm not 100% sure that I've uploaded everything it needs into SVN, so let me know.

If you're thinking about making a change to the engine, make sure you always consider:
* How does the change affect existing games? Will it break any backwards compatibility?
* Does the change work with all colour modes (8-bit, 16-bit, 32-bit)?
* Does it work with both "low-res" (320x200/320x240) and "hi-res" (640x400 upwards) co-ordinate systems?
* Does it work with both the DirectDraw and Direct3D graphics drivers?
* Is it cross-platform (ie. is there anything platform-specific that would break the Mac and Linux ports?)

If you're thinking about adding third-party libraries, remember that AGS must not use GPL libraries as the GPL license is too strict. Libraries licensed under the Lesser GPL (LGPL) are ok, however.
Always carefully read the license of any third-party libraries before proposing to use them in AGS.

Kweepa

It's asking for a username and password to access the subversion repositories.
But this is an awesome development! :=
Still waiting for Purity of the Surf II

monkey0506

#2
Unless he's changed it, you should gain access with username "guest" and no password.

Oh, also: Sweet! Time to hone up on my C++ skillz.

Calin Leafshade

Would someone mind zipping it up and posting it somewhere for me?

My proxy server at work is mangling the svn http requests in transit.

Thanks gorgeouses.

Sephiroth

Just awesome! Thank you very much for sharing  :o

A quick link for Calin if you still need it.

LINK

abstauber

just amazing... who would have imagined that back in 99 :D

Too bad I won't be able to contribute to the code, but I'll do my best to work on a modern hi-res template.

Sslaxx

#6
Thanks for this, Chris!

Very initial thought: the headers on some of the files need to be altered to reflect the change of licensing.
Stuart "Sslaxx" Moore.

subspark

Hey great work, Chris! A million thanks for doing this.  :-*
Well this should be an interesting decade! :=

Cheers!

Wyz

The state of the code doesn't look that bad to me, I've seen worse. :)
I'm an experienced C/C++ programmer and as soon have time on my hand I'll dive right in. First stop: finding out how portable it is, I first might try to compile it with other compilers and see how much breaks. I know the plug-ins will break, but that will be the first step toward cross-platform compatibility.
Thanks for releasing it, and thanks for creating it in the first place. Much appreciated!
Life is like an adventure without the pixel hunts.

Pumaman

Quote from: Sslaxx on Wed 27/04/2011 10:14:28
Very initial thought: the headers on some of the files need to be altered to reflect the change of licensing.

Good point, I need to update those.

QuoteFirst stop: finding out how portable it is, I first might try to compile it with other compilers and see how much breaks. I know the plug-ins will break, but that will be the first step toward cross-platform compatibility.

The codebase includes all the changes that were made to get the Mac and Linux ports working, so getting these to build should not be a big task.

The platform-specific code is in the ACPLXXX.CPP files, where ACPLWIN is the Windows port, ACPLLNX is the linux one and ACPLMAC is the mac port. However these may no longer build correctly with the latest 3.2.1 code, so may need some fixing up.

Matti

This is great news! I can't contribute anything but I'm totally looking forward to all the cool changes that will be made!

Quote from: subspark on Wed 27/04/2011 11:24:57
Well this should be an interesting decade! :=

Indeed!

Calin Leafshade

Is the compiler included in this release?

I assume thats included in the ags.native assembly but i dont see the code for it.

tzachs

This is super cool!
I'm not gonna touch the engine myself since I'm a spoiled c-sharper, so I'm gonna stick with the editor, but really excited to see what will people come up with.

Greg Squire

This is very awesome!  Thanks for opening this up Chris!  Looking forward to seeing what you all do to make AGS even more awesome.

kingstone

Wonderful news! :D Now let's get this ball rolling!

I'm having some problems compiling the engine in VC++ 2008. First off there is a reference to dinput.h which is not included. This can be fixed by installing the Direct X SDK and adding the SDK's /include/ folder to the VC++ include directories (just like /Common/ and /Common/libinclude/).

Then in almp3.c there are hard coded #include paths to mpg123.h and mpglib.h.
I tried changing these to just "mpg123.h" and "mpglib.h" so that they include files from the libinclude folder. This doesn't seem to be the right files though, because it generates a bunch of compile time errors:

Code: ags

------ Build started: Project: acwin, Configuration: DebugWorking Win32 ------
Compiling...
almp3.c
Y:\Dev\AGS\Common\libinclude\mpglib.h(22) : error C2079: 'fr' uses undefined struct 'frame'
Y:\Dev\AGS\Common\libinclude\mpglib.h(23) : error C2065: 'MAXFRAMESIZE' : undeclared identifier
Y:\Dev\AGS\Common\libinclude\mpglib.h(23) : error C2057: expected constant expression
Y:\Dev\AGS\Common\libinclude\mpglib.h(23) : error C2087: 'bsspace' : missing subscript
Y:\Dev\AGS\Common\libinclude\mpglib.h(24) : error C2061: syntax error : identifier 'real'
Y:\Dev\AGS\Common\libinclude\mpglib.h(28) : error C2061: syntax error : identifier 'synth_buffs'
Y:\Dev\AGS\Common\libinclude\mpglib.h(28) : error C2059: syntax error : ';'
Y:\Dev\AGS\Common\libinclude\mpglib.h(28) : error C3409: empty attribute block is not allowed
Y:\Dev\AGS\Common\libinclude\mpglib.h(28) : error C2143: syntax error : missing ']' before 'constant'
Y:\Dev\AGS\Common\libinclude\mpglib.h(30) : error C2059: syntax error : '}'
[and more]


The hard coded paths reference a folder named /almp3_205/decode/ but I have been unable to google anything like that. How can I find the correct files to include?

Thanks a lot for releasing the source code CJ, I believe this will open up for lots of collaborative improvements ahead! :)

Sephiroth

You'll most probably need to install allegro to VC 2008, I'll update the post to let you know if I can compile.

Pumaman

#16
Quote from: Calin Leafshade on Wed 27/04/2011 16:15:03
Is the compiler included in this release?

I assume thats included in the ags.native assembly but i dont see the code for it.

No, the editor's Native assembly is not yet released. That will follow, but has further complications and it also cannot be compiled by the free Express versions of Visual Studio, which makes a source code release less useful.
Obviously though, to make any changes that need the game compiler to produce a different output, this will need to be modified so I will be providing the source in due course.

QuoteI'm having some problems compiling the engine in VC++ 2008. First off there is a reference to dinput.h which is not included. This can be fixed by installing the Direct X SDK and adding the SDK's /include/ folder to the VC++ include directories (just like /Common/ and /Common/libinclude/).

Ah thanks, I should have mentioned this. First post updated.

QuoteThen in almp3.c there are hard coded #include paths to mpg123.h and mpglib.h.
I tried changing these to just "mpg123.h" and "mpglib.h" so that they include files from the libinclude folder. This doesn't seem to be the right files though, because it generates a bunch of compile time errors:

Well spotted, I've checked in a fix for this so please try again with the latest version.

Basically the complication here is that AGS uses both ALMP3 (for MP3 playing) and APEG (for Theora video), but ALMP3 and APEG each use different versions of another library called MPGLIB. So AGS ends up having to include two different MPGLIBs, and has to manually direct ALMP3 to one of them and APEG to the other.

dbuske

I suggest that the code just be updated with c++ first, so there is a solid windows base.
Then when that is done then work on other ports.
What if your blessings come through raindrops
What if your healing comes through tears...

Electroshokker

#18
Sweet. I'll see if I can make a linux build of 3.2.1 soon.

Chris, are any parts of the source still closed?

I could release my linux Code::Blocks projects (with instructions) with your permission. (Can I release older versions of the engine or only the latest?)
I'm sure some of the more enthousiastic folks out there would love to start from a proper IDE setup, rather than starting with raw code.

Also, SVN will help a ton in re-integrating all the changes I made into AGS.

Anyways, great to see the engine going open source. That'll speed things up a notch or two. (I'd love to debate my usage of the Allegro 4.4 branch in Linux and the OpenGL integration, the last of which I haven't had any time for so far.)

EDIT:

Oh, and for your question: * Is it cross-platform (ie. is there anything platform-specific that would break the Mac and Linux ports?)

Hell yeah a bunch of stuff breaks for Linux... but I can help with that. I'd be happy to help any linux enthousiast to get it up and running.

Shane 'ProgZmax' Stevens

Very very nice, CJ.  I know how much you love AGS and want to protect it so people should consider this to be an exceptional olive leaf on your part and hopefully no one will make you regret it.

SMF spam blocked by CleanTalk