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

Quote:

I discarded the idea of a central server distributing network packets, as :
- it would hog the hosts's bandwidth - and depend on his availability
- Player A in Europe + server in the US + Player B in Europe = trouble

Yeah, you're right. There would be no problem for turn based games like chess for example, but I can imagine you'd want to make real time action games too.

Here's what I propose:

- Each game can say whether it is a peer-to-peer client/server kind of application or a simple client that will use the central server.

- If the game is a p2p game: When creating a game, the one hosting it will leave his IP on the central server for others to see, and the one(s) joining a game will connect to that IP. Then all communication will go directly from peer to peer. The amgc2.exe program will just make sure everyone gets all messages and all that but ultimately the game dll will be responsible for handling all sorts of different situations, in-game chat, etc.

- If the game is a simple client: The one creating a game will just allocate a channel on the central server and anyone will be able to join. Then everybody in a given channel will communicate by sending messages to the central server and it will take care of all the little details.

Quote:

edit Now I think I see a possible plugin-safe implementation: a key bringing down the full amgc2 box with history as a pop-up over the game

Hehe, I'm way ahead of you here... ;)

--
sig used to be here

Audric
Member #907
January 2001

Blockman v1.02

  • multiple crates throwing. Doesn't change the gameplay (AFAIK), just makes it smoother sometimes.

  • High-resolution : sprites pre-converted from 320x200 to 640x400 in hq2x, the crates don't benefit much, but the round guy is much nicer.

  • Unzip in games/ , it should correctly create blocks/ subdir (sorry)

  • fixed settings, benefits from amgc2 v2.08

  • hints option, marks the crates which can't move (affects NOVICE levels only)

  • remembers your progress automatically (ahhhhh)

  • records high-score only if you actually beat a level

  • Source code beautified, last variables and functions names translated to English.

Probably last version, unless somebody spots a bug.

Now making room to work on MMOP...(Massively Multiplayer Online Pong)

miran
Member #2,407
June 2002

Quote:

Now making room to work on MMOP...(Massively Multiplayer Online Pong)

Hehe, Massively Multiplayer Online Pong ;D But you may want to reconsider this. A more appropriate project would be MMOTTT (Massively Multiplayer Online Tic Tac Toe) or something like that unless you're willing to go deep down into the networking code...

Btw, the net enabled version is still quite a few days away...

--
sig used to be here

Audric
Member #907
January 2001

While waiting for network news, some suggestions:
- provide a char *gamepath or something in the IGame class, containing the directory where the game was found. Right now, a game runs in amgc2's path, and can only guess which directory in "games/" contains its data.

- have the "High score" dialog initialized with the current player name - so the player only has to press enter. Or silently (no dialog box) record the name, after all.

- readme.txt reader

juvinious
Member #5,145
October 2004
avatar

It would be nice if all the games listed on here would actually include a makefile like the template that Miran provided. :-/
Also chess and duckhunter wouldn't compile.

__________________________________________
Paintown

miran
Member #2,407
June 2002

Quote:

- provide a char *gamepath or something in the IGame class, containing the directory where the game was found. Right now, a game runs in amgc2's path, and can only guess which directory in "games/" contains its data.

Yeah, that's a good idea. I think I'll add a second version of IGame::Init() that will get the game's directory as a paramater and deprecate the original one.

Quote:

- have the "High score" dialog initialized with the current player name - so the player only has to press enter. Or silently (no dialog box) record the name, after all.

Another good point. I think I'll just store the most recently entered player name somewhere and initialize the "enter your name" dialog with that.

Quote:

- readme.txt reader

Not sure what you mean. A box that displays a game's readme.txt if one exists?

Quote:

It would be nice if all the games listed on here would actually include a makefile like the template that Miran provided. :-/
Also chess and duckhunter wouldn't compile.

Might be because of different includes. At first template.cpp (and all my games) included "../IGame.h" because the source was located in 'src/games'. But now that each game gets its own directory where source is also placed, they're supposed to include <IGame.h> and the include directory where IGame.h is located should be specified somewhere, e.g. with the -I gcc switch.

--
sig used to be here

juvinious
Member #5,145
October 2004
avatar

Still doesn't explain the missing makefiles. :P
About the includes I'll look into it which might be the problem because I found that out when I updated my amgc2 version and the game I am writing was complaining...

[edit]
Ok duckhunter worked, I don't know what to do to get chess to work. It's a mess with all this depend.sh stuff.....kind of reminds me of building allegro. :P

Heres what it spits out:

1make
2g++ -Wall -Winline -Wno-deprecated-declarations -O -g -pipe -fPIC -I../../src/ -I include -c -o obj/unix/sbr.o src/misc/sbr.c
3src/misc/sbr.c: In function `int sbr(unsigned int)':
4src/misc/sbr.c:5: error: redefinition of `int sbr(unsigned int)'
5include/sbr.h:6: error: `int sbr(unsigned int)' previously defined here
6src/misc/sbr.c:5: error: redefinition of `int sbr(unsigned int)'
7include/sbr.h:6: error: `int sbr(unsigned int)' previously defined here
8src/misc/sbr.c: In function `int sbr_longlong(long long unsigned int)':
9src/misc/sbr.c:13: error: redefinition of `int sbr_longlong(long long unsigned
10 int)'
11include/sbr.h:15: error: `int sbr_longlong(long long unsigned int)' previously
12 defined here
13src/misc/sbr.c:13: error: redefinition of `int sbr_longlong(long long unsigned
14 int)'
15include/sbr.h:15: error: `int sbr_longlong(long long unsigned int)' previously
16 defined here
17make: *** [obj/unix/sbr.o] Error 1

__________________________________________
Paintown

Audric
Member #907
January 2001

miran said:

IGame::Init() that will get the game's directory as a parameter

:/ All the IGame functions might need this information at some point, (except possibly Draw()).

readme.txt: I was thinking, a char * IGame::GetReadme() like the existing char * IGame::GetIcon(). If it is derived to returns the name of an existing file, amgc can display a button which opens a large text-box (with scrollbar!) to show this text file: right place to put version info, credits, compatibility & compilation info.

Makefile: mea culpa :-[
For blocks, the single-line proposed in the old examples for mingw works, assuming amgc2 has its sources in src. I've never managed to have a Makefile work on every platform.

Evert
Member #794
November 2000
avatar

Quote:

I don't know what to do to get chess to work.

One types `make' :P

Quote:

It's a mess with all this depend.sh stuff.....

You don't need to run it; I ran make depend before building up the archive.

Quote:

g++ -Wall -Winline -Wno-deprecated-declarations -O -g -pipe -fPIC -I../../src/ -I include -c -o obj/unix/sbr.o src/misc/sbr.c
src/misc/sbr.c: In function `int sbr(unsigned int)':
src/misc/sbr.c:5: error: redefinition of `int sbr(unsigned int)'

That's weird though. Your version of gcc doesn't seem to like functions that are declared extern inline. What version of gcc are you using? Also, use gcc instead of g++. It's all C code (except for the interface) and should be compiled as such. gcc will automatically use the proper compiler for the source file you're compiling (g++ is convenient at the linking stage, but even then it's not nescessary).
As a last resort, you can remove the inline declarations from sbr.h (which will slow the code down a bit because the function is no longer inlined).

juvinious
Member #5,145
October 2004
avatar

Quote:

That's weird though. Your version of gcc doesn't seem to like functions that are declared extern inline. What version of gcc are you using? Also, use gcc instead of g++. It's all C code......

Ok changed CC to gcc in the Makefile and that worked fine.
Now it just takes forever for the computer to compute it's next move. :P
Nice game regardless. :)

__________________________________________
Paintown

miran
Member #2,407
June 2002

Quote:

All the IGame functions might need this information at some point, (except possibly Draw()).

Init() is always called on game start so if you need the path, you will be able to make your own copy in that function...

Quote:

readme.txt: I was thinking, a char * IGame::GetReadme() like the existing char * IGame::GetIcon(). If it is derived to returns the name of an existing file, amgc can display a button which opens a large text-box (with scrollbar!) to show this text file: right place to put version info, credits, compatibility & compilation info.

Well, I would actually hardcode that to readme.txt. That's the standard name for a readme and I see no reason why anyone would want it otherwise. Actually I could do the same for the icon too (I could assume icon.bmp or icon.tga). The only reason there is a GetIcon() function is because in the first version all games were in the same directory.

Juvinious: Evert's makefile worked for me first time... EDIT: No, wait, I had to change gcc to g++.

In other news, the chatroom already works. We're now getting pretty close to being able to actually play games :D. There's not enough implemented to be worthy of a public release though, I'd just like to let you know that progress is being made... :)

--
sig used to be here

Evert
Member #794
November 2000
avatar

Quote:

Now it just takes forever for the computer to compute it's next move. :P

Actually, it only takes ten seconds. But it feels like it takes forever because it doesn't show any progress and you cannot move the mouse.

I'll tweak the makefile to use g++ in Windows, if that works there, and just use gcc otherwise (which as far as I can tell should work either way, but whatever).

CGamesPlay
Member #2,559
July 2002
avatar

Oh my, I saw "AMGC2" and thought it was some obscure package I didn't know about and didn't bother reading "Community Project". I'm here now though, so it's okay. You really should have PMed me or something :P I'm going to have a look at the source now, and check it out. Someone want to sum up the key points in this thread? I only read the first 50 or so posts (I know up to miran made Linux go).

One of the things I would like to do especially is add the capacity to run non-managed programs also, so the program has minigames and main games. Then I want to assemble the best Allegro games and make a CD.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

miran
Member #2,407
June 2002

Quote:

You really should have PMed me or something :P

I know, but you seemed so busy with other stuff I didn't want to bother you :P

Quote:

I'm going to have a look at the source now, and check it out. Someone want to sum up the key points in this thread? I only read the first 50 or so posts (I know up to miran made Linux go).

Things work on Windows and Linux, a few games were posted (some very good too, there are 11 in total so far), latest version is v2.08 and network support is being added as I speak.

Quote:

One of the things I would like to do especially is add the capacity to run non-managed programs also, so the program has minigames and main games. Then I want to assemble the best Allegro games and make a CD.

Heh, that's actually something I already made a while ago. Didn't really finish it or anything though... :)

--
sig used to be here

CGamesPlay
Member #2,559
July 2002
avatar

Linux works, but the games' Makefiles try to construct DLLs :P

cgames@ryan ~/projects/amgc2/games/tetris $ make
g++ -o tetris.dll tetris.cpp -shared -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -s -W -Wall -I../../src/ -lalleg
tetris.cpp: In member function `virtual int Tetris::Logic(int*, int*, float)':
tetris.cpp:175: warning: unused parameter `int*mouse'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/../../../../i686-pc-linux-gnu/bin/ld: unrecognized option '--enable-auto-import'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/../../../../i686-pc-linux-gnu/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
make: *** [win] Error 1

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

miran
Member #2,407
June 2002

Yeah, my bad. Try "make linux". I should check for some global environment variable in the makefiles I suppose...

--
sig used to be here

CGamesPlay
Member #2,559
July 2002
avatar

That worked, thanks.

Okay, so what networking will there be? I think the first thing should be a high-score server. As a requirement, some sort of binary-checking would be required. Not for security purposes, just for making sure a game isn't modified and the old high scores are impossible to beat now.

Is there already a better plan for managing this?

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

juvinious
Member #5,145
October 2004
avatar

Quote:

Actually, it only takes ten seconds. But it feels like it takes forever because it doesn't show any progress and you cannot move the mouse.

I'll tweak the makefile to use g++ in Windows, if that works there, and just use gcc otherwise (which as far as I can tell should work either way, but whatever).

Yeah feels strange that's all..... :)
I'm running linux btw.

Quote:

One of the things I would like to do especially is add the capacity to run non-managed programs also, so the program has minigames and main games. Then I want to assemble the best Allegro games and make a CD.

If amgc2 gets to the point to have enough games and allows for non-managed games I'd put in the work for creating a livecd. Something similar to AdvanceCD which works pretty well.

__________________________________________
Paintown

Audric
Member #907
January 2001

Quote:

Okay, so what networking will there be? I think the first thing should be a high-score server. (...) some sort of binary-checking would be required.

Uhh.. won't be easy to compare the Windows build with the Linux build...

"Securing" the high score and multiplayer means freezing the game version, making a last build of the binaries on every platform, labelling them as the only kosher ones for online play. IMO this hinders development time, and should happen only after game is coded, tested, played, fixed, re-played etc.

"CD compilation" : ??? This is more floppy-sized, and it's not as if there were actually many games to choose from... Where's the point?

CGamesPlay
Member #2,559
July 2002
avatar

Now read the next sentence:

Quote:

Not for security purposes, just for making sure a game isn't modified and the old high scores are impossible to beat now.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

miran
Member #2,407
June 2002

Quote:

Okay, so what networking will there be?

There will be a central server with a chatroom where games can be arranged. Then you'll be able to start and register a game, you will be able to list active games and join one. All messages will be sent through this server. This will be most useful for turn based games where only a message or two are sent every now and then. The host program will take care of things like connecting, disconnecting, chat, filtering messages, etc.

Parallel to that the API for a more direct approach will be available. If a game declares it doesn't want to use the services of the server, the host program won't interfere and will let the game do all the networking stuff on its own. The person hosting such a game will create a server, register it with the central server and wait for clients to connect directly to him. The game (in both server and client mode) will then have to do the low level net stuff like handling connections, routing and filtering messages and so on...

Quote:

I think the first thing should be a high-score server.

We haven't really discussed that yet but I think it shouldn't be a problem. It's going to be the game's responsibility to make sure scores aren't too different between version, although ultimately we can still manually clear the tables if there's a need for that...

--
sig used to be here

Evert
Member #794
November 2000
avatar

Quote:

I'm running linux btw.

That was clear from the compiler output (obj/unix/sbr.o) ;)

@miran: if you need to automagically detect Windows or *NIX, have a look at my Makefile. That should work most of the time.

juvinious
Member #5,145
October 2004
avatar

Quote:

I'll tweak the makefile to use g++ in Windows, if that works there, and just use gcc otherwise (which as far as I can tell should work either way, but whatever).

I was thinking you were referring to me. :P

__________________________________________
Paintown

Evert
Member #794
November 2000
avatar

My original makefile used gcc, but miran changed it to g++ because apparently calling gcc doesn't link properly in Windows. I don't really understand why.

Come to think of it, I probably never even ran my chess programme in Windows myself...

umperio
Member #3,474
April 2003
avatar

Duck Hunter: no new version sorry, I just added the makefile as someone asked (sorry but I usually use Dev-C++ for developing and tend to forget about makefiles) and changed the icon to be icon.bmp read if Miran wants to go on this direction.

http://elvenprogrammer.themanaworld.org/files/duckhunter.tar.gz

Numbers: no I couldn't find a better name. I was developing a turn based game for amgc2 which I would like to work over the net, but I soon got into some troubles I wasn't able to solve, so I got bored and developed this quick game (30 minutes or so, it could take less time for sure with a better skilled programmmer). I don't know even if this game has got a name, but we used to play it at school when bored, so have some fun with it.

http://elvenprogrammer.themanaworld.org/files/numbers.tar.gz



Go to: