Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    122
  • comments
    121
  • views
    69252

About this blog

My not-so daily posts on my current console project

Entries in this blog

 

title*

Yeah, I haven't posted in a while. I have a good reason, though! I got selected for the World of Warcraft expansion beta for Burning Crusade. [cool]

In Arenamatic news, the shop's done and working, but I had the idea of adding my scrolling list feature to the actual console class so it can be reused again and again. It's a good idea, no? [grin]


*The subject should properly be >_>, but the subject bar doesn't like it.

Twisol

Twisol

 

Ugh

After a couple MASSIVE headaches on the issue, I finally managed to templatize the store. I'll just have to add some way of adding items in, probably with file I/O. Then I can test the store again... and finally upload a new version of the Arenamatic. Thanks to jpetrie on #gamedev for helping me out!

Twisol

Twisol

 

Pokemon: Mystery Dungeon

A lot of people will hate me for this, but I bought Pokemon Mystery Dungeon: Blue Rescue Team yesterday. It's actually pretty fun, but the menu controls take a while to get used to. Storyline's pretty good, music's okay but still enjoyable. The dungeons themselves STRONGLY remind me of Lufia: The Legend Returns for one of the older Game Boy systems, and Evolution Worlds for the GCN. The dungeons are designed VERY much like those two games, especially the traps from Evolution Worlds. Fun game, iffy controls.

Twisol

Twisol

 

Templates

Writing from another computer, so I can't get my code right now.

I'm experimenting with templates and overloading the () operator (function objects) so I can simplyfy my store component. Right now I have rwo store functions, each doing the same thing, other than the type of item they're handling. They're hard to keep in-sync too. I'm working with three classes, all very simplified, to test this usage of function objects. I had some troubles with getting them to work right, but now I can simplify the store. [grin]

Twisol

Twisol

 

Store

Store's done, I added functionality for buying stuff, and you can't buy anything if you don't have enough gold for it, or you already have it equipped. Of course, it's only now that I realize I forgot to actually set the item they bought as the equipped item.. and I need to make a better weapon/armor switching function, so I can deallocate the memory I use safely. Bah. Maybe I upgraded it to a green entry in my to-do list too soon...

Twisol

Twisol

 

W00T

I've finished the shop interface (other than the actual buying stuff), and it's really awesome, in my [very humble] opinion. I've uploaded the code + exe, and you can get it from the link below my to-do list (which I've also updated). Please take a look, and let me know what you think!

Comments on code structure would be great, as long as they don't blatantly say "This is totally wrong, dump it and do this instead". [grin]

EDIT: I said 'jump' instead of 'dump'. [tears]

Twisol

Twisol

 

Good news, bad news

Good news: I have the store nearly implemented. I added a cool "scroll" feature, where if you have, say, this...



...then tapping a button 'scrolls' it to...



Bad news is now redundant, as P16 solved the bug. My console.output() function was unable to write explicitly to the zero'th line because that's what my default value for 'row' was set to, and it 'row' is 0, it just automatically checks for the next available line. I changed 0 to -1, and it works great. :D

Twisol

Twisol

 

Hmm

I've been trying to post 1-2 times here, once early and once late, so here's my late post. [grin]

Today I took to the task of splitting my .h files, which had class declarations AND definitions, into .h's with declarations and .cpp's with definitions. Took me a LONG while to actually figure out how to do it properly, with thanks going to P16.. wow, "P16" looks a lot like PIG.

Uhm.. I'm not sure if I want him to read that...

EDIT: Ooh, I'm going to have to start watching for when my journal viewcount hits 1337. [wow]

Twisol

Twisol

 

Tough

Project 2 of the C++ workshop was unveiled.. I'm going to have to work hard to get that done. It really looks tough.. meaning, I've never done something as big as that before. Big being relative to what I have done before.

On other news, I've uploaded the [at the time] current versions of cConsole, my console-manipulation class (done but not polished, as the todo list states), and the source code and executable for "Consolian Arenamatic", my program for Project 1 of the C++ Workshop. Check the to-do list for details.

I've done away with the 'keys' string in cConsole I mentioned, and I'm working on the store. I've added two classes, armor and weapon, to hold the values for current armor and weapon ("*player.equip[0] = new armor", for example, though 'equip' isn't in player.h in the uploaded .zip), and now I just have to work on the store itself, and buying stuffs. Yay. Then I go on to the arena.

Hmm. Does anyone even read this, besides Programmer16? If you do, please comment... I feel all alone. [sad]

EDIT: I just realized the .zip had a VERY old version of the .exe! Oops! [tears]

Twisol

Twisol

 

Updates

First of all, thanks to Programmer16 for his suggestion that I let getKey() take the keys as a parameter instead of just reading the string off of cConsole. I might as well get rid of the 'keys' string now since it's redundant. Thanks P16!

The character creation stuff is nearly done, just have to add in the formula for getting the health of the player. I experimented with making a console.conArt() function that would take some collection of hexadecimal color codes (like how I use output()), a length, a width, and a point in the buffer to start outputting the semi-ASCII art. Well, it was far too difficult to code, so I'm dropping that idea.

After I finish with removing 'keys' and adding the health formula in character creation, I'm moving on to the store. I'll probably have to add "int armor" and "int weapon[3]"; into the cChar class (what I use to hold the player's data). 'armor' basically holds an integer which "means" some unique defence bonus. 'weapon' holds three values: the attack bonus of the weapon, the battle roll(s) needed to count a critical strike, and the critical strike modifier (2 or 3), which means how many more times the attack hits to count for the crit.

Oi. I think I might just make a class "armor" and a class "weapon" to hold these values, then do "player.armor = new armor" or something like that. Seems a bit easier on the brain.

Comments welcome. :)

Twisol

Twisol

 

Wow, this is fun

I made a sort of cin-esque function, except it's specifically for console-buffer type applications like mine. I'm using it in the actual project to have the player input a character name. The kewl thing about it is, not only can you set what keys you want to use (as usual), you can also set precisely where you want the input to appear at.

I'm gonna update my project progress list above my journal, and for future information, 'green' means it's done, and 'lightgreen' means it's practically perfect in my eyes. :D

Twisol

Twisol

 

O_O

I've, like, neglected this thing. Not to mention GDNet+ expired on me. I've moved on from my Arena Battle project.. in retrospect, it was getting kind of convoluted. I'm now working on something totally new for me... Project 1 in the C++ Workshop!

No, seriously, it's new! You have to color the output, so I Googled around and found this. Encapsulating it in a class (cConsole), and setting a few functions for easy manipulation, I've created an easy interface with the console screen. I can color output with output(), and check specific keypresses with getKey().

Oh, getKey().. I just love it. I'll code-tag it here, and explain it, although all you C++ gurus out there should be able to understand it just fine. I just like explaining. :D


char cConsole::getKey()
{
while (true)
{
GetNumberOfConsoleInputEvents(rHnd, &numEvents);
if (numEvents == 0) continue;

INPUT_RECORD *eventBuffer = new INPUT_RECORD[numEvents];
ReadConsoleInput(rHnd, eventBuffer, numEvents, &numEventsRead);

int i = 0;
for (; i {
if (eventBuffer.EventType == KEY_EVENT)
{
int j = 0;
while (j {
if (eventBuffer.Event.KeyEvent.wVirtualKeyCode == keys[j])
{
delete eventBuffer;
break;
}
j++;
}
if (j == keys.length() + 1)
{
i++;
continue;
}
else return keys[j];
}
else
{
i++;
continue;
}
}
}
}






To start with, I have a public string variable in cConsole (don't yell!) that the user can set to, say, "123". This function cycles through any events that occur until a key event occurs. Then it cycles through the 'keys' string I mentioned, checking the key event against each character in 'keys', until it finds a match or cycles the whole string. If the iteration variable 'j' is 1 more than the string length, then it didn't find a match, and it continues. Otherwise, it returns the char that was matched, so the calling function can deal with it.

I love it. :D

Twisol

Twisol

 

It's alive!!!

Ehm.. heylo again. Been a while. >_>

Life's been busy, and I havent had time to code or post on here in a while. I'll try to stamp out my Pikmin (1 & 2) addiction. :p

Just wanted to let everyone know that I have NOT been (a) destroyed by a black hole, (b) eaten by a giant spider, or (c) gotten new speakers.

Oh. Well, maybe that last one.

Twisol

Twisol

 

Italy

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!

Twisol

Twisol

 

Gone for a week

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

Twisol

Twisol

 

TinyXML

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!



"Mana Potion">
A potion of Mana

+10

10
5
1






class item {
string name;
int price;
string desc;
mapint> effects;
int InvenQuant, EquipQuant, StoreQuant;
}



Twisol

Twisol

 

Item loader

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() // Still implementing
{
ifstream gameIn(file.c_str());
string line, prev;
do
{
gameIn >> line;
prev = line;
for (int i = 0; i {
cout ;
if (line == 's')
{
i++;
cout ": S will have ";
for (int it = i; line[it] != '!'; it++)
{
cout i++;
}
cout " object." }
break;
}
break;
cout } while (!gameIn.eof() && line != prev);
gameIn.close();
}


Twisol

Twisol

 

Designing trouble

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*

Twisol

Twisol

 

Arena Battle update

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

Twisol

Twisol

 

Today's AreBat update

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. [grin]

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. [sad]

Twisol

Twisol

 

My current project, among other things

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"); //Calls the constructor (you're probably thinking, "DUH!")

// ... skipping to cStore.h (EDIT: Everything from here down is in "class store")

private:
map shopMap;
string file;
ifstream shopIn;
ofstream shopOut;

/*
*Please pretend there's a public: here... I don't want to have
*to re-indent my code 8 spaces. >_ */
store(string userfile)
{
shopIn.open(userfile.c_str()); //This opens an ifstream with the user-specified file
cout "Loading Store\n"; //Just for testing purposes; I want to make sure I don't break my code somehow.
LoadStore(); //Uh... loads the store?
}

~store()
{
if (shopIn.is_open()) shopIn.close();
if (shopOut.is_open()) shopOut.close();
SaveStore(); //Saves the store to a file
}

void LoadStore()
{
string line, key;
string item[2];
do
{
shopIn >> line; //Gets a line from shopIn every iteration of the do-while
if ((line != (item[0] + '%' + item[1])) && (line != "")) //If the line is not the same as the line before...
{
item[0] = PairSplit(line); //...then parse the line and save the first half here...
item[1] = PairSplit(line, 1); //..and save the second half here.
shopMap.insert(pair(item[0], item[1])); //Insert the key-value pair into the shopMap.
cout 0]] //Debugging cout statement.
}
} while (!shopIn.eof());
}

void SaveStore()
{
shopOut.open(file.c_str()); //opens an ofstream to the user-specified file
if (!shopMap.empty()) //if the shopMap is not empty
{
map::iterator forIter = shopMap.begin(); //iterator starting at the beginning of the map
map::iterator endIter = shopMap.end(); //iterator that stays at the end of the map
string line;
do
{
if (forIter->first != "" && forIter->second != "") //If forIter does not contain null values...
{
line = forIter->first + '%' + forIter->second; //...concatenate them using the %...
cout shopOut //...and print them to the file.
forIter++; //Increment forIter.
}
} while (forIter != endIter);
shopOut.close();
}
}




Uh... that wasn't as explanatory as I wanted it to be. [sad] 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. >_

Twisol

Twisol

 

Brand new journal!

int main()
{
cout loser--;
}


Hehe. [grin]

I actually have no idea what to use my journal for, except for piling my almost hourly troubles with my current learning hobby/project into... and it's text-based, so I know you people will bug me about it being a waste to get GDNet+ when I'm still text-gramming. I just figured now would be a good time to get my parents to get it for me; my father was in a good mood today and I thought I'd ask. (Not that he's always in a bad mood; just that today he seemed a bit more allowing towards computer things.

You know, all this is making me think I should start out with an "about me". That's a good idea. Thanks, "all this". [grin]

Well, to start, my name is Jonathan and I am 13 years old. I have a little sister who bugs me to no end, and two parents who are awesome (my father is one of THE top players on Doom 3 free-for-all multiplayer, and my mother, while often stressing out, is very loving. [grin]). I am a Nintendo semi-freak (I refuse to be tugged over to PSP, although the new name for the Revolution (Wii) is a bit odd, and moreover I am a Legend of Zelda fan[atic]. I started learning to program when I was around 10 (althugh only sparsely, and forgot about programming after a short class in it), then got back into it last year when I was on vacation in Hawaii. Since then I've been learning C++, struggling slightly at pointers and trying my hand at a text-based RPG (which turned out pretty nice, even without prior designing, although the actual gameplay was never done). Currently, I'm working on what I call an "arena battle" program, creating my own headers that you could use to create your own arena game.

That should end the about me section... Tomorrow I'll try to post some stuff about my arena project.

~Link

Twisol

Twisol

Sign in to follow this  
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!