|
The 2004 Allegro ScreenHack |
GullRaDriel
Member #3,861
September 2003
|
Krzysztof Kluczek, either your source code is buggy and cannot be compiled or i am a donkey using gcc, but i can't be able to compile it, even when i turn off all access checking and warning. After testing all source code except allegro gl and Krzysztof one, i give my voice to Ryan game. "Code is like shit - it only smells if it is not yours" |
23yrold3yrold
Member #1,134
March 2001
|
Quote: It's a clone of Kablam! I think you mean "Kaboom!" ... -- |
Ryan Broomfield
Member #3,126
January 2003
|
yeah, kaboom. My bad shippay |
Krzysztof Kluczek
Member #4,191
January 2004
|
Strange, I compiled it under Linux Slackware 9 without problems and got it running smoothly. Here is my "makefile" (providing test.cpp is a source file): #! /bin/sh g++ `allegro-config --cflags` -c test.cpp g++ -o test test.o -lalleg -lpthread -s -lm -ldl -export-dynamic I tried other ways to compile it and yes, I didn`t manage to compile it using Linux gcc and I tried both .c and .cpp extensions. I guess, the reason it may crash is using GFX_VGA 320x200 8-bit mode. I guess it isn`t using SVGA-Lib under Linux, so it might have failed on some systems (I was running as a root on my system since I was too lazy to configure Allegro properly and X-Windows aren`t properly set on my system). Since game has no failure checks, it can crash this way. Also I don`t know, if all compilers will understand definition of m[90][90]={} and clear entire array at startup, since I don`t know if such behavior is ANSI standard. Well, if the reason is GFX_VGA, I`ll try to switch to GFX_AUTODETECT and 320x240x8, so it should run. And thanks everybody for opinions and testing. ________ |
Thomas Fjellstrom
Member #476
June 2000
|
Krzysztof: the X11 driver is default on my system, modes that the XWFS driver (does full screen X11 modes) can't handle get done by the XWIN driver (does windowed X11 modes). edit: ouch, yeah, not checking set_gfx_mode for failure will result in a nice crash... maybe set to GFX_AUTODETECT... -- |
Krzysztof Kluczek
Member #4,191
January 2004
|
Quote: ouch, yeah, not checking set_gfx_mode for failure will result in a nice crash... Especially when using GFX_VGA, which is described in help as a DOS/Linux console mode and probably isn`t supposed to run under X. Ok, I squeezed pit-falling routine a bit and managed to insert GFX_AUTODETECT. It should run now. Of course the level has also changed a bit, but there are still 150 coins and all of them are available.
________ |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: which is described in help as a DOS/Linux console mode and probably isn`t supposed to run under X. A linux console program "can" be launched from inside X... AFAIK. I just don't have any of the console drivers setup -- |
Krzysztof Kluczek
Member #4,191
January 2004
|
I don`t think, console drivers would expect the program changing graphics mode to VGA. Anyway, is it running now? ________ |
Billybob
Member #3,136
January 2003
|
Ok, I've squeezed my code even more and I was able to make some major improvements! I took some tips from marcello's code(replacing decimal numbers with variables). I replaced a non-portable number with it's proper GFX_OPENGL_WINDOWED. That means this code can now probably run under Linux, although I haven't tested. I'll test as soon as I can for all you Linux people, so expect more news. I also added END_OF_MAIN() for more comptablitiy and the types to a variable and main. The code now compiles under MinGW and MSVC. Attached is the entire package. The source for the 80x25 version, the source for the original source code(before squeezing), the batch file for building under MinGW(probably DJGPP as well), and an already built exe. I hope this update will allow more people to play my game, especially Linux users, since Linux rules.
|
CGamesPlay
Member #2,559
July 2002
|
Ryan: Take out my comments and mine is smaller -- Ryan Patterson - <http://cgamesplay.com/> |
Billybob
Member #3,136
January 2003
|
Krzysztof Kluczek: Awesome game. I was able to compile it just fine(MinGW32). Very interesting how you used your own sourcecode as the map, heh. I wouldn't have imagined a raycaster would fit in 80x25, but I guess it does!
|
Goodbytes
Member #448
June 2000
|
Well, the competition is progressing nicely My own entry is currently being worked on... i.e. not started yet |
Krzysztof Kluczek
Member #4,191
January 2004
|
Well, my program is a bit hacky raycaster since it only draws floors using base/y*cos() and base/y*sin() to determine tile position. If a tile contains a wall the rendering is ended and if it contains a pit rendering floor is delayed. As a result, rendering walls isn`t very much accurate especially at edges (it is possible to look through walls that have one common point, which true raycaster won`t allow). Pit-falling routine is even more hacky since I`m just copying bottom screen line up the screen using such a speed, that it`s possible to see that something is moving but impossible to see how it is done. And I used source as a map since it`s the easiest way to be sure that all coins can be reached. I think I`ll start working over my next 80x25 game. Multiple entries are allowed AFAIK. btw. Goodbytes, have you posted a news about this contest on Allegro.cc? ________ |
Radagar
Member #2,768
September 2002
|
Krzysztof Kluczek, I get all types of Syntax errors when I try to compile your program in MSVC. It complains about a ton of stuff... Complains about missing semicolons and newlines in constant strings, etc. ------------ |
Krzysztof Kluczek
Member #4,191
January 2004
|
Probably MSVC doesn`t understand escapes at the end of some lines (the only explain for unterminated string). Missing semicolons etc. could be results of error recovery after hitting that backslashes. I`ll try to fix that. This program compiles under gcc with only double->int conversion warnings. (still you could change the file manually and join these escaped lines, just let it read from the old source) edit: here`s the code without those backslashes:
________ |
Billybob
Member #3,136
January 2003
|
I use backslashes in my most recent code, and that compiled under MSVC & MinGW32...so not sure why your code wouldn't compile.
|
LSd016
Member #3,561
May 2003
|
Nothing special.
you only need to hold the mouse button, it's better that way. ____________________________________________ |
Freke
Member #3,393
April 2003
|
LSd016: It complained about the mem.h not being found, but when that include was removed it compiled fine. |
Krzysztof Kluczek
Member #4,191
January 2004
|
Quote: you only need to hold the mouse button, it's better that way. Especially if your mouse pointer is in the middle of the screen. I`ve got 5107 that way. I compiled it under DJGPP and it complained about return without a value. I fixed it and everything else is ok. ________ |
LSd016
Member #3,561
May 2003
|
Freke: You got a strange compiler, I thought mem* functions had always been in mem.h. [edit] Quote: Especially if your mouse pointer is in the middle of the screen. I`ve got 5107 that way. But you can't go with this forever. Anyway, maybe I'll make something better tomorrow. ____________________________________________ |
Krzysztof Kluczek
Member #4,191
January 2004
|
DJGPP libc help says, mem* are in <string.h> ________ |
Ryan Broomfield
Member #3,126
January 2003
|
http://www.shippysite.com/screen2.gif UPDATE I just realized that this game is only 20 lines, so it would qualify for that 20 line compo too.
shippay |
Carrus85
Member #2,633
August 2002
|
The only thing I can say, is if you are still running into size problems, couldn't you make your code smaller (on the screen, anyway) by preresolving all of the constants? Also, why not add the comma in your circlefill, rectfill, and text printf functions up above? That way you are only using one comma, instead of one occurance of a comma every function call... (besides, you have tons of room up above by your compiler command things (sorry, can't remember exact term right now, oy...))... heck, you could even through in a semicolon to the beginning of you compiler define, so it looks like... #define C ;circlefill(screen,
Think of all that wonderful space you are saving! (True, this wouldn't necessaryily work, but it should in theory.) EDIT--- heck, if compiler defines worked that way, you could do something like #define db double #define el else #define f if ( #define ei else if but then again, you would be lengthening the program by doing that... too bad you can't stack preprocessor commands... I'm dumb!... this could get real interesting
|
gnolam
Member #2,030
March 2002
|
Carrus: It would work better with macros, but since #defines waste a whole line each I'd use function pointers instead -- |
Elias
Member #358
May 2000
|
You don't have to waste a full line with #defines. Just see how I used them, both #defines are about 80 characters. It worked like this: #define A(x,y,z) z?long_func_1(x,y):long_func_2(x,y)
Of course, the extra z param wastes some space, but for me I saved quite some lines with it -- |
|
|