Original Post

I decided to make a one-player Tic-Tac-Toe game. Yes, I know DogP made a Tic-Tac-Toe game, but (no offense) it isn’t really playable. I tried looking at the source code and it all looks like gibberish. So, I’m trying to make my own here. I’ve posted what I have so far (which isn’t very much besides a fancy title screen). I think I may be able to pull this off, but I need a little help, though. What I want to do with the logic is have a turn counter, and, depending on whose turn it is (the computer or yours), go to a different section of code. What I would normally do in a basic-like structure is, “if turn=1 then goto turn_1, if turn=2 then goto turn_2”, etc., So how would I do this in C without using the goto command? Any simple example code will do.

50 Replies

Bug report:

– After winning, I can increase the win counter by pressing A
– On rare ocassions, some pieces changed places after a game ended with a tie

Don’t forget to open an entry thread on the compo forum when the game is finished. πŸ™‚

OK, I think I fixed those bugs. I also removed the O at the beginning in the upper right-hand corner. I want to know why those half-squares appear in place of spaces in text and how to remove them.


Seems to work OK, you should develop it, (in Sweden at least) we have something called “Luffarschack” where you have a large grid and you’re supposed to get five in-a-row…

Adding a two player option would be fun, where you could take turns – or if you could also add a link-option – it would be really fun to play two players on two units.

As such a Tic-Tac-Toe game isn’t fun for a very long time, especially if the computer program is written never to loose (I managed to win though). Even then it’s not that fun. πŸ˜‰

Great job though, everything looked quite nice.

I didn’t understand why there’s an F at the far right, I played it in Mednafen, a bug perhaps – part of the playfield?

Sometimes there’s also one or two 90 degree angles around it:


The F and 90-degree angles are the half-squares I have been talking about. I don’t really know how to get rid of them. Anyone have any ideas about that? As for the AI, it wasn’t supposed to be “unbeatable”, just not stupid.

Now that I played it some more in Reality Boy I also noticed that a square is emptied when pressing start-button after a tied game (not always though). It also empties a square otherwise but it’s not always noticeable since some squares are already empty.

And further along the way I got this, I wasn’t able to put an X in the top left corner and the game doesn’t stop:


OK, I played like 20-some-odd games with this version and nothing strange happened, although those stupid half-squares keep showing up. I really wish someone would tell me how to get rid of them.


The thing is, you are still printing out the text once after you press start, only you change the font so most letters simply get black, except the space character…

Try this to get rid of the “F”:

On line 579, change:

if (message>0) vbTextOut(0, 40, 12,"GOING ");
if (g==1) vbTextOut(0, 40, 13,"FIRST ");
if (g==2) vbTextOut(0, 40, 13,"SECOND");

Into this:

if (message>0) {
        vbTextOut(0, 40, 12,"GOING ");
        if (g==1) vbTextOut(0, 40, 13,"FIRST ");
        if (g==2) vbTextOut(0, 40, 13,"SECOND");
else {
        vbTextOut(0, 40, 12,"NOTEXT");
        vbTextOut(0, 40, 13,"NOTEXT");

Yep, that worked. Thank you, Dan!


Cool :thumpup:

Lets hope you add alot of nice features for the game because as it is now its very boaring

SOME IDEAS (some might be to hard for you)
-3D intro, a basic 3D intro like Tron will do find

-Music, you can use the music player that was made on the other vb competition back in 2008

-Some nice backgrounds like blox 2 has

-2 players

-Choose music (a bit like tetris where you got 3+ songs to choose from)

-Choose symbols (instead of just X and O you can choose many sysmbols, a bit like in panic bomber)

-Make the symbols move (like in panic bomber)
Example, the X and O would shake a bit as if it was dancing but not walking so to speak
Anyways good luck and lets see what you and for that matter other people do for fun games

Now that everything is working all right, I got an idea to add some sounds (that is, if I can get the WAV converter working…) A title announcement “Tic Tac Toe ‘Ten!”, an “aw nutz!” sample if you lose, and a “yay!” if you win. I don’t know how to program music on the Virtual Boy, so you won’t be hearing any. I wish I could.

You might want to look into the audio instructions – if I’m not mistaken you can just use those directly to play some music, too. That is, you could find a way to write your music in the code and then write a function to play that music.

I looked into the VBDev Wiki and looked at the sounds, and it all seems like gibberish. I was just wondering if there’s any way to incorporate a MIDI I made into my game. I see something like the MIDI Player and I want to do something like that, but there is no source code provided for an example.

“Let’s play Tic-Tac-Toe!” The first of what I hope to be many voice samples in the game. And yes, it’s supposed to be in a high-pitched voice, it’s the way I wanted it to be. Remember, Reality Boy does not do sound.



Useless “BTW” of the week:
“Tic-Tac-Toe ‘Ten” can be read as “Tic-Tac-Toeten”, which would mean something along the lines of “Click, Clock, Kill!” in german. πŸ˜‰

Added win, loss, and tie speech samples.


I think I’ve added just about all I can. Music isn’t an option because I don’t know how to add it, so I think it’s just about finished. what do you think?

To be honest I think if atleast 3 or more games are made in the competition then your game will not win
It is not a game you want to play more then 10 min and in my opinion it is not good enought game to actually take the time to put on your vb when you can just play the game on a normal piece of paper

Would have been fun thought if someone would help you finish it because with the right stuff it can be cool

-Moving sprites on the X and O
-Option you can choose your music
-A mode wuth 5 in a row
-Nice 3d backgrounds
-A story mode where every level is 1 game but the harder it gets the bigger and more you need to get (example level 1=3 in a row but level 20=10 in a row

Anyways it is good you learn so you will make better and better games πŸ™‚

lol @ akumie: horribly blunt as usual…

Actually, having a 3D background would be cool and probably wouldn’t be too hard to add. I mean, if the VB is 3D then you might as well make the best use of the feature.


Write a reply

You must be logged in to reply to this topic.