Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » The 2004 Allegro ScreenHack

This thread is locked; no one can reply to it. rss feed Print
The 2004 Allegro ScreenHack
Karadoc ~~
Member #2,749
September 2002
avatar

Krzysztof, that is truely an impressive piece of coding.

-----------

zaphire
Member #1,273
September 2000
avatar

William: Yeah.. its hilarious. Not sure why the link isn't working, might have something to do with gamespot trying to kill Allegro.cc's frame code. For more information (like how the company hired russian programmers to do the coding - because they claim its cheaper) check out this thread: http://www.complexgames.com/forum/viewtopic.php?t=307

Thomas Fjellstrom
Member #476
June 2000
avatar

zaphire, uh no, its because you have the format for allegro.cc's links wrong :P its [URL addr]title[/URL] not [URL="addr"]title[/URL] (all lower case of course).

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

zaphire
Member #1,273
September 2000
avatar

Foiled again. ^_^ Maybe I should start getting some sleep soon... :\

Derezo
Member #1,666
April 2001
avatar

heheheh. That was well worth the read. Absolutely hilarious. Almost hard to believe they could do that bad.. like, no sound? No collisions? No racing in a racing game? No level boundaries? Geez. Unless it's included in a 99 cent bundle of 10 similar games, I just don't understand how something like that could ever get published ::)

"He who controls the stuffing controls the Universe"

zaphire
Member #1,273
September 2000
avatar

I love the reader reviews...the guy who examines its possible artist interpretations is right on.

"What is the point of even trying? comes a plaintive cry from Big Rigs. The answer is apparent. There is no point.

Time to lay down and die. This comment on society is driven home (or in fact, not driven at all) even further by the computer AI. It doesn't even leave the starting gate. Much like the dreams and aspirations we harbour as youth, reving our engines on a starting line where the crack of the pistol never comes. Meanwhile, those of privledge cruise to easy victory, unconcerned over such mundane things as rent or grocery bills or collideable landscapes. The societal implications here in the game are staggering."

Yet further proof that Video Games = Art. (not that I needed any)
:P

Billybob
Member #3,136
January 2003

Funny, yet my brain has left my head and is now eating itself over trying to understand why this was ever released as a game? It's worse than looking at the Windows code(which will corrupt anything you code from that point on). Just...just...horrible...

This isn't art, this is pure agony.

zaphire
Member #1,273
September 2000
avatar

It can't not be art... but it can be bad art.

Zaphos
Member #1,468
August 2001

zaphire: You'd probably enjoy lucky wander boy -- it's a book in which the main character reviews old video games in that style (as well as doing many other things, but the video game reviews are central to the plot). For example, in the midst of a Donkey Kong review, we get lines like: "It is difficult to ignore the similarities between Donkey Kong (the creature) and the demiurge of the Gnotic heresies." ... great wtf factor, there.
(And aside from that, it's just a good book)
(Oh, and it's by d. b. weiss)

And yeah, that review (the truck one you pointed out) is awesome.

lillo
Member #303
April 2000
avatar

Sorry for the delay... I checked this thread the day after I posted my entry, and found no feedback, and I checked it again only yesterday. So since then I've hacked my code a bit to make it work on Windows too (I coded it under MacOS X and it worked fine under it; it was a matter of a D+*l++ expression that under Win didn't work as it was meant to... weird), and as I was there I also improved the "packing" of the code, allowing me to add proper collision detection between enemies and player... so the player can now die and the game end :)
No space to add proper score keeping though :(

Anyway, here it is (again):

1#include <allegro.h>//Monospace Shooter 80x25 lines, in memory of Milo Sedlacek
2BITMAP*b[5],*r;char*d;volatile int t,E,i,j=0,x,y,L,p,f,*l,W=320,H=200,D[]={10,\
3648,15,657,26,717,35,165,36,322,-1021313012,-2122071033,1597440,25149544,67100\
4736,8192,103284803,-1032834184,-2121207582,1644691152,133308448,-288325278,-10\
532810256,3373058,1124075048,8192,3145728,871893760,272880001,360844072,1217207\
6235,-1444069639,805047120,7356545,8384526,22511061,955345};void T(){t++;}BITMAP
7*G(int*g,int s){j=0;x=s&31;s/=32;r=create_bitmap(s,x);x*=s;d=r->dat;for(;x;x--,
8d++){*d=0;if(*g&(1<<j))*d=11;++j>31?j=0,g++:0;}return r;}void main(){struct{int
9t;float x,y,v,h;}e[W],*m=e+100,*o=e+H,*C,*M,*X,N={0,};allegro_init();install_k\
10eyboard();install_int(T,15);set_gfx_mode(0,W,H,0,0);for(i=0,l=D;i<5;i++,l++)b[i
11]=G(D+*l,*(++l));l=D;r=create_bitmap(W,H);t=x=f=p=0;y=L=E=96;memset(e,0,sizeof(
12e));while(E){clear(r);for(i=99,C=o,M=m;i;i--,C++,M++){j=rand();if(!C->t&&i<80)C
13->t=1,C->x=W,C->y=j%H,C->v=-(j%9)/6.-1;if(C->t&1)putpixel(r,C->x,C->y,11);if(C\
14->x<0)*C=N;if(C->t&2){circlefill(r,C->x+5,C->y+5,MIN(C->h,15),11);C->h>15?circ\
15lefill(r,C->x+5,C->y+5,C->h-15,0):0;C->h++;if(C->h>30)*C=N;}C->x+=C->v;if(!M->t
16&&key[75]&&!f)f=15,*M=N,M->t=1,M->x=x+f,M->y=y+3,M->v=3;if(M->t){M->x>W?M->t=0:
170;draw_sprite(r,b[4],M->x,M->y);for(j=99,X=e;j;j--,X++)if(X->t&&M->x+9>X->x&&M\
18->x<X->x+21&&M->y>X->y&&M->y<X->y+16)X->t=2,X->h=0,*(X+H)=*X,*M=*X=N;}M->x+=M->
19v;}for(i=99,C=e;i;i--,C++){C->t?draw_sprite(r,b[C->t],C->x,C->y):0;C->t==2?C->y
20+=sin(C->h):0;C->h+=.02;C->x+=C->v;if(C->x<-20)*C=N;if(E>0&&x+15>C->x&&x-15<C->
21x&&y+9>C->y&&y-9<C->y)o->t=2,o->h=0,o->x=x,o->y=y,E=-E;}E>0?draw_sprite(r,*b,x,
22y):0;blit(r,screen,0,0,0,0,W,H);for(t=0;!t;);L--;if(!L){L=*l;C=e+p;for(i=16;i;i
23--,L/=4,C++){*C=N;C->t=L&3;C->x=W+(i%4)*24;C->y=((i/4)*50+C->t*25)%H;C->v=-3./C
24->t;C->h=p;p++;p>99?p=0:0;}L=E;l++;l>D+36?l=D:0;}f?f--:0;E<0?E++:0;if(key[82]&&
25x)x--;if(key[83]&&x<W)x++;if(key[84]&&y)y--;if(key[85]&&y<H)y++;}}END_OF_MAIN()

Arrows to move, space to fire. To end the game, you must die ;)

--
Angelo Mottola
lillo AT users DOT sourceforge DOT net
Enhanced Creations++

Zaphos
Member #1,468
August 2001

lillo: I can't see my avatar in the game; the starfield and enemies seems to work fine, as do collision and firing as I can make stuff exploded and can die myself, but I have no idea where my guy is.

lillo
Member #303
April 2000
avatar

humm, it works fine under WinXP... I compiled the code with
gcc -s -O3 mono.c -o mono.exe -lalleg
and apart from two warnings it's ok. My gcc is 2.95.3-5 from an old MingW32 version.

Anyone else experimenting problems with my entry?

--
Angelo Mottola
lillo AT users DOT sourceforge DOT net
Enhanced Creations++

Zaphos
Member #1,468
August 2001

With those options I get:
gcc -s -03 blah.c -o blah `allegro-config --libs`
gcc: unrecognized option `-03'
blah.c: In function `_mangled_main':
blah.c:11: warning: passing arg 1 of `G' discards qualifiers from pointer target type

And the same bug regarding the player not appearing.
I can't actually see the player's shots either; I only presume they exist 'cause enemies blow up when I hold space.

I'm using "gcc version 3.3.3 20040125 (prerelease) (Debian)" and (of course) Debian linux.

Billybob
Member #3,136
January 2003

Zaphos:
-O3
as in, Oh Three. Not Zero Three.

Krzysztof Kluczek
Member #4,191
January 2004
avatar

lillo: Works fine on DJGPP. :) The only bug I`ve found is that player go outside the screen at bottom a bit and some score system could be great. Anyway, nice game with nice graphics. :)

Zaphos
Member #1,468
August 2001

WH: Ooop! :-[
It seems that when I compile with -O3 the program works perfectly! But when I compile without optimizations the sprites are garbled and there are no player / player bullets. Weird ... lillo is clearly doing something crazy in there ...
Good game, though! Nice gfx!
Edit: If one goes up at the very beginning, one seems to spontaneously combust ...

Billybob
Member #3,136
January 2003

lillo: Well I tried to compile it myself and got nothin but a load of errors. invalid conversions from void * to char*, memset undeclared, etc... Big list of errors. I'm using MinGW32 3.2.3 and the compiler options you specified.

EDIT: nm, changed filename to mono.c and compiled with gcc.

EDIT: wow, that's a great game for 80x25.

lillo
Member #303
April 2000
avatar

Attached is a new (the last, I promise!) version of my entry. I'm not inlining it as code not to bloat this thread even more than it already is... Anyway, I've had an idea on how to pack the source even more; my sprites data was stored as integer numbers... that take much space. So I converted them all to a big string and modified the sprite generation algorithm. The result is I saved 1 line and a half, and with some clever coding I used them to add score keeping, hi-score and game restart after you die. Oh, and mines now chase you :)
Have fun, and press ESC to quit at any time!

--
Angelo Mottola
lillo AT users DOT sourceforge DOT net
Enhanced Creations++

Ryan Broomfield
Member #3,126
January 2003

JEBUS! I <3 THIS ENTRY LILLO. You've got my vote unless i can vote for myself <3

shippay

Billybob
Member #3,136
January 2003

Is the compition over now? It's the 17th, didn't it end the 16th... I wanna know who wins ;D

Goodbytes
Member #448
June 2000
avatar

Nah, it's not over. Cause I'm not done my own entry.

Yeah, I'm taking advantage of my position. :)


--
~Goodbytes

CGamesPlay
Member #2,559
July 2002
avatar

Hehe. I have some syntax coloring code for my entry, but MSVC's debugger is offsetting everything in my code by 18 lines, so it's rather hard to debug it :)

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

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

Krzysztof Kluczek
Member #4,191
January 2004
avatar

Quote:

but MSVC's debugger is offsetting everything in my code by 18 lines

You could use #line macro.
#line <next-line-no> "<file-name>"

Well, maybe I`ll manage to finish my second entry. :)

lillo
Member #303
April 2000
avatar

ok, I promised not to post a new version again, but I discovered some bugs, and I had to fix them, you know ;D And on the way I also compressed the thing a bit more, to add a start and game over text... I could save another 2-3 characters but no way to use them, so I wasted them for alignment purposes 8-)

So I'm attaching it here; I feel authorized as the competition still has no deadline set... GoodBytes, are you still there?

--
Angelo Mottola
lillo AT users DOT sourceforge DOT net
Enhanced Creations++

Krzysztof Kluczek
Member #4,191
January 2004
avatar

Well, I don`t want to nitpick, but third line has 81 chars in it so I guess you`ll have to post again. :P

Anyway, still very nice game (but I think I liked teal color more). :)



Go to: