Allegro.cc - Online Community

Allegro.cc Forums » The Depot » My first game posted

This thread is locked; no one can reply to it. rss feed Print
My first game posted
AceBlkwell
Member #13,038
July 2011
avatar

Frank,

The previous thread must have locked. I can't add to it. In any case I was able to download, unzip, and run on a borrowed laptop. I didn't even need to log in

https://www.gamedev.net/forums/forum/28-your-announcements/

However, I've had luck uploading here. Let me know if this doesn't work for you. The post doesn't show the game, you have to click on the paperclip in this post. I can also upload the source code it anyone is interested.

Thanks again for looking,
Ace

Edgar Reynaldo
Member #8,592
May 2007
avatar

Attachments and images are working again. THANKS MATTHEW!!!!

{"name":"612128","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/f\/bf50d69c843c2465ed5e74c7b11ea0ed.png","w":640,"h":480,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/f\/bf50d69c843c2465ed5e74c7b11ea0ed"}612128

{"name":"612129","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/3\/8384cc373ae04989e4b579b742a152bd.png","w":640,"h":480,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/3\/8384cc373ae04989e4b579b742a152bd"}612129

AceBlkwell
Member #13,038
July 2011
avatar

Thanks Matthew. Thanks Edgar for the images.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Pesky dragon cornered me. Usu. it appears right next to me though. :/

Difficult, but enjoyable. I wish it accepted keyboard input a little faster though.

AceBlkwell
Member #13,038
July 2011
avatar

Thanks for the input Edgar. I had the dragon appear at random. It can appear close at times. Also as the code is, you can run into him before he awakes.

Probably before your time but the original board game he appeared in the treasure room once awoken. You still didn’t know where that was exactly,only that it was within the 3 block radius. You used a board piece to represent where you thought he was and moved him and you accordingly. I couldn’t really duplicate that. If I had him surface at the treasure, it would make the game too easy. Just lure him away and go get it. You do move 6 to his 1. So I opted for this way.

Also in the original he could move diagonal. I thought that made it too difficult.

Thanks again. Now that I can upload, I’ll load the source later tonight.

EDIT: as for the slow keys. Could just be improper keyboard set up on my part. I also put a couple clear key buffer and possibly a slight delay. In the beginning it was reading keys faster than I could remove finger causing the player to continue in a direction further than desired. I’m sure weak code.

Added Source code

LennyLen
Member #5,313
December 2004
avatar

The previous thread must have locked. I can't add to it.

It's not locked. You just can't add to it as you're the last person to post in it and the forum doesn't allow double posting.

AceBlkwell
Member #13,038
July 2011
avatar

You’re right. I should have edited my last entry like I have here. I’m sure why that didn’t occur to me. Thx for the heads up.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Ace, the problem with polling is that you're only looking at key states, (UP / DOWN) not state transitions (PRESS / RELEASE / HOLD / OPEN).

If you wanted to use my EagleClassic library it works with Allegro 4. It has all kinds of goodies for input.

For example, take a look at this :

https://github.com/EdgarReynaldo/EagleClassic/blob/master/include/Eagle/InputHandler.hpp

AceBlkwell
Member #13,038
July 2011
avatar

Thx for the heads up Edgar. I'll check it out. So this is a flaw with polling vs event driven? Just curious.

Edgar Reynaldo
Member #8,592
May 2007
avatar

The flaw with polling is that you miss state changes in between poll updates.

You can simulate event based with polling, but it still suffers the same problem.

Event based allows you to know the current state at any given time. It is vastly superior when available.

However, Allegro 4 has a key buffer for this very purpose. readkey blocks until a key is in the key buffer.

For example, suppose you had the following code, and mrest rests exactly that many milliseconds :

Polling, Allegro 4

while (!key[KEY_SPACE]) {
   mrest(250);/// 250 ms is exagerrating, but with an allegro timer
              /// set to 60HZ, you still rest approximately 16ms per frame
}
printf("continuuing.\n");

It might catch the space bar press, it might not. key[KEY_SPACE] is volatile, and changes based on Allegro's update thread. key[KEY_SPACE] could be false entering the loop, be pressed and released, and be false again before mrest(N) completes.

Key buffer, Allegro 4

do {
   key = readkey() >> 8;
} while (key != KEY_SPACE);

It exits immediately as soon as the space bar is pressed.

Allegro 5 key detection

do {
   ALLEGRO_EVENT ev;
   al_wait_for_event(queue , &ev);
   if (ev.type == ALLEGRO_EVENT_KEY_DOWN && ev.keyboard.keycode == ALLEGRO_KEY_SPACE) {break;}
} while (!al_is_event_queue_empty(queue));

AceBlkwell
Member #13,038
July 2011
avatar

Edgar, I do something similar in the game. The loop aspect is handled by the calling function

key_press = readkey();
key_press = key_press>>8;
clear_keybuf();

if(key_press == KEY_LEFT )
return(0);
if (key_press == KEY_UP)
return(1);
if(key_press == KEY_RIGHT)
return(2);
if(key_press == KEY_DOWN)
return(3);
if(key_press == KEY_Q)
return(4);
if(key_press == KEY_ENTER)
return(5);

Other than an occasional overrun of a direction, it does fair. However, I was trying to work out the logic of a baseball program. It waited on a key hit. Then depending on the timer status I gave a result. Late hit, opposite field, early hit, a pulled ball. If it doesn't fall within a given range, a negative result, strike, foul ball etc. In any case, it was then I seen the deficiency with Allegro 4 polling. To this point every program I've written just stopped and waited on user. (board game type games) but with the baseball game, when doing something while waiting, the polling can skip or react at differently each time, causing issues in the game.

I think I'm going to look at the Eagle lib, but most likely will graduate on to Allegro 5.

I checked out your Missile defense page. I used to have a 286 years ago. I had a 8086 prior to that. A IBM Microchannel. I have kept my IBM P70 luggable 386 with a 387 mathcoprocessor. Has 40 meg hard drive and 4 meg of ram. You'll have to Google it ;D. In any case I liked Missile Command as well. Remember playing it in the arcade. I tell you those Atari games with the track ball were a blast.

but I digress. thanks for the info.
Ace

Edgar Reynaldo
Member #8,592
May 2007
avatar

EagleClassic works with Allegro 4, but Eagle works with Allegro 5, and eventually will have an Allegro 4 driver.

Also, the missile defense I have up on my member website is way out of date, and slightly buggy. I've been working on a new version called Skyline.

https://www.allegro.cc/forums/thread/617398/1037444#target

Try 2e, it's my latest release

https://github.com/EdgarReynaldo/Skyline2/tree/master/distro

LMB and RMB control firing. ESC quits.

AceBlkwell
Member #13,038
July 2011
avatar

Edgar,

I checked out Skyline 2E. Pretty cool. The graphics and fluidity was awesome. I especially like the shield over the city. It reminds me of GORF. I have a Intellivision game called Atlantis. It’s a Missile Command variant except the cities are under water. It has shields over each city.

I liked the game play as well. The only game play difficulty I seen was the missile response was slower than I expected so my timing was off. I’m sure that would be something you could adjust to as you got more familiar with the game. Plus I was trying while at work so my attention and time was limited. ;D.

In any case it’s a well put together game. Have you had many hits with it?

I was also curious why you didn't use grabber to construct a single data file. Just personal preference or a functional issue. Lastly, is there a title screen in the works or not so much?

Edgar Reynaldo
Member #8,592
May 2007
avatar

Thank you for the feedback!

Yeah, I haven't worked on it in like 6 months. And my website is out of date too. I've just been working on tons of other things. It's still on my radar.

Yeah, the game is meant to be fully configurable, and extendable with any city skyline image in the right format. Did you look at the config file? There are a ton of options you can adjust in there.

Well, I wouldn't use grabber as that is allegro 4. I would use PhysFS and a .7z instead because Skyline was the Allegro 5 remake of my previous game.

Go to: