|
The 2004 Allegro ScreenHack |
Billybob
Member #3,136
January 2003
|
I updated my first post so that it has my latest code. I squeezed it even more by replacing two defines with functions. I got a goodly amount of room to maybe put another small feature in...but I'm not sure what to put in?
|
zaphire
Member #1,273
September 2000
|
Wow... this was strangely amusing, in a very disturbing way. Anyways, here's my mini version of NiM.
Player1 Player2 This was built with MSVC6, so I may be benefiting from M$'s lack of compliance with ANSI standards in the scoping department. ------- |
CGamesPlay
Member #2,559
July 2002
|
What, you think making it a struct suddenly means it's not OO? You think a struct can not have polymorphism, static members, or anything a class can't? You're the second person to have done that in this thread. You people are weird. -- Ryan Patterson - <http://cgamesplay.com/> |
zaphire
Member #1,273
September 2000
|
Structs in C++ are just wrappers to public classes; but it still feels gross to use them. The point I was making was that there just wasn't enough room for the OOP hierarchy I had in mind. (a base positional object, a particle class and a class for moving on a bitmap derived from that, derive Bullet and Worm classes from the movement class, derive Human and AI control classes from that etc) The lack of space forced me to use non-OOP solutions which I wouldn't have used otherwise. Yes, I could have derived to my heart's content, if there had been room to do so while still being able to implement the basic things that I wanted to have in there. So yeah, it was fun coming up with the smallest solutions, rather than the fastest/easiest to develop. ------- |
Fladimir da Gorf
Member #1,565
October 2001
|
I figured out I may not have time to continue my screenhack until next week. Well, the code's 26.2 lines now (about 25 if you don't count the damned first line ), but I'll figure out eventually how to compress the code even further. And no, I won't strip out any graphics.
Gameplay: Hints: Issues: OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
Chris Katko
Member #1,881
January 2002
|
Quote: What, you think making it a struct suddenly means it's not OO? You think a struct can not have polymorphism, static members, or anything a class can't? Private and protected members? Perhaps? -----sig: |
Zaphos
Member #1,468
August 2001
|
Etwinox: In C++ they a struct is allowed to have private and protected members. It just defaults to public.
|
Goodbytes
Member #448
June 2000
|
zaphire: Man, is it just me, or have you not posted here in like... either forever or a really long time? Keep up the Canadian gamedev bit! Here's another "looks like the compo is progressing nicely" bit. I suppose I'll have to eventually draw the line somewhere... So let's say that the deadline for a completed entry is Monday, February 16 2004. I realize that with time zones, that's a bit nonspecific, so... just try to have your entries in by around then, because that's probably about when we'll start the judging process. If you delay it past that time, you might run into some problems wherein I'll already have made the archive and can't be arsed to add your entry to it. Fladimir: but maybe I'll give you some extra time if you need it. (unable to finish until next week you said?) |
zaphire
Member #1,273
September 2000
|
No... I haven't posted here in ages... ------- |
Thomas Fjellstrom
Member #476
June 2000
|
I like that.. Extream Curling. Deffinitly a Canadian company -- |
23yrold3yrold
Member #1,134
March 2001
|
zaphire: Sweet. We'll get Josh Bolduc back and make Winnipeg the next Silicon Valley. -- |
zaphire
Member #1,273
September 2000
|
I'm dumb!... ------- |
Fladimir da Gorf
Member #1,565
October 2001
|
Goodbytes said: Fladimir: but maybe I'll give you some extra time if you need it. (unable to finish until next week you said?) Yeah, that's true... I'm busy during the week and away most of the weekend. How about the next Wednesday? OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
lillo
Member #303
April 2000
|
Hi all, nice entries here! I finally found the time and finished my own one... Here it is:
Yes, it's a (very) stripped down version of the old Monospace Shooter (for those who don't know it, it's a QB game by Milo Sedlacek, who passed away some years ago). Arrow keys to move, space to fire, ESC to exit. Feedback is welcome! -- |
23yrold3yrold
Member #1,134
March 2001
|
Quote: There's something about being able to develop in an environment in which you can freeze to death on any given day that just makes it magical. "Magical" ... that's not exactly the word that went through my mind when I woke up to -54C 2 weeks ago Mind you, I imagine my Win98 box freezes in any given environment anyway -- |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: "Magical" ... that's not exactly the word that went through my mind when I woke up to -54C 2 weeks ago And I thought the -38c we got a couple weeks ago was bad... Sure with windchill it was -50c... The entire week it was -50c with windchill.. Damn cold -- |
23yrold3yrold
Member #1,134
March 2001
|
Yeah, that -54C is with the windchill. Before then, I'd never seen it go past -44C in Winnipeg. Then it hit -48C, then -50C (couldn't believe it; halfway to double digits), then -54C (#@&%!!) ... oy. Anyway, enough OT ... -- |
zaphire
Member #1,273
September 2000
|
Winnipeggers are just bred tougher because of the harsh conditions; henceforth we can survive through equally harsh crunch times. ------- |
Matthew Leverton
Supreme Loser
January 1999
|
This was written for 20 semi's or less, so it doesn't fit in 25 lines. (Only 16 semi's, and no cheating using commas to execute multiple functions...) 1#include <allegro.h>
2#define B(x,y) b->line[x][y]
3#define P (B(22,7))
4#define R (B(22,8))
5int p[7][4][4][2]={{{{0,0},{0,1},{1,0},{1,1}},{{0,0},{0,1},{1,0},{1,1}},{{0,0},{
60,1},{1,0},{1,1}},{{0,0},{0,1},{1,0},{1,1}}},{{{0,0},{1,0},{2,0},{3,0}},{{0,0},{
70,1},{0,2},{0,3}},{{0,0},{1,0},{2,0},{3,0}},{{0,0},{0,1},{0,2},{0,3}}},{{{1,0},{
80,1},{1,1},{2,1}},{{0,0},{0,1},{1,1},{0,2}},{{0,0},{1,0},{2,0},{1,1}},{{1,0},{0,
91},{1,1},{1,2}}},{{{2,0},{0,1},{1,1},{2,1}},{{0,0},{0,1},{0,2},{1,2}},{{0,0},{1,
100},{2,0},{0,1}},{{0,0},{1,0},{1,1},{1,2}}},{{{0,0},{0,1},{1,1},{2,1}},{{0,0},{1,
110},{0,1},{0,2}},{{0,0},{1,0},{2,0},{2,1}},{{1,0},{1,1},{0,2},{1,2}}},{{{0,0},{1,
120},{1,1},{2,1}},{{1,0},{0,1},{1,1},{0,2}},{{0,0},{1,0},{1,1},{2,1}},{{1,0},{0,1}
13,{1,1},{0,2}}},{{{1,0},{2,0},{0,1},{1,1}},{{0,0},{0,1},{1,1},{1,2}},{{1,0},{2,0}
14,{0,1},{1,1}},{{0,0},{0,1},{1,1},{1,2}}}};int main(void){BITMAP *b;if(
15allegro_init()?1:set_gfx_mode(GFX_AUTODETECT_WINDOWED,192,352,0,0)<0?1:
16install_timer()<0?1:install_keyboard()<0?1:!(b=create_bitmap_ex(8,SCREEN_W,
17SCREEN_H+50))?1:0)return 1;clear(b);rect(b,0,0,11,21,makecol(255,0,0));B(22,8)=(
18B(22,7)=(time(NULL)+(B(22,1)=(B(22,2)=1)+4))%7)*0;while(!key[KEY_ESC]&&B(22,0)==
190){while(retrace_count){if((B(22,1)+=(key[KEY_LEFT]&&!(B(22,4)%4)&&!(B(B(22,2)+p
20[P][R][0][1],B(22,1)+p[P][R][0][0]-1)+B(B(22,2)+p[P][R][1][1],B(22,1)+p[P][R][1]
21[0]-1)+B(B(22,2)+p[P][R][2][1],B(22,1)+p[P][R][2][0]-1)+B(B(22,2)+p[P][R][3][1],
22B(22,1)+p[P][R][3][0]-1))?-1:key[KEY_RIGHT]&&!(B(22,4)%4)&&!(B(B(22,2)+p[P][R][0
23][1],B(22,1)+p[P][R][0][0]+1)+B(B(22,2)+p[P][R][1][1],B(22,1)+p[P][R][1][0]+1)+B
24(B(22,2)+p[P][R][2][1],B(22,1)+p[P][R][2][0]+1)+B(B(22,2)+p[P][R][3][1],B(22,1)+
25p[P][R][3][0]+1))?1:0))&&(B(22,2)+=((!(B(22,4)++%32)||key[KEY_DOWN])&&!(B(B(22,2
26)+p[P][R][0][1]+1,B(22,1)+p[P][R][0][0])+B(B(22,2)+p[P][R][1][1]+1,B(22,1)+p[P][
27R][1][0])+B(B(22,2)+p[P][R][2][1]+1,B(22,1)+p[P][R][2][0])+B(B(22,2)+p[P][R][3][
281]+1,B(22,1)+p[P][R][3][0]))?1:0))&&(1+(B(22,8)=(B(22,8)+((key[KEY_UP]&&!(B(22,4
29)%4)&&!(B(B(22,2)+p[P][(B(22,8)+1)%4][0][1]+1,B(22,1)+p[P][(B(22,8)+1)%4][0][0])
30+B(B(22,2)+p[P][(B(22,8)+1)%4][1][1]+1,B(22,1)+p[P][(B(22,8)+1)%4][1][0])+B(B(22
31,2)+p[P][(B(22,8)+1)%4][2][1]+1,B(22,1)+p[P][(B(22,8)+1)%4][2][0])+B(B(22,2)+p[P
32][(B(22,8)+1)%4][3][1]+1,B(22,1)+p[P][(B(22,8)+1)%4][3][0]))?1:0)))%4))&&(!(B(22
33,4)%32)&&(B(B(22,2)+p[P][R][0][1]+1,B(22,1)+p[P][R][0][0])+B(B(22,2)+p[P][R][1][
341]+1,B(22,1)+p[P][R][1][0])+B(B(22,2)+p[P][R][2][1]+1,B(22,1)+p[P][R][2][0])+B(B
35(22,2)+p[P][R][3][1]+1,B(22,1)+p[P][R][3][0])))){B(22,3)=B(B(22,2)+p[P][R][0][1]
36,B(22,1)+p[P][R][0][0])=B(B(22,2)+p[P][R][1][1],B(22,1)+p[P][R][1][0])=B(B(22,2)
37+p[P][R][2][1],B(22,1)+p[P][R][2][0])=B(B(22,2)+p[P][R][3][1],B(22,1)+p[P][R][3]
38[0])=1;while(++B(22,3)<21)if(B(B(22,3),1)+B(B(22,3),2)+B(B(22,3),3)+B(B(22,3),4)
39+B(B(22,3),5)+B(B(22,3),6)+B(B(22,3),7)+B(B(22,3),8)+B(B(22,3),9)+B(B(22,3),10)\
40==10)blit(b,b,1,1,1,2,10,B(22,3)-1);if(1+(B(22,8)=(B(22,7)=(time(NULL)+(B(22,1)=
41(B(22,2)=1)+4))%7)*0)&&(B(B(22,2)+p[P][R][0][1],B(22,1)+p[P][R][0][0])+B(B(22,2)
42+p[P][R][1][1],B(22,1)+p[P][R][1][0])+B(B(22,2)+p[P][R][2][1],B(22,1)+p[P][R][2]
43[0])+B(B(22,2)+p[P][R][3][1],B(22,1)+p[P][R][3][0])))B(22,0)=1;}retrace_count=0;
44}rectfill(b,50,SCREEN_W,50+SCREEN_H,SCREEN_W,0);stretch_blit(b,b,(B(22,3)=0),0,\
4512,22,0,50,192,352);while(B(22,3)++<4){rectfill(b,(B(22,1)+p[P][R][B(22,3)-1][0]
46)*16,50+(B(22,2)+p[P][R][B(22,3)-1][1])*16,14+(B(22,1)+p[P][R][B(22,3)-1][0])*16
47,50+14+(B(22,2)+p[P][R][B(22,3)-1][1])*16,makecol(255,255,255));}blit(b,screen,0
48,50,0,0,SCREEN_W,SCREEN_H);}destroy_bitmap(b);return 0;}END_OF_MAIN()
|
Fladimir da Gorf
Member #1,565
October 2001
|
Lillo, I tried your game, but all I could see was a starfield, and if I pressed space, also explosions here and there. :/ Oh, and does your starfield really have a motion blur effect, or is it just my monitor doing tricks? OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: Lillo, I tried your game, but all I could see was a starfield, and if I pressed space, also explosions here and there. :/ Oh, and does your starfield really have a motion blur effect, or is it just my monitor doing tricks? Thats unfortunetly all I got as well no sprites, just a star field, bullets, and explosions. -- |
zaphire
Member #1,273
September 2000
|
Quote: Thats unfortunetly all I got as well no sprites, just a star field, bullets, and explosions. That's way more features than some commercial games. ------- |
Billybob
Member #3,136
January 2003
|
zaphire: your link is a little broken, I had to type it in manually. Anyway, that's funny stuff. What was going through that company's mind when they released that game? I guess maybe they thought people would buy it just so they could have a good laugh.
|
Marcello
Member #1,860
January 2002
|
Matt: could you compress that even more by grouping all those arrays into single numbers using bits? Marcello |
Matthew Leverton
Supreme Loser
January 1999
|
I know - the original restriction was just line numbers (semicolons), so I didn't bother with anything like that. It still contains a lot of other things that could be redone for char count. All I did above was use a couple #defines to shorten the code. I'm sure one could get an allegro tetris game in 25x80, but I don't have the time to waste at the moment... |
|
|