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
Ilyas Salman
Member #6,762
January 2006
avatar

Ok, the same result ;)

miran
Member #2,407
June 2002

This thread is getting long... :)

I made another update (v2.07). Nothing major, just the restructuring of the way the games are handled. Now all the games should be in separate directories under 'games', although the old way with all files in that one huge directory still works. So if you have a previous version installed, better make a clean reinstall so you don't get duplicated entries. And those who make plugins better make a new directory under 'games' and move everything there :)

In other news, some work was made in the direction of supporting network play. There will be a central server onto which you will be able to connect. There will be a chatroom where you'll be able to find someone to play with. One person will start a game, the other or others will join. The IGame interface will be updated as necessary. Functions will be added that will allow the games to say whether or not they are multiplayer net games, define how many players can play and to send and receive messages. All without having to know a single thing about network code. :)

I've made a small part of the GUI necessary to support this but as it currently doesn't do anything useful yet, it is invisible by default. If you want to see how it will look, press F1 in the main menu. An additional button labeled "Play Online" will appear. Clicking it shows a dialog where you select a server and type in your name (just type anything, it doesn't matter at this point). When you click "OK", the chatbox appears instead of the game descriptions and highscores. The chatbox is basically just a list of messages and an editbox where you can type in your message. And a button to define your colour. That's all I've made so far. The chatbox is not functional by the way, that is no messages are being sent anywhere...

Eventually you'll be able to actually chat in the chatbox and then press the "Start Game" and "Join Game" buttons. Start Game will take you to a dialog where you will be able to setup a new game (name, max players, etc.) and Join Game will take you to a list of available games for you to join.

This is all I have so far. All ideas are welcome. :)

--
sig used to be here

Ilyas Salman
Member #6,762
January 2006
avatar

Sound good ;)

It would be nice if we could choose bewteen a windowed and full screen, its annoying while testing the game.

I have a little problem, I don' know if it's a allegro or AMGC2 issue. I draw a rectfill with a x coordinate higher than 500, and it doesn't draw:

int bx1=550,by1=550;
rectfill(canvas, bx1, by1, bx1-20, by1-70, makecol(50,2,170));

It isn't out of screen because SCREEN_W = 640.

amarillion
Member #940
January 2001
avatar

coolness!

It would be useful for testing if you can run the server locally. Any idea how this is going to work? Which networking lib are you using?

I've started working on a pacman clone for AMGC... basically it is working now, except pacman doesn't die yet. Should be done soon.

I've noticed a bug in Quad: When you finish the game, you get in an endless loop and never return to the menu. You just get a popup saying "game over" over and over again.

miran
Member #2,407
June 2002

Quote:

It would be nice if we could choose bewteen a windowed and full screen, its annoying while testing the game.

Click the "Options" button in the main menu.

Quote:

I have a little problem, I don' know if it's a allegro or AMGC2 issue. I draw a rectfill with a x coordinate higher than 500, and it doesn't draw:
...

That draws a filled rectangle. Not sure why it doesn't work for you. Try reversing x1/x2 and y1/y2 coordinates...

Quote:

It would be useful for testing if you can run the server locally. Any idea how this is going to work? Which networking lib are you using?

According to the network specialist "the enet library (reliable UDP)". I don't know what that is though, I'm only the GUI guy ;)

Quote:

I've started working on a pacman clone for AMGC... basically it is working now, except pacman doesn't die yet. Should be done soon.

Woohoo! Two thumbs up.

Quote:

I've noticed a bug in Quad: When you finish the game, you get in an endless loop and never return to the menu. You just get a popup saying "game over" over and over again.

Hmm, why am I the only one who doesn't get that? And I do play that game quite abit when I'm bored...

--
sig used to be here

Ilyas Salman
Member #6,762
January 2006
avatar

Ok, I did x = 550 and y = 550, it's out of screen...

amarillion
Member #940
January 2001
avatar

Here (attached) is v0.9 of my pacman clone. It's not completely finished, there are some important things missing still. But it should give you a good preview.

And here is a screenshot:
http://www.helixsoft.nl/temp/pacman.gif

As you can see I'm sorely in need of some graphics :) Perhaps there are volunteers willing to help me out here?

There is only one big problem: the game uses 100% cpu when running. The fans of my poor laptop are working at maximum capacity - Miran, can you remedy this? Perhaps a rest() between calls to Logic()?

Audric
Member #907
January 2001

OMG, PacRogue :)

Ok, I moved my butt and ported that game, it's still not a "playable game" since I botched the level loader so the maps are meaningless, and you can't get past level 3. However the engine is fully functional, you can move around and push crates.

Obligatory screenshot:
http://rizoud.yves.free.fr/public/blockman.gif

Now to beautify the code, rewrite that darn level loader, and pre-render the MCGA graphics in 2xSai...

Kudos to my friend Paul Siramy, this was an abandoned project of his.

Paul Pridham
Member #250
April 2000
avatar

Hmm, it crashes for me now... looks like a null pointer access.

miran
Member #2,407
June 2002

Great work guys! :D I need to get home before I can try them though (10+ hours)...

Quote:

There is only one big problem: the game uses 100% cpu when running. The fans of my poor laptop are working at maximum capacity - Miran, can you remedy this? Perhaps a rest() between calls to Logic()?

The GUI itself actually does this or at least it's supposed to. I'll take a look to see what goes wrong?

Quote:

Hmm, it crashes for me now... looks like a null pointer access.

What exactly crashes? Where and when?

--
sig used to be here

Paul Pridham
Member #250
April 2000
avatar

Miran, it crashes immediately when I start it up. I think it sets up the display before it crashes, but I don't quite recall (at work currently). I get the typical Microsoft exception dialog box, something to the effect of "The instruction at 0x00000000 referenced memory at 0x00000000."

miran
Member #2,407
June 2002

That's really strange. I suppose I should actually do some error checking :P Does that happen with the latest version? Clean install? Only the default games or do you have some extras too?

--
sig used to be here

Paul Pridham
Member #250
April 2000
avatar

Yea, error checking might be nice. ;) This was the latest version, but not a clean install. I didn't download any extras.

axilmar
Member #1,204
April 2001

Quote:

hat's what's wonderful: Create, then let people wonder if there's anything it's useful for.

Ah, ok then! respect! :-)

Audric
Member #907
January 2001

amarillion said:

There is only one big problem: the game uses 100% cpu when running. The fans of my poor laptop are working at maximum capacity - Miran, can you remedy this? Perhaps a rest() between calls to Logic()?

Easy enough, just drive a pencil in the fan and the noise should stop immediately. I can't do anything about the cooking smell, though

miran
Member #2,407
June 2002

Quote:

There is only one big problem: the game uses 100% cpu when running. The fans of my poor laptop are working at maximum capacity - Miran, can you remedy this? Perhaps a rest() between calls to Logic()?

OK, back to this question now. :) Unless you changed something in the ini, the GUI itself should run at close to 0% CPU usage. The games though are a different story. Brute force full screen memory double buffering is used and the target framerate is the same as logic framerate, which is 100 Hz by default (you can change that in the ini but you better not, because some of the games are written speciffically for 100 FPS :P), so on slower computers a lot of CPU power is needed, mostly going to that final buffer->screen blit. Even on my relatively fast Athlon64 3000+ around 25-30% of CPU is used for making most games run at 100 FPS and around 70-80% for Quad (which uses text output functions and 2D drawing primitives, which are slow). Anyway, I added a targetFPS setting now so that gfx framerate can be limited to an arbitrary value without having to touch logic framerate and the CPU usage drops to around 10% at 50 FPS. I'll upload a new version when I get enough new features in... :)

Quote:

Yea, error checking might be nice. ;) This was the latest version, but not a clean install. I didn't download any extras.

Try a clean install and see if that works. My guess is that you changed some settings that made the new version not work. I'll do more error checking in the next version. :)

EDIT: I finally got a chance to play the two new games. :D

Blocks: Very nice. :) But I can't find the exit in level 3! It's not even there. I did however get that bug with cyclic higscore/game over messages though. I can finally reproduce the bug and hopefully kill it! :)

Pacman: Also nice, I like the text graphics :) But the game froze at one point and nothing could bring it back. Or maybe the host program froze, I'll have to take a closer look... :-/

EDIT2: Yay, I managed to fix that higscore/game over message bug. Was a simple little error really. I'll upload a new version as soon as the uni server starts working again... :-/

EDIT3: There, uploaded v2.08:

  • game over / highscore dialog bug fixed

  • error checking - hopefully you will get an error message if something goes wrong when starting up the program

  • targetFrameRate = 50 - will make the games run faster / use less CPU

  • uploaded the two new games too: Blocks and Pacman - thanks guys :)

--
sig used to be here

umperio
Member #3,474
April 2003
avatar

Fixed small issues and so version 0.4

I'm really looking forward a net version, it will add a lot, especially the possibility to upload our best scores.
I'm just wondering how the multiplayer gaming will work.
I mean for pong I'm sure the server will only act as a way to find a player to play with. But what about small multyplayer games, if they'll be ever supported? Will I have to host my own server and the official server will redirect to it, or I'll have to write a plugin as for the client so that it will be plugged into the server? (I hope my english is enough good to let you understand, if not just tell me and I'll try to explain better)

Sorry if I ask too much, but I really like this project and I'd like to develop a new game for it, so I'm wondering what it will be able to support and based on it I'll decide what to do.

Best regards.

P.S.: I'm not so skilled but if you need help with something feel free to ask (I know me < miran :P)

Paul Pridham
Member #250
April 2000
avatar

Miran, a clean install seems to have fixed it... either that, or 2.08 did.

Audric
Member #907
January 2001

Blockman updated, 1.01:
- real levels correctly implemented (91) : all the game contents is there.
- episode selection (start on level 1, 21, 41, 61, 81)

Something I scrapped in this version:
I've tried to make the game read the high-score table, so as to "unlock" level selection: If the top score is 35, meaning you've beat levels 1-35, it should automatically open level 36 when you start the game - and you should be able to choose in the settings a starting level of 1 to 36.
The good news is that GetSettings() can be updated dynamically - the host program behaves flawlessly if calls to Score() change the return values of subsequent GetSettings().
The bad news is that it's quite messy, the plugin game requires to statically link in the DLL (yes) some copies of the functions from hsc.cpp

A generic "save file" is probably a bad idea - every game has different needs.
I'll keep it simple and make blockman use its own save file to record the last beat level.

By the way, I'd like a confirmation about IGame class:
These I'm pretty sure:

  • Init() called every time user clicks "Play game"

  • DeInit() called every time one game ends - through esc key, or Logic() returning true

About the following, I'm less sure:

  • constructor called only once, at amgc startup, while it 'builds' the list of available games ?

  • destructor called ? (if yes, I guess it's on amgc shutdown)

miran
Member #2,407
June 2002

Quote:

I'm just wondering how the multiplayer gaming will work.

I'm not sure yet. There will probably be a server (a separate program) that you or anyone else will run and it will act only as a message routing service. It will be up to amgc2.exe to decide how these services will be used. You will be able to login and log out, enter the chatroom and use it, start a game and join a game. The server will only receive messages and send them to those who are supposed to receive them. The games themselves will also be quite abstracted from the network interface. They will only specify which messages they want to send and they will receive incoming messages just like they recieve mouse and keyboard input.

Quote:

Miran, a clean install seems to have fixed it... either that, or 2.08 did.

Excellent. Too bad we'll never know what went wrong before...

Quote:

Blockman updated, 1.01:
- real levels correctly implemented (91) : all the game contents is there.
- episode selection (start on level 1, 21, 41, 61, 81)

Wow, that's a lot of levels :o

Quote:

I've tried to make the game read the high-score table, so as to "unlock" level selection:
--snip--

Better just use your own file, like blocks.cfg and then use the normal Allegro config functions. Btw, you should put your game in something like 'games/blocks' instead of just 'games' to keep the directory structure cleaner a bit...

Quote:

By the way, I'd like a confirmation about IGame class:
--snip--

Init() and DeInit() are called every time a game is started and stopped (game over or you press ESC and confirm). Constructor and destructor are effectively the same because the DLL are loaded and unloaded dynamically all the time. So basically they are called more often than Init() and DeInit(). At the start of the program the list is created so that's once, and then when you play a game or go to game settings (if the game supports that), the dll is also loaded and then freed when not needed anymore. So basically if you want to load your own config before the game is started (i.e. to know how to construct the settings dialog), you can do it in the constructor. Just make sure you clean up in the destructor...

--
sig used to be here

Mordredd
Member #5,291
December 2004
avatar

Can you make it using Openlayer?

miran
Member #2,407
June 2002

Probably no. Besides, OpenLayer doesn't work on Linux. At least not on mine...

I could probably make it use plain OpenGL though. Without anyone even noticing too...

--
sig used to be here

Audric
Member #907
January 2001

Do we start considering the 800x600 15-16-32bpp a constant ?
Some games are resolution-independant (I borrowed from kickups source code :P), but the host GUI is probably not, and now would be a right time to question the standard before people start writing/porting more games.

By the way, I was unable to get color conversion to work right :
But since even blitting from a 16bpp dbuffer to 16bpp canvas gave wrong colors, it's probably my mistake somewhere. Once I converted the sprites to 16bpp, everything worked :-/

miran said:

the target framerate is the same as logic framerate, which is 100 Hz by default (you can change that in the ini but you better not, because some of the games are written specifically for 100 FPS

I think each game should be able to select an other number of logic updates per second (LUPS?) than the default 100, even adjust the speed during the game itself (it's a cheap and clean way to make a Tetris go faster and faster, for example)
But games should only do it through a setter from the base class (non-derivable), like "void IGame::SetSpeed(int)" : This way, the "host" amgc code can prevent games from doing stupid things like setting LUPS<=0 (game hopelessly frozen) or LUPS=5000.

miran (about savedata) said:

Better just use your own file, like blocks.cfg and then use the normal Allegro config functions

Hadn't thought of that. I can even encrypt the value in a ascii-friendly format, if I'm freaking about security: "LastLevel = AS4f2nd0s54"

miran said:

Wow, that's a lot of levels

They are much shorter than your typical sokoban puzzles, there's probably like half an hour of gameplay. A few of the last levels are even duplicates, I'll try to clean up.

miran
Member #2,407
June 2002

I wouldn't change the resolution. It wouldn't be difficult to addapt the GUI to work at all resolutions but I think it's better to have a fixed resolution. Otherwise things just get too complicated. About LUPS I think there's no real need to change that. 100 is a good number and should work for most games. If you need to change speed, just install a second timer, just like my Tetris. And if you want to change the gfx framerate, just chnage that in the ini (it's not in the GUI yet), the FPS and LUPS are independant since 2.08...

Quote:

By the way, I was unable to get color conversion to work right :
But since even blitting from a 16bpp dbuffer to 16bpp canvas gave wrong colors, it's probably my mistake somewhere. Once I converted the sprites to 16bpp, everything worked :-/

Don't know what the problem is. The program runs at 32bpp by default (or it may go to 16bpp if your desktop colour depth is 16bpp and you run it in windowed mode). If you use the Allegro bitmap and/or datafile loading routines without doing anything special, Allegro should do the conversion at load time. If your gfx are 8bpp though, you must first load the palette...

--
sig used to be here

amarillion
Member #940
January 2001
avatar

Miran, if you are serious about the network play, I have two turn-based multiplayer games that I could port to the AMGC2 model (they are Magic Maze and Hexagon, from my site). I don't have any expertise to offer on how to implement the server etc. but these two games will be useful to have something for testing. And I'll help with testing, of course.

Are you aiming only at turn-based games? I recommend you do. Lag will be less of an issue, and it would be more feasible to have a single server that suits the needs from all allegroids all over the world. For real time games that would be impossible, and you'd end up with many regional servers with too few people logging in to make it interesting.



Go to: