 Action RPG - Weapon Ranges |
Posted - 1/24/2005 3:14:08 PM | i was thinking a bit about the few games i've played like what i'm aiming at. mainly, the sword strikes. different games make you do different types of sword swings, and i want to look at them.
in Sword of Mana, it looks like they didn't really put much thought into this, at least, no more than how it looked. see, when you do a strike, you cover a different type of area depending which direction you face. if you face left or right, you cover hardly any space, and if you face up, you cover a little more than 180', and down you cover exactly 180'. the point here is that you should cover the same amount no matter what direction you face, otherwise you lose range and thats just stupid. you have to worry about weapon management due to an important gameplay oversight on the part of the game designer IMO.
in Zelda:LA(gb), they did a good job of evenly distributing the sword arcs, except that you can't swing your sword in the lower right quadrant of the full arc of a super attack. for instance, if you swing your sword to the right, you cover the upper right quadrant, and if you swing your sword downward, you cover the lower left quadrant. there's just no way to cover the lower right without a power attack. oddly enough, if you attack upward, you cover the upper right quadrant, just like if you had attacked to the right. unfortunately, you have to work around that in battles. the range per attack could probably be bigger, too, but its not a real issue.
in Zelda:LttP(snes), it was pretty well done. the sword arcs were even all around and you get good coverage. as the weapons got stronger, the ranges' radius increased as well, making them more effective in that way too.
the thing that's bugged me is that you generally can't move (and attack) in 8 directions. sure, you can move up and over, but you don't face in that direction, and certainly can't attack at that angle. now, its not really been a big problem with these games. but we're only talking about swords. let's extend the discussion to other weapon types, like bows and spears.
in Sword of Mana, the spear is thrust out away from you in a straight line. you can only attack in 4 directions, and if you make a mistake in your aiming, you need to re-align and try again. generally the recovery from an attack with a spear takes a little while longer than with a sword, so if you make a mistake - you're more likely to pay the price. if you were able to attack in 8 directions, you've got a better chance to hit what you're aiming at, because you're not as limited in range.
the bow in Zelda:LttP(snes) and Zelda:LA(gby) both suffer from this problem as well. if you were able to aim in 8 directions, that simple addition would make the weapon much more effective. in Sword of Mana, the arrows travel in an arc, and no matter what height they're at, as long as they clip a monster sprite, they hit. its a good idea to take advantage of this fact; you can position yourself to get two hits on a monster with one arrow. i'm not sure if i want to deal with height or not, i suppose its something i'll need to write a test for. 
while we're on the subject, using a bow should work more like how you do the magic targetting in FF:CC(gc) - press and hold button for target cursor, dpad to move target to where you want the arrow to land. another thing to test out. 
| |
| Wednesday, January 19, 2005 |
 Diablo - Drawing Equipment in Play |
Posted - 1/19/2005 9:46:27 PM | one of the things i wanted to talk about was how i was planning on doing the equipment graphics for the diablo-game.
it seems that they made a few attack sprites for different types of attacks and made two sprites per weapon/hand that would fit where it should. i say two, because depending on the direction, the weapon/shield sprite should be drawn over the player sprite (if weapon should be seen in front) or under (if seen in behind). here's an example:
is made up of:
(i had a hell of a time fighting with my image manip programs. i almost had it with proCreate but the layers were going all see-through and stuff. it was retarded. then i was dumb and saved out as jpg and it made a mess of the images. then i was even dumber and couldn't get psp3 to paste an image over another and have transparent bits not show. been a while.. )
so here, we have the cardboard tube at that view as being in behind the monk sprite. isn't there going to be another sprite for the cardboard tube that would just be a fully transparent sprite? well, that seems silly, doesn't it? why not just tag the view for that angle as in front or behind? that makes more sense, come to think of it. i was thinking there would be a point where you'd need to have it in front AND behind - but what would ever be that way that couldn't be altered?
in secret of mana, its pretty obvious. they drew a series of weapons doing their attacks, walks and idles, and then made the character sprites fit the weapons. every character holds and uses every weapon exactly the same. it certainly isn't going to be very easy to do differently sized characters, but you can make the animations much more generic.
| |
 updated smiley icon |
Posted - 1/17/2005 10:07:42 PM | i'm getting super-close to what i want the gif to be.. not bad, not bad. the thumb might still need a little work but i gotta see it in here first. i figured out how to get rid of the whitespace, just grabbed a little shareware prog to do the job up. looks like i might not have a timeout on it 
| |
 Smiley Confusion |
Posted - 1/16/2005 2:57:12 PM | there's this icon i've been using for a while, called [ razz ], . i used to think it was a red smiley that was rubbing his chin in evil thought. apparently though, thats a tongue there. WELL. i liked having an evil thinker, so i'm going to make my own. i'll be using UnFREEz to form the animated gif, and windows paint to make the frames. [working]
the razz gif is 15x15 (err, thats what i thought i needed to use for SOMETHING.. ) so i should stick with that. i'll probably base the smiley on one of the other smileys available. [working]
ok 15x15 just isn't enough room for what i want. if i want to do the chinrub, i need more room under the face to move the hand. i tried to do it in the 15x15, but it just wasn't enough. [working]
ok i'm getting closer. since i can't have a smooth angular motion, i'm going to have to make the rub just go left to right and take the vertical right out. [working] yeah, i think that might do it. i used a frame delay of 25cs, its close enough. i just need to kill that extra space underneath now. [working]
first though, i wonder about the mouth. is it fine? [looking] yeah, thats what i thought. i'm turning down one edge. it looks better. [working] there we go. all done. all i need to do now is figure out how to make my gifs' backgrounds seethrough. hmm.. i wonder.. 
err? hmm, turning down the edge actually didn't make it look as good at 1:1. i guess i was looking at the gif at 8:1 and it looked better at that size. i'll put it back. [working] done.
| |
 Local Journal |
Posted - 1/16/2005 12:53:25 PM | Local Journal - WIP
the two-pane version of the journal i'm working with now looks much easier to find stuff with. i've made 15x15 icon gifs that line up to make an ok looking treeview structure. its certainly a better setup than last time, but i don't have any content for it to really shine with yet. i'm gonna be grabbing icons for special things (like the diablo folder) and using 'em, whee!
actually, i have to do a bit more work than i thought, by using 15x15 instead of 16x16. i should probably switch to 16x16, just to make my life easier. [working] there.
i just realized now that i'm going to have to decide whether to sort the categories from latest to oldest, or what. that seems to make the most sense.
omfg this hand-editing is getting cumbersome, at least for the categorized contents. i'm going to need to make a program to let me add new entries more easily. another todo for the future.. here's a shot of the frame right now:

notice on the 2nd diablo > inventory that i have a folder at the end of the link - its linked to the work folder for that day, for even easier access to my work. i'm not sure what could make the journal easier to navigate - its pretty damn slick, now. if you'd have seen the situation before, you'd probably have barfed all over the place. seriously.
when a section grows too large, its time to break it down. that's going to be easy to accomplish this way, i just add a few new folders and bam, easier navigation. right now there's just no reason to go 7 folders deep, even though 2 days worth of entries has alot of different information, there's just no reason to break it all up.
[edit: yeah, i'm using ie icons for html documents. i'm using Avant though, so its not that bad. DEAL WITH IT ]
Local Journal - a Brief History
i was just explaining the whole treeview concept to jenn and how it was such an improvement over the old system. i thought i'd put it down here, just for future reference.
when i first started my journal a couple of years ago, i had a series of txt files, much like i started with here. after a couple of months worth of txt files, it was getting harder and harder to find info; i'd have to randomly pick a date and read through the journal entry and guess which one to pick next.
at that point, something had to be done. i created an html file that had grouped links to the txt files, sorted by date. it was easier to use than doing a manual search. since i had html on the mind, i also converted all of the txt files to html so that i could add links and pictures to my entries.
a long time after, after about 2 years of posts even that system started becoming unmanageable. i started adding subheaders to break sections into smaller sections, and it made it a little easier to navigate; but a vertical list of sections was getting ugly and harder to look at.
i'm not sure why i didn't do this before, because i already knew how to simulate treeview structure with images - i think i had done it before when i first had my geocities page.
anyways, thats my story. (and i'm stickin' to it.)
| |
 diablo inventory |
Posted - 1/16/2005 2:00:21 AM | well, i got tired of having to add html stuff to the txt when i was dropping posts in here, so i'm going to start saving my journal entries as html and hand-code it. copy-paste should be quicker, and i'll just have to change a few urls instead of adding a bunch of tags everywhere.
ok. instead of trying to make entire games, i need to go back to my roots, the original journal. when i was working in that, i was just trying little things that weren't really significant on their own, but eventually i'd have enough insignificants that i could combine into something worthwhile. i think thats a better goal. eventually i'm going to have some insignificant things that are pretty cool and i might want to put into a 'final' directory in here. i wasn't doing that before and it was getting difficult to find things i wanted quick access to.
so what interests me right now? halo/2, diablo/2, zelda/SoM, chopper commando, that 2d motocross physics game, and maybe Demolition Derby. what part of which game do i want to look at and try to do? or do i want to make a 2d vector class, or a ddraw wrapper? so many things to choose from. right now i'd say diablo is foremost in my mind, and of the things i could look at, items and the inventory are what i'm most interested in.
[working] well, i just went out and had to relearn frameset and frame but now i have a better index than i had originally. right now i'm going to only add it by date, but eventually i'm going to have a categorized listing you can select from as well. i want to have a clickable folder icon for my local copy so that i can open its source folder quicker than scrolling around for it. of course, it'll have to be hand-edited for now, but who knows what the future may bring.
so i was thinking about what i'd do to play with the items and inventory. i envisioned a simple window (or fullscreen) split in half. the right half will display an inventory window, not unlike d2's. the left half will have a series of sprites on a background. when you click on the sprites, they go into your inventory if they fit. if they fit, they appear in the inventory area on the right and they disappear from the 'action' half. if there's no room, the object is thrown into the air and lands where it was to begin with, just like in d2.
now, with the inventory side, you'll be able to pick up the items in the inventory and move them to somewhere else valid in the inventory screen. if you decide instead to move the mouse over to the left play area and try to drop an item into the play area, it'll pick that spot and throw it in the air, to land where you clicked or let go of the drag. the whole exercise should help me when i'm looking at my gba-styled version of diablo.
as much as i want to start looking at that version of what i want to do, i really need to try to do what diablo does. i should probably only let things drop in a grid slot, so that there won't be any chance of overlap. also, i suppose i'm going to need to have the computer find the nearest spot open from the spot you dropped the item. in diablo, you weren't able to drop if the 9 tiles around you already had items. that might be a quick-n-easy option. thats another project i can look into. that means i can't just drag-drop, so i'll just have it click once to pick up, click a second time to drop.
i'm getting closer to something i can handle. (side note: the 1/4-phased moon outside my window right now is half-covered with clouds and it looks super creepy. cool!) anyways, the easiest way to do this is to just to rip some gfx from zelda4(gb). i'll 2x the graphics so that they'll be visible (maybe have a menu option to pick from a few different size multipliers eventually).
so i'm going to have an item class that will need to contain: a name (to be displayed on mouse-over), a play-area graphic and location on the play-area (do we need a class for this?), an in-inventory graphic and size info (will definitely need another class for this). hmm. anything else? i'll do the toss animation like they did it in z4(gb) where theres just a shadow and it pops up into the air, but no bounces. just a quick anim.
so now we'll just be running through every item location when we catch a click and if its the tile you're clicking, its picked up off the ground (we'll set the location to nothing or -1,-1 or something) and it goes into the first available spot in inventory for its size. that's going to be a project on its own.
so where am i at now? can i start coding this? it seems too conceptual yet, not enough work has gone into figuring it out. for one, i'm going to be relearning gdi+ for this (why bother with dx?) and i need to make some interesting decisions. for one, the map screen will be an altered screencap of z4(gb). i say altered, because i don't know of any single screen that is completely devoid of blocking tiles. i want the user to drop anywhere. also, i might want to avoid screens with lots of tall grass, i don't want to have to deal with the grass-over sprite.
i suppose i don't have to do it left/right, i could go top/bottom - i don't see the difference. an item screen is an item screen no matter where it is. hmm. i realize now that if i'm going to have the items NxM sized in inventory, i'm going to have to come up with my own drawings for them. thats ok, i can do some pixel-art if i need to.
so what items am i going to have, and how many of them will there be? i suspect that 8 is a good number, let's see what we can come up with. the Sword, Sheild and Bow immediately come to mind. Arrows and the Boomerang, the Firerod and a Book could fill more slots. i want to avoid using the money because that wouldn't make sense to put in inventory and would work a bit differently. perhaps i should avoid arrows as well, arrows are stackables and i think i want to avoid that complication for now. the Bracelet is another item, and... hmm. oh! the ocarina. thats good. i'll have to make the Book sprite myself, but oh wells. here's what we're going to have:
- Sword - 1x3 - "Master Sword"
- Shield - 2x3 - "Large Shield"
- Bow - 2x3 - "Short Bow"
- Boomerang - 2x2 - "Boomerang"
- Firerod - 1x2 - "Wand of Flame"
- Book - 2x2 - "Book of Wizardry"
- Bracelet - 1x1 - "Bracelet of Strength"
- Ocarina - 1x2 - "Ocarina of Time"
i'll just simulate a tooltip above the mouse pointer if you're not holding anything, and let it follow the mouse. the less complicated we can make it, the better.
something i forgot about was the item location in inventory. that could be shared though, with the game window location, if we add a bool to report whether the item was in inventory or on the play area. what about if its on the mouse pointer? its location wouldn't make any sense. so i guess another bool might be in order, or perhaps a ItemLocation enumeration {InPlayArea, InInventory, OnMousePointer}.
this demo shouldn't need to hook Main into an endless loop - and the Click event can trigger an animation draw.. hmm. i suppose i don't need a jump animation, whats the point? simple simple. this should be pretty straightforward from here. the classes will need work, though.
lets start up a project. [working] ok lets set up the image we'll be clearing the client area with in our Paint event handler. i want some screenie from z4(gb) and the same size under it that will have space for 10x4 inventory slots. i'll just 2x all the graphics before i add them. [working]
ok i'm going with left/right. its not going to be 10x4, it looks like its going to be .. err, wait. i don't want the inventory grid to be spaced as 16x16 do i? wouldn't 8x8 be better? hmm. no, its a 5x8 grid, so lets just go with that. i know i said i shouldn't use the tallgrass tile, but i don't have to worry about the grass-over sprite. keepin it simple. [working]
ok. got 'er. now i get to make the item class. [working] ok, so far so good. this is probably not as efficient as it could be, but who cares. "get it working first, worry about optimizing later". right? right. ok, so i'm just going to load the graphics right into the resource manager. resizing the form with the background image wasn't too hard once i looked up Form1.Designer.cs. [working]
ok wicked. the Item class constructor i made takes some info that will construct a fully working item and place it on the play area. i'm probably going to want to catch the clicky for the picturebox though, aren't i? i'm probably going to have to deal with some of the defaults PictureBox starts with, like AutoSize or that kind of thing, but its going to work so far.
another thing to bring up is that the items should be dropped on the map at random, but you're going to determine where they're dropped when you call the constructor. so thats up to me. i'm going to likely have a Collection of Items and as i create new ones to Add, i'll iterate through the Collection to make sure our randomly generated location is'nt already taken.
back to the PictureBox.Click event deal. we definitely want to catch it, its the most obvious way to do all of this. i'll add that in now. [working] fucking awesome. this is coming together super good. ok, here's where we back out and try to make an item or two and add them to a Collection stored somewhere. we'll be setting up the Items in Form_Load. so i guess lets get the sword Item up and running. [working]
found a nice sword pic to use for the inventory version, check this out. i've beat the crap out of its resolution, but whatever. lets get this puppy up and runnin! [working] wow. i have no idea why its not showing up. oh fuck. i forgot to add it to the control set. real smart, dickhead. [working] yeah of course that was it. jeez.
and i was right about the default PictureBox sizing, i'm just going to set AutoSize to true. [working] awesome. i actually had to change SizeMode to AutoSize, not what i just said. oh well, whatever. now i get to move on to handling our first click! what's going to happen, you ask? WELL! i have no idea. i need sleep now. [gone]

| |
 dev-c++ && allegro |
Posted - 1/14/2005 9:26:00 PM | jesus christ. i don't know whose idea it was to set the default editor settings in dev-c++ but, man! it makes the ugliest code ever known in this age of man. getting allegro to run was a bit of a pain too, i had to uninstall/reinstall everything and get the newest packages before i could get anything to run.
here's what happened: i decided to go check out the showcase (as i do every morning) and there's this tetroids game there (ontheheap) and i try to run it. it gives me diahorrea all over my desktop:

well he's gone on to explain that he's using allegro. i've used allegro for a long time, so i figure i can help the guy out. well man, none of the stuff from my old journal (archived to cd now) will run on the comp! i was thinking it was my hardware, so i run dev-cpp and try a simple allegro app, and everything's borked. anyways, its completely reinstalled and i have the newest version of allegro and it works fine.
getting c++ to do my bidding was a bit of a challenge. i'm not used to forward declarations anymore, and i'm not happy when i can't see the params of a function in a tooltip as i type it out. sure, its an open-source project vs a huge corporation, but devcpp has been around for quite a long time. all those options are silly when you compare the features of vcpp against it. who cares if my brackets highlight if i can't see what's in a function param list?
long story short, i have allegro going again, so if anyone has any allegro-related problems, be sure to drop me a line. i sorta remember a bit of it.. 
| |
 Sprite Class |
Posted - 1/7/2005 10:04:07 PM | [journal dump]
i've been thinking a bit about sprite classes lately and i figure its time to sit down and figure out what i want out of a sprite class and how i could go about doing it.
for one thing i'm going to be needing sprites that are going to animate. thats important. not much more to be said about this yet.
another thing i'm going to need out of my sprites is that they're going to need to face in multiple directions for each animation. i'd like to tell the sprite what angle its facing in, in 360' (or 2pi) -based float/double. when i change the facing direction, i want the sprite to know which of the animations to use.
still another is that i'm going to want to have sprite animations with focal points so that i'm not drawing every frame from the upper left or bottom center, i've got a point for every frame that i'm going to use as an anchor. this saves me alot of trouble when i'm trying to do something like the animation for a sword swing. the simplest method would be to have a huge frame full of magenta and a small area where a sword is drawn, to be centered around the player's sprite. i did it before and it worked, but it certainly wasn't very easy to do collision detection with, as that huge picture wasn't very representative of the actual hit area of the sword. no, if i use an anchor point seperated from the picture (relative to the picture), i can draw the sword and have it clip at a much better accuracy than i could before. i'm also saving on memory this way too.
of course, every game works differently and needs different things out of its sprites, and theres no way i could (or would want to) have support for any situation you threw at it. but the above bits are important to me to have in a sprite class, even if i'm not going to use them all. for instance, i might just need a basic sprite that loads up a bitmap - that would default the focal point to the upper-left and all rotation angles would display the single frame, so changing them would amount to nothing.
storing the information in a file and in memory at runtime are two issues to look at too. i *could* just output all the information and bitmaps to a single binary file and give it some god-awful extension. i also could store the bitmaps in a folder (or more awfully, in the exe folder) and have the other info stuffed into an easy-to-read txt file.
if i were to create a single binary file format, i'd most definitely require a visual editor. however, even if the info was in an easy-to-read txt file, i'd still prefer a visual editor. i tried to make one before, as a project to learn c# with. what a disaster that was. god.
anyways, i want to be able to do something like this:
hero.direction = gamepad.LeftAnalog.direction;
switch (hero.state)
{
case HeroState.Walking:
if (gamepad.button[PS2GamepadButtons.X])
{
hero.state = HeroState.SwingingSword;
hero.animation = animations[(int)HeroAnimation.SwingingSword];
}
break;
}
| |
| Thursday, January 6, 2005 |
 Tic Tac Toe source |
Posted - 1/6/2005 8:04:01 AM | [edit: screw it. hand editing and use of <pre> seems to be the only way out. sucky, i like the [s0urce] windows.]
[edit: hmm. after converting 'tab' to two spaces, it's still too wide. seems to be a problem with the code generation window. obviously i'm going to have to do this differently.]
[edit: goddamn it! this post is too wide! anyone know how i can fix that?]
Drakkcon requested i post my source. cool. download it here. sorry about the lack of commenting, i can add that in if its a problem.
here have the meat of the program. see, i don't need any commenting to this. it reads very well to me. the only thing that might need some commenting is the stuff i do in MainForm_Load. oh wells, here we go..
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
#endregion
namespace tic_tac_toe
{
partial class Form1 : Form
{
public Label[,] boardLabel = null;
public Random randomGenerator = null;
string PlayerSymbol, ComputerAISymbol;
public Form1()
{
InitializeComponent();
randomGenerator = new Random (Environment.TickCount);
}
private void Form1_Load(object sender, EventArgs e)
{
boardLabel = new Label[3, 3];
for (int x = 0; x < 3; x++)
{
for (int y = 0; y < 3; y++)
{
boardLabel[x, y] = new Label();
boardLabel[x, y].BackColor = boardLabelTemplate.BackColor;
boardLabel[x, y].Borderstyle = boardLabelTemplate.Borderstyle;
boardLabel[x, y].Font = boardLabelTemplate.Font;
boardLabel[x, y].Location = new Point
(boardLabelTemplate.Location.X + x * boardLabelTemplate.Size.Width,
boardLabelTemplate.Location.Y + y * boardLabelTemplate.Size.Height);
boardLabel[x, y].Size = boardLabelTemplate.Size;
boardLabel[x, y].TextAlign = boardLabelTemplate.TextAlign;
boardLabel[x, y].Click += new EventHandler(boardLabel_Click);
Controls.Add (boardLabel[x, y]);
}
}
boardLabelTemplate.Hide();
ClearBoard();
PlayerSymbol = "X";
ComputerAISymbol = "O";
}
public bool computerAIRunning = false;
private void boardLabel_Click(object sender, EventArgs e)
{
Label clickedLabel = (Label)sender;
if (!computerAIRunning)
if (clickedLabel.Text == "")
{
clickedLabel.Text = PlayerSymbol;
clickedLabel.Refresh();
if (CheckForWin(PlayerSymbol) == true)
{
MessageBox.Show(playerNameTextbox.Text + " wins!", "Game Over");
ClearBoard();
}
else if (CheckForTie() == true)
{
MessageBox.Show("Tied!", "Game Over");
ClearBoard();
}
else
{
computerAIRunning = true;
Wait(0.75);
RunComputerAI();
if (CheckForWin(ComputerAISymbol) == true)
{
MessageBox.Show("Computer AI wins..", "Game Over");
ClearBoard();
}
else if (CheckForTie() == true)
{
MessageBox.Show("Tied!", "Game Over");
ClearBoard();
}
computerAIRunning = false;
}
}
}
public void Wait(double secondsToWait)
{
DateTime startWaitTime = DateTime.Now;
while (((TimeSpan)(DateTime.Now - startWaitTime)).TotalSeconds < secondsToWait) ;
}
public void ClearBoard()
{
if (boardLabel == null) return;
for (int x = 0; x < 3; x++)
{
for (int y = 0; y < 3; y++)
{
if (boardLabel[x, y] != null)
boardLabel[x, y].Text = "";
}
}
}
public bool CheckForWin(string symbol)
{
for (int y = 0; y < 3; y++)
{
if (boardLabel[0, y].Text == symbol &&
boardLabel[1, y].Text == symbol &&
boardLabel[2, y].Text == symbol)
{
return true;
}
}
for (int x = 0; x < 3; x++)
{
if (boardLabel[x, 0].Text == symbol &&
boardLabel[x, 1].Text == symbol &&
boardLabel[x, 2].Text == symbol)
{
return true;
}
}
if (boardLabel[0, 0].Text == symbol &&
boardLabel[1, 1].Text == symbol &&
boardLabel[2, 2].Text == symbol)
return true;
if (boardLabel[0, 2].Text == symbol &&
boardLabel[1, 1].Text == symbol &&
boardLabel[2, 0].Text == symbol)
return true;
return false;
}
public void RunComputerAI()
{
int x, y;
x = randomGenerator.Next(3);
y = randomGenerator.Next(3);
while (boardLabel[x, y].Text != "")
{
x = randomGenerator.Next(3);
y = randomGenerator.Next(3);
}
boardLabel[x, y].Text = ComputerAISymbol;
boardLabel[x, y].Refresh();
}
public bool CheckForTie()
{
for (int x = 0; x < 3; x++)
{
for (int y = 0; y < 3; y++)
{
if (boardLabel[x, y].Text == "") return false;
}
}
return true;
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("SteelGolem's Tic Tac Toe" + Environment.NewLine
+ "AI version: v0.stupid", "About");
}
private void asXToolStripMenuItem_Click(object sender, EventArgs e)
{
playerSymbolLabel.Text = PlayerSymbol = "X";
ComputerAISymbol = "O";
ClearBoard();
}
private void asOToolStripMenuItem_Click(object sender, EventArgs e)
{
playerSymbolLabel.Text = PlayerSymbol = "O";
ComputerAISymbol = "X";
ClearBoard();
}
}
}
| |
 Tic Tac Toe |
Posted - 1/4/2005 11:32:52 PM |

download here.
[journal dump]
ok, so Drakkcon made a tic tac toe game in c# and by the gods! its 5megs big and the code is just awful. time for another "code by the seat of my pants" session!
ok, we're going to do a few things differently than him. for one, i'm going to make a 3x3 array of labels. we'll make one and copy it 8 times, arranging them around the single one. lets start with that. [working]
hmm. making a copy of an object isn't as easy as i want. i want to clone it, but i can't remember.. [working] nope, i had to manually do it. oh well. lets see if it works [working] oops, i forgot to Controls.Add() the labels ^_^ [working]
yeah ok now it works right. i also added a Click event handler for each one that actually uses the same function for every one. right now i've got it changing the text from X to O every click. next i'm going to put in the actual game. [working]
ok the game's all but done. the only (big) problem now is that there's no tie situation test. because of that, and the computer's (stupid) AI, when it gets to a tie and all spaces are taken, the game locks up tight. how do i fix that? well, first i should be checking for a tie - if all spaces are taken and we haven't announced a win, then we have to have a tie. we need to check for a tie before we let the computer run its AI, because its set to just look forever until it randomly finds an empty spot. that would finish things off. [working]
jenn just suggested we let the game track your name so it says it to you in the win message. that's easy. but, how do we want to get the name to start with? the simplest thing i can think of is to just have a textbox right on the game that has your name in it and you can click on it to change it any time you want. [talking]
thats in now. now the last thing i see that he has is that you can choose whether you're X or O. when you choose a different one, you reset the board and thats that. personally i don't think you should have the option to change betwen X and O, because the player could get up and then sit back down at the game 5min later and wonder whether they were X or O. if the player is always X, there's no confusion. i suppose a way to alleviate that problem would be to tell the player whether they were X or O by the player's name. that works well enough for me.
i don't like how he has two buttons at the bottom that let you choose X or O, its cludgy and doesn't seem like the bestest way to go about it. i'm thinking that adding a new menu item 'New Game' and then two subitems 'As X' and 'As O' would work better. [working] yeah, its good that way. building a new version and uploading. oops, its 5.31 KB (5,441 bytes) big, zipped. Drakkcon: What's next? 
| |
 WTFBBQ |
Posted - 1/4/2005 7:34:58 PM | 
on the bumper there, is a seagull softie. HE'S GRABBING SOEMTHING FOR THE FIRST TIME
| |
|
| S | M | T | W | T | F | S | | | | | | | 1 | 2 | 3 | | 5 | | | 8 | 9 | 10 | 11 | 12 | 13 | | 15 | | | 18 | | 20 | 21 | 22 | 23 | | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | |
OPTIONS
Track this Journal
ARCHIVES
January, 2008
December, 2007
November, 2007
October, 2007
September, 2007
August, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
January, 2007
December, 2006
November, 2006
June, 2006
May, 2006
March, 2006
October, 2005
September, 2005
August, 2005
July, 2005
June, 2005
May, 2005
January, 2005
December, 2004
September, 2004
|