Author Topic: Initial AGS Engine Source Code release  (Read 70623 times)  Share 

Pumaman

  • Creator of AGS
  • Administrator
  • Mittens Monarch
  • I sense danger.
    • Lifetime Achievement Award Winner
    •  
Initial AGS Engine Source Code release
« on: 27 Apr 2011, 01:55 »
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.
« Last Edit: 28 Apr 2011, 15:07 by Pumaman »

Kweepa

  • Mutated Guano Deviser
    • Best Innovation Award Winner 2009, for his modules and plugins
    •  
  • Kweepa worked on a game that was nominated for an AGS Award!
Re: Initial AGS Engine Source Code release
« Reply #1 on: 27 Apr 2011, 03:08 »
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

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: Initial AGS Engine Source Code release
« Reply #2 on: 27 Apr 2011, 04:33 »
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.
« Last Edit: 27 Apr 2011, 04:35 by monkey_05_06 »
User was banned for this post.

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
  • Calin Leafshade worked on a game that was nominated for an AGS Award!Calin Leafshade worked on a game that won an AGS Award!
Re: Initial AGS Engine Source Code release
« Reply #3 on: 27 Apr 2011, 07:04 »
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.

Re: Initial AGS Engine Source Code release
« Reply #4 on: 27 Apr 2011, 08:45 »
Just awesome! Thank you very much for sharing  :o

A quick link for Calin if you still need it.

LINK

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
  • abstauber worked on a game that was nominated for an AGS Award!abstauber worked on a game that won an AGS Award!
Re: Initial AGS Engine Source Code release
« Reply #5 on: 27 Apr 2011, 09:01 »
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.

Re: Initial AGS Engine Source Code release
« Reply #6 on: 27 Apr 2011, 10:14 »
Thanks for this, Chris!

Very initial thought: the headers on some of the files need to be altered to reflect the change of licensing.
« Last Edit: 27 Apr 2011, 10:20 by Sslaxx »
Stuart "Sslaxx" Moore.

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: Initial AGS Engine Source Code release
« Reply #7 on: 27 Apr 2011, 11:24 »
Hey great work, Chris! A million thanks for doing this.  :-*
Well this should be an interesting decade! :=

Cheers!
     
Adlanto - A bold step into a valley of forgotten worlds - Coming Soon to Steam in August 2015!       Indiana Jones and the Fountain of Youth - Indy is back!

Wyz

  • AGS Project Tracker Admins
  • anno 1986
    • I can help with making music
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: Initial AGS Engine Source Code release
« Reply #8 on: 27 Apr 2011, 15:51 »
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

  • Creator of AGS
  • Administrator
  • Mittens Monarch
  • I sense danger.
    • Lifetime Achievement Award Winner
    •  
Re: Initial AGS Engine Source Code release
« Reply #9 on: 27 Apr 2011, 16:01 »
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.

Quote
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.

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.

Re: Initial AGS Engine Source Code release
« Reply #10 on: 27 Apr 2011, 16:09 »
This is great news! I can't contribute anything but I'm totally looking forward to all the cool changes that will be made!

Well this should be an interesting decade! :=

Indeed!

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
  • Calin Leafshade worked on a game that was nominated for an AGS Award!Calin Leafshade worked on a game that won an AGS Award!
Re: Initial AGS Engine Source Code release
« Reply #11 on: 27 Apr 2011, 16:15 »
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

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
  • tzachs worked on a game that was nominated for an AGS Award!
Re: Initial AGS Engine Source Code release
« Reply #12 on: 27 Apr 2011, 20:59 »
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.

Re: Initial AGS Engine Source Code release
« Reply #13 on: 28 Apr 2011, 01:30 »
This is very awesome!  Thanks for opening this up Chris!  Looking forward to seeing what you all do to make AGS even more awesome.

Re: Initial AGS Engine Source Code release
« Reply #14 on: 28 Apr 2011, 02:53 »
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: Adventure Game Studio
  1. ------ Build started: Project: acwin, Configuration: DebugWorking Win32 ------
  2. Compiling...
  3. almp3.c
  4. Y:\Dev\AGS\Common\libinclude\mpglib.h(22) : error C2079: 'fr' uses undefined struct 'frame'
  5. Y:\Dev\AGS\Common\libinclude\mpglib.h(23) : error C2065: 'MAXFRAMESIZE' : undeclared identifier
  6. Y:\Dev\AGS\Common\libinclude\mpglib.h(23) : error C2057: expected constant expression
  7. Y:\Dev\AGS\Common\libinclude\mpglib.h(23) : error C2087: 'bsspace' : missing subscript
  8. Y:\Dev\AGS\Common\libinclude\mpglib.h(24) : error C2061: syntax error : identifier 'real'
  9. Y:\Dev\AGS\Common\libinclude\mpglib.h(28) : error C2061: syntax error : identifier 'synth_buffs'
  10. Y:\Dev\AGS\Common\libinclude\mpglib.h(28) : error C2059: syntax error : ';'
  11. Y:\Dev\AGS\Common\libinclude\mpglib.h(28) : error C3409: empty attribute block is not allowed
  12. Y:\Dev\AGS\Common\libinclude\mpglib.h(28) : error C2143: syntax error : missing ']' before 'constant'
  13. Y:\Dev\AGS\Common\libinclude\mpglib.h(30) : error C2059: syntax error : '}'
  14. [and more]
  15.  

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

Re: Initial AGS Engine Source Code release
« Reply #15 on: 28 Apr 2011, 14:10 »
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

  • Creator of AGS
  • Administrator
  • Mittens Monarch
  • I sense danger.
    • Lifetime Achievement Award Winner
    •  
Re: Initial AGS Engine Source Code release
« Reply #16 on: 28 Apr 2011, 14:43 »
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.

Quote
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/).

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

Quote
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:

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.
« Last Edit: 28 Apr 2011, 14:46 by Pumaman »

Re: Initial AGS Engine Source Code release
« Reply #17 on: 28 Apr 2011, 15:36 »
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...

Re: Initial AGS Engine Source Code release
« Reply #18 on: 28 Apr 2011, 16:28 »
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.
« Last Edit: 28 Apr 2011, 16:34 by Electroshokker »

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • AGS Project Tracker Admins
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    •  
    • I can help with characters
    •  
    • Lifetime Achievement Award Winner
    •  
    • I can help with making music
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
  • Shane 'ProgZmax' Stevens worked on a game that was nominated for an AGS Award!Shane 'ProgZmax' Stevens worked on a game that won an AGS Award!
Re: Initial AGS Engine Source Code release
« Reply #19 on: 28 Apr 2011, 17:39 »
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.