|
In order of no progress to done:
Red,
Orange,
Yellow,
Blue,
Light blue,
Green,
Light green.
Last updated 2/12/09 at 12:01 am PST
Cripes! 2.0 -- See the Class Layout
Arenamatic Code w/ cConsole
 Italy |
Posted - 5/9/2006 11:15:48 PM | The flight to Italy was so, so, so tiring and boring. I'm lucky that I can even post this from here, since this hotel's internet access costs $15 for an hour, and my father had to get on and let me have the last 30 minutes.
When we got off the plane, ARGH, I felt like i was braindead. Then we had to endure a tour bus for 4 hours!
| |
 Gone for a week |
Posted - 5/7/2006 10:48:43 PM | I'm headed to Italy in about 8 hours, so I likely won't be posting for the week I'm staying there. Adios!
Uh, no, wait, that's Spanish... hmm...
| |
 TinyXML |
Posted - 5/5/2006 8:35:38 PM | Well, Deranged has pointed me to TinyXML, so I might just scrap the current file parser I'm working on. It depends on if I can use TinyXML to fill instances of class "item" with the information parsed from an XML file. Could anyone reading this comment and let me know if it's possible and a good idea to use TinyXML to parse an XML file like below (this is just a guess at what an XML file would look like, I don't have any experience with XML) into a C++ object like [also] below?
EDIT: Hah, the past three entries have started with "Well". Ironic, since I'm not feeling at all "well" right now!
<items>
<item name="Mana Potion">
<desc>A potion of Mana</desc>
<effects>
<mana>+10</mana>
</effects>
<store>10</store>
<inventory>5</inventory>
<equipment>1</equipment>
</item>
</items>
class item {
string name;
int price;
string desc;
map<string,int> effects;
int InvenQuant, EquipQuant, StoreQuant;
}
| |
 Item loader |
Posted - 5/5/2006 5:28:33 PM | Well, so far so good. I've managed to make it "see" the 's' in the first line of the file, and then act to take in the number just after it. The code I have so far is below; still has mainly debugging cout statements, but at least I'm gettimg somewhere.
void LoadGame()
{
ifstream gameIn(file.c_str());
string line, prev;
do
{
gameIn >> line;
prev = line;
for (int i = 0; i < line.length(); i++)
{
cout << line[i];
if (line[i] == 's')
{
i++;
cout << ": S will have ";
for (int it = i; line[it] != '!'; it++)
{
cout << line[it];
i++;
}
cout << " object." << endl;
}
break;
}
break;
cout << line << endl;
} while (!gameIn.eof() && line != prev);
gameIn.close();
}
| |
 Designing trouble |
Posted - 5/4/2006 2:12:56 AM | Well.. I've hit a wall in my coding. I need some easy-to-use way of maintaining player item inventory, equipment, and store lists (rather, maps), but I don't want the user to have to create and maintain three separate files. I'm thinking of having one master file with all the information about an item in it, but then comes two other problems: it'll likely be somewhat unweildy to parse, and I'll have to put the data into each component's map, which might be difficult considering each component is withing its own class, and depending on the needs of the user, it might be there and it might not.
I'm thinking of making it so you HAVE to create an object of type cArena to have everything work, which would allow me to make every other component call a cArena object function, which would switch a bool value to "true", which would cause the cArena file parser to know which components can be loaded...
Well. I guess writing in this journal has helpful side-effects, huh? :P
EDIT: As a last remark, this means I'll need to think up a format the user will use for the "master item file". This is what I'm currently thinking of...
s
mp
Mana Potion
Mana,+10
Adds 10 to your current amount of mana.
~
ies
ex
Elixer
Life,+20!Mana,+20
Adds 20 to your current amount of life.
The first line is a flag that determines which component recieves the info (in this case, the store only). The second is the key used for maps. The third line is the name of the item (duh?), and the fourth shows which player attributes are affected when the item is used (in this case, Mana for 10 points). The fifth line is a description of the item. Between item descriptions is a ~ thing to tell the parser that it's moving on to a new item. The only major differences in the second description are that it has two effects: Life +20 and Mana +20, using the ! to let the parser know it's got another attribute on its hands; and there's three flags set for the item: i (inventory), e (equipped), and s (in the store).
How I'm going to accomplish this is beyond me. I'll sleep on it. *sigh*
| |
 Arena Battle update |
Posted - 5/2/2006 5:47:39 PM | I've tossed out the name "AreBat". Sounds too freaky.
Today I managed to solve my runtime problems (one that sticks out in my mind is accidentally passing a map iterator->second instead of ->first), and the shop has been bumped up to green! (I save light green for polishing and otherwise improving) Next up will be my battle component, which will take a while because of all the factors I need to add in... player health and stats, experience and money, and saving/loading a player file.
Once I'm done with all that, I'll also have a fun (complete) arena battle program created that fully utilizes the headers I'm making. If anyone wants, I'd be glad to put the finished program and headers up for download.
And with that... off to the battle component!
~Link
| |
 Today's AreBat update |
Posted - 5/2/2006 12:12:27 AM | AreBat is pronounced ah-REE-bat, and stands for Arena Battle. :P
Well, today I chatted on IRC way too much. I did take out a useless string (and its functions) in the cArena class, though, as well as change the way I utilize my modes in the actual program. I'm making sure my store class works the way I want it to by using it to implement a store into the arena program. If I can't do it, or have an insanely difficult time doing it (stupidity doesn't count), I'll incorporate functionality for whatever was annoying into the class itself.
Hopefully tonight I can green out one of the to-do list items, and notch the title from orange to yellow. 
EDIT: Ok, sadly I will not be able to say that my store is done. I'm having troubles... runtime troubles... with my tests. Le sigh. Gotta prove that it works and can be done before I can green it. 
| |
 My current project, among other things |
Posted - 5/1/2006 2:34:51 PM | Currently I'm working on a set of header functions to be used for creating an "arena battle" game (text-based). My curent focus is on the store (where you spend money you get from winning arena battles), and it's been a bit tough. I managed to get the LoadStore and SaveStore functions working, though. When the user of these headers (specifically, cStore.h - don't ask about the c, please) creates an object of type store (the name I gave to my store class), the user passes a string argument with the name of the file they want to use to load shop data from. The constructor then calls LoadStore(), which parses every line of the file given and separates the lines at certain points. Hmm, maybe I should give an example.
#include "cStore.h"
store shop("shop.txt");
private:
map<string, string> shopMap;
string file;
ifstream shopIn;
ofstream shopOut;
store(string userfile)
{
shopIn.open(userfile.c_str());
cout << "Loading Store\n";
LoadStore();
}
~store()
{
if (shopIn.is_open()) shopIn.close();
if (shopOut.is_open()) shopOut.close();
SaveStore();
}
void LoadStore()
{
string line, key;
string item[2];
do
{
shopIn >> line;
if ((line != (item[0] + '%' + item[1])) && (line != ""))
{
item[0] = PairSplit(line);
item[1] = PairSplit(line, 1);
shopMap.insert(pair<string, string>(item[0], item[1]));
cout << shopMap[item[0]] << endl;
}
} while (!shopIn.eof());
}
void SaveStore()
{
shopOut.open(file.c_str());
if (!shopMap.empty())
{
map<string,string>::iterator forIter = shopMap.begin();
map<string,string>::iterator endIter = shopMap.end();
string line;
do
{
if (forIter->first != "" && forIter->second != "")
{
line = forIter->first + '%' + forIter->second;
cout << line << endl;
shopOut << line << endl;
forIter++;
}
} while (forIter != endIter);
shopOut.close();
}
}
Uh... that wasn't as explanatory as I wanted it to be. Well... basically, when LoadStore is called, it parses the file and splits it into two variables at the '%' character. If the line "lp%Life_Potion$30" was in the file, we'd now have "lp" and "Life_Potion$30", paired and placed into the map. When the shop is saved, the process is reversed (concatenating the key and value with the '%').
Call me a newb, I think I posted this too early in the day. My mind needs to load up on gas. >_> I'm just too excited about getting a journal. :P As a question for anyone reading this, is it acceptable to post twice a day?
EDIT: Forgot to end the source tag. >_<
| |
|
| S | M | T | W | T | F | S | | | | 3 | | | 6 | | 8 | | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | |
OPTIONS
Track this Journal
ARCHIVES
August, 2009
July, 2009
March, 2009
February, 2009
December, 2008
November, 2008
October, 2008
August, 2008
July, 2008
June, 2008
May, 2008
April, 2008
November, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
December, 2006
October, 2006
September, 2006
July, 2006
May, 2006
April, 2006
|