Allegro.cc - Online Community

Allegro.cc Forums » The Depot » [Community Project] AMGC2

This thread is locked; no one can reply to it. rss feed Print
[Community Project] AMGC2
miran
Member #2,407
June 2002

That stands for "Allegro Mini-Game Collection" :)

A while ago CGamesPlay had this brilliant idea of making a nice little framework you could plug simple games into. Not many games were developed for that "platform" but I thought it was a good idea so I decided to revive it. I wrote a simple framework program that does things like provide a main loop, gives you double buffering, timer control, high score handling, etc. It even loads and runs games that are compiled as DLLs. All you need to do is implement the game interface, compile a DLL and plug it in. No need even to recompile the program. :)

Here I'd like to ask for your help:

1. Write games! Simple mini-games I mean. In the src/games directory is a file called template.cpp. You just need to rename it to something unique and implement the Init(), Deinit(), Logic() and Draw() methods (and perhaps a few more). Then compile it into a DLL (a makefile for MinGW is included) and put it in the games directory. Post it here too for others to enjoy. This isn't a contest, more like a fun community project, like the 20line game thread :) See who can make the best little mini-game :)

2. Help me improve the program. What can be added? What doesn't work? (read readme.txt before you say fullscreen mode because I know about that) What can be improved and how?

3. Help me make the program work on platforms other than Windows. All I need is the equivalent of dynamically loadable DLLs on Linux. I know a lot of people here are Linux gurus but I am not, so I can't do it myself.

Screenshot:
http://ferisrv5.uni-mb.si/~ma0747/graphics/screen_amgc2.png

Link: The official AMGC2 page

You can download the main program (both Windows binary and Linux tested source) as well as some game plugins there.

Here's also the project page on the a.cc depot: AMGC2 on the depot. Feel free to post a review.

--
sig used to be here

OICW
Member #4,069
November 2003
avatar

Sounds like a good idea. Maybe I could rewrite Revenge of Frosty under this platform. I'll check it as soon as I'll have enough time.

[My website][CppReference][Pixelate][Allegators worldwide][Who's online]
"Final Fantasy XIV, I feel that anything I could say will be repeating myself, so I'm just gonna express my feelings with a strangled noise from the back of my throat. Graaarghhhh..." - Yahtzee
"Uhm... this is a.cc. Did you honestly think this thread WOULDN'T be derailed and ruined?" - BAF
"You can discuss it, you can dislike it, you can disagree with it, but that's all what you can do with it"

Todd Cope
Member #998
November 2000
avatar

I like it. I'll probably make some stuff for this. Now I can finally make something of all those little unfinished projects... I'll just convert them into mini games 8-)

BAF
Member #2,981
December 2002
avatar

Kickup's crashed. This is all the info I have avaliable for the crash at the moment:

AMGC2.exe caused an Access Violation at location 7c911e58 in module ntdll.dll Reading from location 00000000.

Registers:
eax=01e77ff8 ebx=003d0000 ecx=00000000 edx=00000000 esi=01e77ff0 edi=01e784f8
eip=7c911e58 esp=0022fa50 ebp=0022fa5c iopl=0         nv up ei pl zr na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246

Call stack:
7C911E58  ntdll.dll:7C911E58  RtlInitializeCriticalSection
7C910D5C  ntdll.dll:7C910D5C  wcsncpy
77C2C2DE  msvcrt.dll:77C2C2DE  free
6EA422E5  kickups.dll:6EA422E5
6EA4A21B  kickups.dll:6EA4A21B
0040516C  AMGC2.exe:0040516C
004A0439  AMGC2.exe:004A0439

Couldn't reproduce it. And at the end of the quad game, it gave me game over, prompted me for my name twice, and added my highscore twice.

Steve Terry
Member #1,989
March 2002
avatar

Why not just use threads or spawn off a game directly from any executable? Anyway sounds like a good idea.

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Carrus85
Member #2,633
August 2002
avatar

It would be extra cool if you could have the program link to a website to download new minigames... :D

nonnus29
Member #2,606
August 2002
avatar

Pretty slick, I might have a go at writing an allegro applet... ;D

Oh, and kick crashed on me too, I started it about 3 times in a row and it gave me a black window. I couldn't reproduce it though.

edit; and you could organize an 'allegro minigame competition', that would be fun....

miran
Member #2,407
June 2002

Thanks for all the replies :)

Quote:

I like it. I'll probably make some stuff for this. Now I can finally make something of all those little unfinished projects... I'll just convert them into mini games

Quote:

Pretty slick, I might have a go at writing an allegro applet... ;D

Thanks. That's a good idea :D

Quote:

Kickup's crashed.

Quote:

Oh, and kick crashed on me too, I started it about 3 times in a row and it gave me a black window. I couldn't reproduce it though.

Damn. I had some problems with that one myself. I thought I fixed all the bugs but apparently not. :( It would always crash on game over for me but it hasn't happened since that last time when I thought I fixed the bug...

Quote:

And at the end of the quad game, it gave me game over, prompted me for my name twice, and added my highscore twice.

That's weird, never happened to me. Could be a simple little oversight. Hard to find though...

Quote:

and you could organize an 'allegro minigame competition', that would be fun....

Yeah, but first I'd have to make it work at least on Linux... :-/ Anyone can help? Dynamically loading DLLs (or whatever, .so?) on Linux? :-/

Quote:

Why not just use threads or spawn off a game directly from any executable?

Because I don't want to open another window. I want the plugins to integrate right with the host program...

------------------------- EDIT: Awwww, cmon people, nobody else interested in this? And nobody knows how to do dynamic DLL equivalents on Linux? Btw, attached is a fixed copy of Kickups. Was a silly little error. Just put the dll in the games directory replacing the old one...

--
sig used to be here

Onewing
Member #6,152
August 2005
avatar

Quote:

Awwww, cmon people, nobody else interested in this?

Interested, but too busy. Schedule should free up in about a month and then maybe. I'll at least check out the program and give you some feedback.

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Mokkan
Member #4,355
February 2004
avatar

I'd really like to make a game for this... but I use Linux :-/. I do have a Windows box, though, so maybe I'll see what I can do with that. Also, I think the .dll equivalent is a .so (shared object)...

Tero Laxström
Member #2,589
July 2002
avatar

Nice idea, but but... You will need to compile the minigames on all platforms separately, which kind of takes the fun out of it. :(

--
tlax

Evert
Member #794
November 2000
avatar

I'll see what time I have (probably not much).
I like the idea.

miran
Member #2,407
June 2002

Quote:

Also, I think the .dll equivalent is a .so (shared object)...

Yeah, that much I could guess. But how do you dynamically load a .so programmatically?

Quote:

Nice idea, but but... You will need to compile the minigames on all platforms separately, which kind of takes the fun out of it. :(

Well, at least it's an improvement from the first AGC where the whole program needed to be recompiled when you wanted to plug in a new game. Sort of like the grabber plugins.

Before I went the DLL way I was also thinking about making a sort of a simple Allegro basic-like scripting language that the host program would interpret. But then I though this would be too limiting, plus it would be very difficult to do. Although on the other hand, that might not be such a bad idea. I mean I tend to have most fun when I have limited resources. Like for example that 20line contest a couple of years ago was extremely fun :)

Quote:

I'll see what time I have (probably not much).

The Frogger clone is just a few copy&paste operations away ;)

--
sig used to be here

Tero Laxström
Member #2,589
July 2002
avatar

Couple of links I found quickly:
http://www-128.ibm.com/developerworks/library/l-shobj/
http://lidn.sourceforge.net/articles/writing_dlls_in_linux/l-dll.html

Quite simple and straight forward.. I think, haven't played much with them.

--
tlax

nonnus29
Member #2,606
August 2002
avatar

Quote:

But then I though this would be too limiting, plus it would be very difficult to do. Although on the other hand, that might not be such a bad idea. I mean I tend to have most fun when I have limited resources. Like for example that 20line contest a couple of years ago was extremely fun :)But then I though this would be too limiting, plus it would be very difficult to do. Although on the other hand, that might not be such a bad idea. I mean I tend to have most fun when I have limited resources. Like for example that 20line contest a couple of years ago was extremely fun :)

This would be cool and if you used spidermonkey/javascript plus marcello's jsgen it'd be a 'no-brainer'.

This was the idea behind my failed 'javascript game console' project only difference was that jsgc would have allowed you to script applet games with javascript.

IonBlade
Member #3,521
May 2003
avatar

This is a really cool idea, I might get into doing some minigames :D

------

"I've got to choose my words carefully so that I'm not misunderstood, but I think there are fewer developers around today who think about making a good game. As a creator, I find that sad..." - Hideo Kojima

Tero Laxström
Member #2,589
July 2002
avatar

The idea is nice, like I said. But now that I saw that it's a windows program, I'm kind of not so interested in it. Just my feelings after seeing the source. :P

Porting it isn't going to be nice, well at least not my cup of tea. Theres no good portable way of creating this kind of program. Except that wxwindows is trying to make a good job on it. It's also in c++, which gives me the willies and makes me sad. :'( And probably kills a kitten every time somebody runs it.

Update:
Maybe I should open my eyes as there is a screenshot in the first post. ^_^

--
tlax

Carrus85
Member #2,633
August 2002
avatar

Well, as long as people code to standard, maybe someone could do something like this:

Person A puts up a webserver where people can register "modifications." Person B uploads his compliant code to the folder (via CVS, FTP, whatever) set aside for his modification. Person C is running windows and visit's Person A's server via an ingame "modification database," wanting to play Person B's game. Person A's server determines if there is an up-to-date version of the game for Person C's operating system. If there is not, Person A's Server can either A) Compile an up-to-date version of the program and serve it to the client, or B) Give the source code to the client and compile the code for them, storing the resultant file into the proper location.

Of course, this assumes several things, such as that the client has a valid compiler enviroment if they want to compile the code themselves, that Person A's operating system can cross-compile for various platforms (or delegate compilation tasks to some other machine that can compile for a particular platform), that the code supplied is relatively standard and won't generate compiler errors or warnings, etc.

nonnus29
Member #2,606
August 2002
avatar

Quote:

The idea is nice, like I said. But now that I saw that it's a windows program, I'm kind of not so interested in it. Just my feelings after seeing the source. :P

Porting it isn't going to be nice, well at least not my cup of tea. Theres no good portable way of creating this kind of program. Except that wxwindows is trying to make a good job on it. It's also in c++, which gives me the willies and makes me sad. :'( And probably kills a kitten every time somebody runs it.

Apparently you didn't look at the source because it's not windows, it uses Mirans gui in an allegro window which is completely cross platform. You can #define NO_MAGIC_MAIN on any platform.

Billybob
Member #3,136
January 2003

Quote:

This would be cool and if you used spidermonkey/javascript plus marcello's jsgen it'd be a 'no-brainer'.

This was the idea behind my failed 'javascript game console' project only difference was that jsgc would have allowed you to script applet games with javascript.

I agree. But I didn't know Marcello wrote JSGen? Small world. Anyway, I didn't like jsgen, it seemed like took much work to comment everything properly, so I spent a couple days working up some macros to do all the work. Came out okay, though it could do with more work.

But yeah, just make Allegro or OpenLayer functions available to Javascript and you're set.

miran
Member #2,407
June 2002

Quote:

Couple of links I found quickly: (...snip...)

Wow, that looks very simple to use. Not much different than on Windows :D

Quote:

The idea is nice, like I said. But now that I saw that it's a windows program, I'm kind of not so interested in it. Just my feelings after seeing the source. :P

Porting it isn't going to be nice, well at least not my cup of tea. Theres no good portable way of creating this kind of program. Except that wxwindows is trying to make a good job on it. It's also in c++, which gives me the willies and makes me sad. :'( And probably kills a kitten every time somebody runs it.

It's a Windows executable because I compiled it with MinGW and MinGW produces Windows executables :P Other than that it's a perfectly normal Allegro program that uses my GUI library. Porting it to Linux is straightforward, except for that DLL loading thing.

And btw, writing a minigame doesn't require any knowledge of C++. Yes, you have to write one class, but that's why I wrote template.cpp. You can use it as a starting point and just implement those three or four functions that need to be implemented (init, deinit, logic and draw).

EDIT: Bad news everyone. Looks like this will never work on Linux or any platform other than Windows... :(

OK, I see there's not much interest in this. But I'd still like to see some nice little fun games on this thing. So if anyone has something, feel free to post :)

--
sig used to be here

Billybob
Member #3,136
January 2003

Quote:

Bad news everyone. Looks like this will never work on Linux or any platform other than Windows...

Why? What's the problem?
I'll go ahead and work on DL under Linux in my free time, but said time is limited. If I get it working I'll get back to you with some code.

EDIT: Okay I've worked out Dynamic Loading on Linux. Works like a charm. Later today I'll try to modify your code to work on Linux if I can. I think I have a working Allegro installation on that machine.
In any case the code is simple and I got it from: here. For instructions on how to create a shared library just click "prev" at the bottom. I didn't have to put anything special in my shared library, like weird dllexport stuff on functions. It just exported everything nicely.

miran
Member #2,407
June 2002

Quote:

Why? What's the problem?
I'll go ahead and work on DL under Linux in my free time, but said time is limited. If I get it working I'll get back to you with some code.

EDIT: Okay I've worked out Dynamic Loading on Linux. Works like a charm. Later today I'll try to modify your code to work on Linux if I can. I think I have a working Allegro installation on that machine.
In any case the code is simple and I got it from: here [linux.com]. For instructions on how to create a shared library just click "prev" at the bottom. I didn't have to put anything special in my shared library, like weird dllexport stuff on functions. It just exported everything nicely.

You must have missed the other thread I made :) I figured out dynamic .so loading and it works fine. The GUI runs, the .so files are loaded and queried for game name, author name, etc. and the game list box is populated like it should be. But when I try to run a game, it crashes. That's because the .dll/.so runs in a different allegro context (for lack of a better description) so it has to do install_allegro(), set_gfx_mode() and all that for itself (the base class for the plugins does that automatically). But in order to integrate nicely with the host program it must use the same window the host program created when it ran set_gfx_mode(). Now under Windows that's not a problem because there are win_get_window() and win_set_window() functions (the host program lets the dll have its window), but on X there's no equivalent for that. I put Windows specific code in #ifdef/#endif blocks so on X it doesn't get executed, so when the .so comes to set_gfx_mode(), it crashes and takes the host program down with it as well...

--
sig used to be here

FrankyR
Member #243
April 2000
avatar

Miran, this is really cool. I'll definatly try to get around to writing somes games for it. The fact that it'll only work in windows doesn't seem like that big of a deal...there are a lot of successful games that work exculsivly in windows (just put "windows only" in the thread titles related to this :)).
With enough interesting, fun games for this I could really see it being popular.

miran
Member #2,407
June 2002

:D Good news everyone! We're delivering a package to... no, wait, that's not it... Oh yeah, I managed to make it work on Linux! And there was nothing to it. I had so many problems on Windows I just assumed it must be the same on Linux so I didn't even bother to try the obvious. Until just now that is, and to my amazement everything works and you don't even have to do anything special about it. Just load the .so with dlopen() and that's it. Now I feel extra stupid. :-X

But also happy! :D Because now it finally works, and it works even better than on Windows, because there fullscreen mode doesn't work half the time and on Linux it does! Woohoo! ;D

Anyway, I updated the first post with a link to the v2.01 source (amgc2.tar.gz). Please, if there's anyone out there who uses Linux and has MASkinG installed, be so kind and try to compile the code and tell me what results you get. It's just one "make" for the host program and one "make all" for the games. I would post a binary but I'm affraid that just won't work for most people... :-/

Btw, on Linux some skins might not work right because they rely on MS Windows fonts :-[

--
sig used to be here



Go to: