Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » MinorHack Attack!

This thread is locked; no one can reply to it. rss feed Print
MinorHack Attack!
Krzysztof Kluczek
Member #4,191
January 2004
avatar

Quote:

Does everyone agree, or propose an alternative?

There should be some kind of Overall category, so we can have clear winner of the compo, even if results in other categories differ. :)

CGamesPlay
Member #2,559
July 2002
avatar

I was thinking the primary winner would be the Quality field, with "Interesting" sort of being a consolidation prize (if someone doesn't win both!)

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

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

Krzysztof Kluczek
Member #4,191
January 2004
avatar

Quote:

I was thinking the primary winner would be the Quality field, with "Interesting" sort of being a consolidation prize (if someone doesn't win both!)

Then make category name suggest that. Even low quality games can win in overall ranking as long as they are fun to play. :)

Kikaru
Member #7,616
August 2006
avatar

I just noticed that it says on the site next competition is in two hours. According to my clock, it should be in one hour.

Krzysztof Kluczek
Member #4,191
January 2004
avatar

According to GMT clock and compo starting time on the site, it should just have started (it's 16:00 GMT now). :)

Kikaru
Member #7,616
August 2006
avatar

On-Site clock says 1 hr 55-58 min left.

Jakub Wasilewski
Member #3,653
June 2003
avatar

I think dividing the vote into categories is overcomplicating stuff. The rules are simple, the games are simple, and the voting should also be simple. Otherwise we will end up with Oscar-like setup with "best character drawn with only squares", "best story", "best controls", "best red mean-eyed enemy" and "best golf game with badgers".

Okay, enough exaggeration... I think that one rating is good enough.

---------------------------
[ ChristmasHack! | My games ] :::: One CSS to style them all, One Javascript to script them, / One HTML to bring them all and in the browser bind them / In the Land of Fantasy where Standards mean something.

Krzysztof Kluczek
Member #4,191
January 2004
avatar

Quote:

This is a list of the competitions that are currently scheduled to run. Times are in the time zone GMT . Click on the current competition for a countdown timer.

* September 16th at 4:00 pm

Considering this and GMT time, competition should be running just now. :)

EDIT:

Quote:

Okay, enough exaggeration... I think that one rating is good enough.

Seconded.

Kikaru
Member #7,616
August 2006
avatar

Quote:

This is a list of the competitions that are currently scheduled to run. Times are in the time zone UTC. Click on the current competition for a countdown timer.

September 16th at 6:00 pm

That's what mine says. :)

[EDIT]
When switched to GMT time, nothing changes.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

Okay, enough exaggeration... I think that one rating is good enough.

So be it then ;)

I ranking, using the same scoring method as last competition.

As far as the system time goes... 6 p.m. EST is 1800 GMT. This is the time that it has been scheduled at for the past week ::) The countdown on the site agrees with itself, which is all that is important AFAIC.

[append]

Krzysztof: You have "GMT +2", which is getting cut off by the php timezone output. Time zones. Those are underscores, not spaces. (I would have linked to this earlier but php.net has been down)

I wish I had a better time zone selector, but until you write me one, you gotta use that.

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

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

Kikaru
Member #7,616
August 2006
avatar

I worked out that the MinorHack is at 2:00 EST, even though the site says 1:00 EST.

CGamesPlay
Member #2,559
July 2002
avatar

EST is not in Daylight Savings Time, like America/New_York is. See what I said to relpatseht. You could manually set it to EDT also. See my append above.

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

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

Kikaru
Member #7,616
August 2006
avatar

Oh. OK. "The MinorHack is approaching." reloads gun

CGamesPlay
Member #2,559
July 2002
avatar

Okay, the Allegro binaries on the Allegro.cc files section don't work for MSVC 8. Just thought you should know ;)

[append]
The 7.1 binaries appear to work with MSVC 8 though.

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

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

Onewing
Member #6,152
August 2005
avatar

Okay, so I haven't read this thread in a while. Someone want to sum it up for me? Anything new I should know about the competition starting in seven minutes?

------------
Solo-Games.org | My Tech Blog: The Digital Helm

CGamesPlay
Member #2,559
July 2002
avatar

Nope!

We will grade using the same system as last time. The web site has log in support but the time zone selector sucks. The web site also has an entry upload form, as well as the ability to manage your old entries (add new revisions, etc). Let me know if you need a certain entry to be listed as C, as they are all C++ right now and you can't change it through the web.

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

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

Jakub Wasilewski
Member #3,653
June 2003
avatar

No :P.

---------------------------
[ ChristmasHack! | My games ] :::: One CSS to style them all, One Javascript to script them, / One HTML to bring them all and in the browser bind them / In the Land of Fantasy where Standards mean something.

Onewing
Member #6,152
August 2005
avatar

that'll do!

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Jakub Wasilewski
Member #3,653
June 2003
avatar

Seems I'm dropping out this time. What I did wrong:

- I had an image of the game I want to do before the competition rule was announced, which wasn't very smart
- Because it was an idea I thought for a while about, it was too elaborate to fit in the one-hour timeframe, and changing the idea to fit the rule wasn't too easy

All in all, I tried to do too much in too little time and failed miserably. I don't think the game would do well even if I did finish it, though, as it wasn't anything ground-breaking and didn't even prove to be all that fun. Well, good luck to fellow contestants ;).

---------------------------
[ ChristmasHack! | My games ] :::: One CSS to style them all, One Javascript to script them, / One HTML to bring them all and in the browser bind them / In the Land of Fantasy where Standards mean something.

Kikaru
Member #7,616
August 2006
avatar

I'm finished! Hurray! :D :D :D

Entry uploaded to the site. I attached my source here as well.

Onewing
Member #6,152
August 2005
avatar

[edit] Ooops, guess I needed to upload the entry to the site, eh?[/edit]

Ok, now to actually play my game. :o

[code]
// Entry for MinorHack at September 16th, at 6:00 UTC
// Submitted by Onewing
// Compile with allegro!
#include "allegro.h"
#include<stdio.h>
#include<string.h>

/**************** DEFINES & MACROS *************/
#define BPP 32
#define MODE GFX_AUTODETECT_WINDOWED
#define GFX_W 640
#define GFX_H 480
#define MAX_BLOCKS 1000

/*************** CONSTANTS ********************/
#define MASK makecol(255,0,255)

/*************** GLOBAL ********************/
volatile int system_time;
volatile int ticks;
volatile int framerate;
volatile int draw_ticks;
PALETTE pal;
COLOR_MAP trans_table;
BITMAP *buffer;
BITMAP *bText;
int iTimer_Speed;
int iFrameRate;
int quit;
int over;

#define MAX_SLOGANS 10
#define MAX_CARDS MAX_SLOGANS * 2
char cText[MAX_SLOGANS][2][100];
int iText[MAX_SLOGANS][2];
int cards_showing;
int card_timer;
int score;
int intensity;
int gfx_timer;
bool up;

void timer1(void)
{
system_time++;
}END_OF_FUNCTION(timer1);

void frametimer(void)
{
framerate = draw_ticks;
draw_ticks = 0;
}END_OF_FUNCTION(frametimer);



void init()
{
// Allegro Library
if(allegro_init() != 0)
{
allegro_message("ERROR: Failed to initialize allegro library. Terminating program.\n");
allegro_message("REPORT: %s\n", allegro_error);
exit(0);
}


set_color_depth(BPP) ; // 24 bit colour
if (set_gfx_mode(MODE, GFX_W, GFX_H, 0, 0)<0)
{
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("ERROR: Failure to init video mode! Terminating program.\n");
allegro_message("REPORT: %s\n", allegro_error);
exit(0);
}


// Install Timer
if(install_timer() != 0)
{
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("ERROR: Failed to install timer. Terminating program.\n");
allegro_message("REPORT: %s\n", allegro_error);
exit(0);
}



// Install Keyboard
if(install_keyboard() != 0)
{
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("ERROR: Failed to install keyboard. Terminating program.\n");
allegro_message("REPORT: %s\n", allegro_error);
exit(0);
}

/*install_joystick(JOY_TYPE_AUTODETECT);
poll_joystick();
if(num_joysticks == 0)
{
allegro_message("NOTE: No joystick could be found, but you can still use keyboard.");
}
startpos = joy[0].stick[0].axis[0].pos;*/


// Install Mouse
if(install_mouse() < 0)
{
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("ERROR: Failed to install mouse. Terminating program.\n");
allegro_message("REPORT: %s\n", allegro_error);
exit(0);
}

text_mode(MASK);
reserve_voices(32,-1); ///Reserves more channels of sound for us

// Install Sound
if(install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) != 0)
{
allegro_message("ERROR: Failure to install sound. Attempting to run without sound.\n");
allegro_message("REPORT: %s\n", allegro_error);
if(install_sound(DIGI_NONE, MIDI_NONE, NULL) != 0)
{
allegro_message("ERROR: Failed to install sound. Terminating program.\n");
allegro_message("REPORT: %s\n", allegro_error);
exit(0);
}
}

srand( (unsigned) time(NULL));

// Install Time Handler
LOCK_VARIABLE(system_time);
LOCK_VARIABLE(ticks);
LOCK_VARIABLE(framerate);
LOCK_VARIABLE(draw_ticks);
LOCK_FUNCTION(timer1);
LOCK_FUNCTION(frametimer);
iTimer_Speed = 60;
install_int_ex(timer1, BPS_TO_TIMER(iTimer_Speed));
install_int_ex(frametimer, BPS_TO_TIMER(1));
//install_int(timer1, 1000);

// Setup the buffer
buffer = create_bitmap(GFX_W, GFX_H);
bText = create_bitmap(GFX_W, GFX_H);

// Setup translucent table
create_trans_table(&trans_table, pal, 0, 0, 0, NULL);
color_map = &trans_table;
}

//**************** Classes ***********************
class CARD
{
public:
int x,y;
int w,h;
int iValue;
int iType;
bool lock;
bool show_text;

CARD();
~CARD();

void update();
void draw(BITMAP *bDisplay);
void init();
void flip();

void pick_slogan();
};

CARD::CARD()
{
init();
}

CARD::~CARD()
{
}

void CARD::update()
{
if(mouse_x > x && mouse_x < x + w &&
mouse_y > y && mouse_y < y + h &&
mouse_b & 1 && !lock)
flip();
}

void CARD::flip()
{
show_text = true;
cards_showing++;
lock = true;
score++;

if(cards_showing >= 2)
card_timer = ticks;
}

void CARD::draw(BITMAP *bDisplay)
{
if(!show_text)
{
rectfill(bDisplay, x, y, x+w, y+h, makecol(200,0,0));
rect(bDisplay, x, y, x+w, y+h, makecol(255,0,0));
rect(bDisplay, x+1, y+1, x+w-1, y+h-1, makecol(225,0,0));
}
else
textprintf_centre(bText, font, x+(w/2), y + (h/2), makecol(255,255,255), cText[iValue][iType]);
}

void CARD::pick_slogan()
{
int x = rand() % MAX_SLOGANS;
int y = rand() % 2;

while(iText[x][y] != 0)
{
x = rand() % MAX_SLOGANS;
y = rand() % 2;
}

iText[x][y] = 1;
iValue = x;
iType = y;
}

void CARD::init()
{
x = 0;
y = 0;
h = 0;
w = 0;
iValue = 0;
iType = 0;
show_text = false;
lock = false;
}

class CARDS
{
public:
CARD *cCards[MAX_CARDS];
CARDS();
~CARDS();

void update();
void draw(BITMAP *bDisplay);
void init();

void clear_cards();
};

CARDS::CARDS()
{
init();
}

CARDS::~CARDS()
{
}

void CARDS::update()
{

if(cards_showing < 2)
{
for(int i = 0; i < MAX_CARDS; i++)
if(cCards[i] != NULL)
cCards[i]->update();
}
else
{
if(abs(ticks - card_timer) > 100)
{
card_timer = INT_MAX;
clear_cards();
}
}
}

void CARDS::clear_cards()
{
int index = -1, S1 = -1;
bool have_card = false;
for(int i = 0; i < MAX_CARDS; i++)
if(cCards[i] != NULL)
{
if(S1 == -1)
{
if(cCards[i]->show_text)
{
index = i;
S1 = cCards[i]->iValue;
}
}
else
{
if(cCards[i]->show_text && S1 == cCards[i]->iValue)
{
delete cCards[index];
delete cCards[i];
cCards[index] = NULL;
cCards[i] = NULL;
}
}
}


for(int i = 0; i < MAX_CARDS; i++)
if(cCards[i] != NULL)
{
have_card = true;
cCards[i]->show_text = false;
cCards[i]->lock = false;
}

if(have_card == false)
{
quit = true;
over = true;
}
cards_showing = 0;
}

void CARDS::draw(BITMAP *bDisplay)
{
for(int i = 0; i < MAX_CARDS; i++)
if(cCards[i] != NULL)
cCards[i]->draw(bDisplay);
}

void CARDS::init()
{
int size = 100;
int X = 10, Y = 10, W = size, H = size;
for(int i = 0; i < MAX_CARDS; i++)
{
cCards[i] = new CARD;
cCards[i]->x = X;
cCards[i]->y = Y;
cCards[i]->w = W;
cCards[i]->h = H;
cCards[i]->pick_slogan();

X += size + 10;
if(X > 630 - size)
{
X = 10;
Y += size + 10;
}
}
}

CARDS *cCard_Deck;

void create_slogans()
{
strcpy(cText[0][0], "We try harder."); strcpy(cText[0][1], "Avis");
strcpy(cText[1][0], "Go to work on an egg."); strcpy(cText[1][1], "Egg Marketing Board");
strcpy(cText[2][0], "Guinness is good for you."); strcpy(cText[2][1], "Guinness");
strcpy(cText[3][0], "Don't be vague. Ask for Haig."); strcpy(cText[3][1], "Haig Scotch Whisky");
strcpy(cText[4][0], "Happiness is a cigar called Hamlet."); strcpy(cText[4][1], "Hamlet");
strcpy(cText[5][0], "Heineken refreshes the parts other beers cannot reach."); strcpy(cText[5][1], "Heineken");
strcpy(cText[6][0], "Beanz Meanz Heinz."); strcpy(cText[6][1], "Heinz");
strcpy(cText[7][0], "It is. Are you?"); strcpy(cText[7][1], "The Independent");
strcpy(cText[8][0], "Just do it."); strcpy(cText[8][1], "Nike");
strcpy(cText[9][0], "Think small."); strcpy(cText[9][1], "Volkswagen");
strcpy(cText[10][0], "The ultimate driving machine."); strcpy(cText[10][1], "BMW");

for(int i = 0; i < MAX_SLOGANS; i++)
{
iText[i][0] = 0;
iText[i][1] = 0;
}
}

void game_init()
{
intensity = 0;
gfx_timer = 0;
up = true;
score = 0;
card_timer = INT_MAX;
create_slogans();
cards_showing = 0;
cCard_Deck = new CARDS;
show_mouse(screen);

}

void game_update()
{
cCard_Deck->update();
if(abs(ticks - gfx_timer) > 5)
{
gfx_timer = ticks;
if(up)
{
intensity++;
if(intensity > 255)
up = false;
}
else
{
intensity--;
if(intensity < 0)
up = true;
}
}

}

void game_draw()
{
clear(buffer);
rectfill(buffer, 0, 0, buffer->w, buffer->h, makecol(0, intensity,0));
rectfill(bText, 0, 0, bText->w, bText->h, makecol(255,0,255));
cCard_Deck->draw(buffer);
textprintf_centre(bText, font, GFX_W / 2, 5, makecol(255,255,255), "Sloganaugh");
textprintf(bText, font, 550, 460, makecol(255,255,255), "Flips: %d", score);
textprintf(bText, font, 10, 460, makecol(255,255,255), "Match the slogan with the company in the least amount of flips.");
draw_sprite(buffer, bText, 0, 0);
draw_sprite(screen, buffer, 0, 0);
}

void game_shutdown()
{
destroy_bitmap(buffer);
}



void play_game()
{
iFrameRate = false;
game_init();

while(!quit)
{
while(!key[KEY_ESC] && !over)
{
while(system_time && !over)
{
system_time--;
ticks++;
game_update();
}

draw_ticks++;
game_draw();

if(iFrameRate) textprintf(screen, font, 10, 10, -1, "%d", framerate);
}
quit = true;
system_time = 0;
ticks = 0;
}

game_shutdown();
}



int main()
{
init();

play_game();

return 0;
}
END_OF_MAIN()[/code]

------------
Solo-Games.org | My Tech Blog: The Digital Helm

CGamesPlay
Member #2,559
July 2002
avatar

I uploaded mine! http://cgamesplay.com/minorhack/entries/14

Its "slogan" is "Crikey!" I'm actually pretty happy with the entry as a whole. I didn't have a chance to add snapping crocs to the water, though ;)

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

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

Krzysztof Kluczek
Member #4,191
January 2004
avatar

OK, done. :) I haven't managed to make a playable game, but my entry should be quite interesting, anyway. :) As for slogan, "It can be done" should fit quite well. ;)

Again, I've used timeGetTime(), so Linux users should grab compatibility "winalleg.h" to emulate it. :)

Kikaru
Member #7,616
August 2006
avatar

Me need binaries. :'(

(aka, I don't think I have everything needed to compile it.)

[EDIT]
How do we judge them? I didn't see a button or anything...

CGamesPlay
Member #2,559
July 2002
avatar

Is Onewing gonna put his entry on the site? :)

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

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



Go to: