AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

C4 (Game with network capability)

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Zippo



Joined: 21 Apr 2006
Posts: 56
Location: East Coast, USA

PostPosted: Fri May 16, 2008 7:55 pm    Post subject: C4 (Game with network capability) Reply with quote

The game is a mock of Connect 4. If you've never played it: the object is to drop little round pieces into a tray and be the first to get four-of-a-kind in a line in any direction. A little more difficult than it sounds when you have a worthy opponent.

I needed a simple game to get an outline for a GUI I plan to use with other games. This one fit the bill so I cloned it. The artwork is just basic. Most of my time was spent on the GUI. If you don't like the graphics, fix them like you want and repost them Smile

I added network capability for playing it over a network (or internet). The code from that is from Zed Gecko's post: Client & Server Script for TCP/IP Network Communication. Thanks to Zed this didn't take me a lifetime. I'm grateful it was posted Smile

I'd like feedback on the game, particulary the GUI itself. I spent a lot of time on it (I hate making them so I thought I'd get that out of the way first thing). Opinions/criticism/bug reports are more than welcome. I'm planning to use it for more games, 1 of which is already in the skillet.

One thing that might happen if you have an older video card is that you will see white squares for graphics and get an error message posted to the chat window (did I mention it has chat?). If that happens it is because your video card cannot support the texture size I used. 60x60 isn't that big but it has made my other computers here not happy.

And that brings me to: I can't run this on my other computers, at least not the graphics part. I did fully test the chat and it works fine over LAN and WAN for me. I hope you have the same experience.

Something that I haven't been able to fix is the OpenGL window not updating while the game is waiting on a connection. I tried multithreading but it doesn't work well with this script for some reason. I have had it working before but no cookie this time.

Enough talk. Please try it and tell me what you think. A screenshot:



As this isn't a script as much as it is a project, I'll have to do the zip thing. As it has network code in it I didn't bother to compile it. You can do that yourself if you want. The link:

[edit]Update: The single download now contains both versions. If you have problems with running the regular C4, please try the C4_32 version.
http://www.autohotkey.net/~Zippo/opengl/c4.zip[/edit]

If the game has bugs (not the GUI), I'll fix them. But the GUI is my main concern. There is a good chance that it does as I couldn't test it over the network. I did test it on the same computer (you can run mutliple copies on the same computer as seen in the screenshot).

Almost forgot... click the balls and they drop into the tray. Very Happy

Enjoy!

Edit: Hooked the ChooseFont() and ChooseColor() dialogs to mantain the color theme of the rest of the GUI. A couple things need ironed out with that. I also still need to fix the problem with the GUI not updating while waiting on a connection; that'll be done soon thanks to Lexikos. Should be fully playable despite these minor things.
_________________
____________________


Last edited by Zippo on Mon May 19, 2008 9:06 am; edited 3 times in total
Back to top
View user's profile Send private message
SoggyDog



Joined: 02 May 2006
Posts: 280
Location: Greeley, CO

PostPosted: Fri May 16, 2008 9:51 pm    Post subject: Reply with quote

I haven't tried it out yet, but it looks AMAZING!!!

Nice work!
_________________

SoggyDog
Download AutoHotKey Wallpaper
Does 'Fuzzy Logic' tickle?
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
SoggyDog



Joined: 02 May 2006
Posts: 280
Location: Greeley, CO

PostPosted: Fri May 16, 2008 9:54 pm    Post subject: Reply with quote

It still looks great, but getting the following...

[ ERROR ]: Problem loading textures. 1281
[ ERROR ]: Problem loading textures. 1281
[ ERROR ]: Problem loading textures. 1281
_________________

SoggyDog
Download AutoHotKey Wallpaper
Does 'Fuzzy Logic' tickle?
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
n-l-i-d
Guest





PostPosted: Fri May 16, 2008 9:59 pm    Post subject: Reply with quote

Does indeed look great! Smile

One request though: could you split the screenshot in half, and post two pictures beneath each other instead? That would greatly enhance the readability of your posting. Wink
Back to top
Zippo



Joined: 21 Apr 2006
Posts: 56
Location: East Coast, USA

PostPosted: Fri May 16, 2008 10:50 pm    Post subject: Reply with quote

n-l-i-d wrote:
One request though: could you split the screenshot in half, and post two pictures beneath each other instead?

Sorry I didn't even think of it. Done Smile

SoggyDog wrote:
[ ERROR ]: Problem loading textures. 1281
[ ERROR ]: Problem loading textures. 1281
[ ERROR ]: Problem loading textures. 1281

That is the error I was talking about. The problem is that your video card doesn't seem to support that texture size (60x60). I tried to simply scale the images down to 16x16 but that isn't working very well at all. I'll play with it and see what I can do.
_________________
____________________
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2737
Location: Australia, Qld

PostPosted: Sat May 17, 2008 12:57 am    Post subject: Reply with quote

IIRC, older or less capable video adapters support only square numbers for texture sizes. 60x60 works with my GF6800, but not in Virtual PC, which doesn't support video hardware acceleration. Try resizing the images to 64x64 - it seems to work in Virtual PC. Smile
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1494

PostPosted: Sat May 17, 2008 1:15 am    Post subject: Reply with quote

Lexikos wrote:
IIRC, older or less capable video adapters support only square numbers for texture sizes.
Right, the old game-designer's rule is powers of 2 are right for you.

@ Zippo: Interesting concept, I'll check it out when I get my laptop home.
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
no1readsthese



Joined: 08 Feb 2008
Posts: 31
Location: VA

PostPosted: Sat May 17, 2008 2:29 am    Post subject: Reply with quote

Wow the gui look great.
I was a little confused at the beginning because I wasn't sure who was what color. A visual reminder of what color the players are would be very helpful.
Also how about an AI to play against. I read somewhere that Connect Four was beaten and its possible to create an unbeatable AI.
Back to top
View user's profile Send private message
Zippo



Joined: 21 Apr 2006
Posts: 56
Location: East Coast, USA

PostPosted: Sat May 17, 2008 1:09 pm    Post subject: Reply with quote

Lexikos wrote:
Try resizing the images to 64x64 - it seems to work in Virtual PC. Smile


I decided on the texture size after browsing this site. Looks like large/irregular texture sizes aren't much of a problem with the newer cards, but it still depends on the specific card.

I've updated the top post with a 32x32 version that should work with cards that don't like the 60x60 images. Might try it if you were having problems.

[VxE] wrote:
...powers of 2 are right for you.

Bah. Didn't that die in the 80's? Very Happy

no1readsthese wrote:
I read somewhere that Connect Four was beaten and its possible to create an unbeatable AI.

Erm a 'tie' is possible in this game...

On the visual reminder, I had planned to create a set of font textures to use to indicate FPS/whos turn it was/etc in the game window, but I got tied up trying to settle the multithread problem and things were dragging out. I asked about threading in #ahk and someone wanted to look at the source to see if they could help, so I thought it was as good as time as any to post it.

I won't be adding AI to this any time soon, but feel free to give it a whirl.

I appreciate all the feedback Smile
_________________
____________________
Back to top
View user's profile Send private message
freakkk



Joined: 29 Jul 2005
Posts: 169

PostPosted: Sat May 17, 2008 2:22 pm    Post subject: Reply with quote

This is superb! Very Happy

You did a really nice job w/ this. Thanks for sharing! Can see it quickly becoming popular at my job... Laughing
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group