Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

C4 (Game with network capability)


  • Please log in to reply
9 replies to this topic
Zippo
  • Members
  • 56 posts
  • Last active: Jan 24 2009 05:18 AM
  • Joined: 21 Apr 2006
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 :)

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 :)

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:
Posted Image
Posted Image

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.
<!-- m -->https://ahknet.autoh...o/opengl/c4.zip<!-- m -->[/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. :D

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.
____________________

SoggyDog
  • Members
  • 803 posts
  • Last active: Mar 04 2013 06:27 AM
  • Joined: 02 May 2006
I haven't tried it out yet, but it looks AMAZING!!!

Nice work!

SoggyDog
  • Members
  • 803 posts
  • Last active: Mar 04 2013 06:27 AM
  • Joined: 02 May 2006
It still looks great, but getting the following...

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

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Does indeed look great! :)

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:

Zippo
  • Members
  • 56 posts
  • Last active: Jan 24 2009 05:18 AM
  • Joined: 21 Apr 2006

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 :)

[ 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.
____________________

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
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. :)

VxE
  • Moderators
  • 3622 posts
  • Last active: Dec 24 2015 02:21 AM
  • Joined: 07 Oct 2006

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.

no1readsthese
  • Members
  • 31 posts
  • Last active: Jul 26 2014 06:50 AM
  • Joined: 08 Feb 2008
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.

Zippo
  • Members
  • 56 posts
  • Last active: Jan 24 2009 05:18 AM
  • Joined: 21 Apr 2006

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


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.

...powers of 2 are right for you.

Bah. Didn't that die in the 80's? :D

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 :)
____________________

freakkk
  • Members
  • 182 posts
  • Last active: Dec 16 2014 06:23 PM
  • Joined: 29 Jul 2005
This is superb! :D

You did a really nice job w/ this. Thanks for sharing! Can see it quickly becoming popular at my job... :lol: