Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 29

Author Topic: My C++ Projects - Tower of Azari v0.31 - "I'm not dead yet."  (Read 52007 times)

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
My C++ Projects - Tower of Azari v0.31 - "I'm not dead yet."
« on: September 06, 2009, 12:24:38 pm »

   I've been interested in video game design and programming since I found RPG Maker about 6 or 7 years ago, and I'd been interested in designing board games well before that.  RPG Maker is a little limiting though and I found Game Maker a short while afterwards ('05 ish).  It didn't take me long to pick up, although I never really finished any full projects for a varriety of reasons.  A few months ago I picked up a book on C++.  I'd tried to teach myself before and failed, but this time I was determined.  I've been teaching myself as much as I can as quickly as I can ever since.  In doing so I've made a number of games and utilities, and I've decided to release them, open source, to get some constructive critisism.

   Back in October '09 I started work on a Rogue-Like game entitled "Tower of Azari".  It's really progressed very well, thanks to the advice and support of the Bay12 community.  I'm currently working on rewriting it from scratch, as my coding style has progressed a lot since I started it; it had become a tangle of old and new styles and was becoming difficult to manage. 

   Below is a list of my projects, along with descriptions and links (in the spoilers).  Download whichever games pique your interest, enjoy, and please come back to let me know what you think, and what I could do to improve them!  If you know C++, the source code for every project is included in the download.  Some of my more recent projects require PDCurses to compile; there are instructions in the "Tower of Azari" v0.30 README file on how/where to "install" PDCurses to work with my projects.

   In addition to the source code, I've included the Code::Blocks (or for more recent releases, Visual Studio C++, Express Edition) project file, so if you're using Code::Blocks (or any other IDE that can open a Code::Blocks project file) you should be able to simply load the project, and all the files and linker/compiler settings will be loaded for you as well.

   I keep a "DevBlog" of my progress in a Wordpress blog as well as here, on the Bay12 forums.  The only difference, is that discussion between releases takes place here on the forums, while the DevLog is reserved for announcements.  You can find the DevBlog here.



PROJECTS

Tower of Azari
Spoiler: Description (click to show/hide)
Spoiler: Links (click to show/hide)

Warlock Spell Parser
Spoiler: Description (click to show/hide)
Spoiler: Some Background (click to show/hide)
Spoiler: Links (click to show/hide)

Sudoku Solver
Spoiler: Description (click to show/hide)

Dwarf Caretaker
Spoiler: Description (click to show/hide)
Spoiler: Some Background (click to show/hide)

Minor Projects
Spoiler (click to show/hide)
« Last Edit: September 22, 2010, 08:19:35 am by timmeh »
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

skaltum

  • Bay Watcher
  • DRAW!
    • View Profile
Re: My C++ Projects (Dwarf Caretaker v0.3)
« Reply #1 on: September 07, 2009, 12:32:51 am »

hmmmmm. i'll give this a try
Logged
I just realized, after adding the new body parts to the other races, that I have an entire squad of dwarves with a shield in each hand and swinging their axes with their penises. There's nightmare fuel for those goblins, in more ways than one.

skaltum

  • Bay Watcher
  • DRAW!
    • View Profile
Re: My C++ Projects (Dwarf Caretaker v0.3)
« Reply #2 on: September 07, 2009, 12:41:50 am »

okay this is an interesting text base game. well done. you have spelt oppenent wrong by saying oppenant. ale appears to not cost any DB. it may be unintentional. the food purchase works fine. sparring is somewhat a challenge but thats a good thing. healing is quite good. i'll give you more feedback later.

[EDIT] waiting does not contribute to hunger and thirst.
Logged
I just realized, after adding the new body parts to the other races, that I have an entire squad of dwarves with a shield in each hand and swinging their axes with their penises. There's nightmare fuel for those goblins, in more ways than one.

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: My C++ Projects (Dwarf Caretaker v0.3)
« Reply #3 on: September 07, 2009, 08:13:43 am »

okay this is an interesting text base game. well done. you have spelt oppenent wrong by saying oppenant. ale appears to not cost any DB. it may be unintentional. the food purchase works fine. sparring is somewhat a challenge but thats a good thing. healing is quite good. i'll give you more feedback later.

[EDIT] waiting does not contribute to hunger and thirst.

Awesome, thanks!

The ale problem definitely was unintentional, and has been fixed.  It would check to make sure you had enough money, but didn't take the money afterwards.  Waiting has been fixed, I sorta forgot and passed over it before.  It has no real purpose at the moment, but I may add something in later.

I've fixed everything you mentioned now, and I'll upload it in a bit... thanks again!

[EDIT]:
v0.4 Update:
  • Bug Fix - Ale was free
  • Bug Fix - "Opponent" was spelled wrong
  • NEW - Waiting now makes you hungry/thirsty and passes the time.
  • NEW - You can now choose how difficult you want a fight to be.  At the moment, easy is the same as moderate unless you have at least 3 toughness.

v0.5 Update:
  • NEW - Complete re-write to clean up code and make future developement easier.
  • NEW - Winning a sparring match now increases toughness by 0.5 and happiness by 15, losing causes a loss of 15 happiness, and win or lose you get hungry and thirsty.
  • NEW - When quiting you can choose to save and exit, exit without saving, or not exit at all.
  • NEW - Heavy and Light work have been combined into "Work", and are options given to you after choosing to work.

New download link in the original topic, the next version (v0.6) is likely to have a much stronger resemblance to DF, such as food options like plump helmet or cat tallow biscuits and job options like crafting, mining, masonry, etc.
« Last Edit: September 07, 2009, 03:46:56 pm by timmeh »
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

skaltum

  • Bay Watcher
  • DRAW!
    • View Profile
Re: My C++ Projects (Dwarf Caretaker v0.5)
« Reply #4 on: September 07, 2009, 05:44:08 pm »

okay i've tested the new version and i can say the improvements are good. the only problem is that while hunger and thirst can cap at 100 the player wont suffer any negative affects and i consider this an unfortunate exploit. the happieness also unfortunatly does nothing at one. i can understand these seing as it is a very early games. but heres the list of bugs i have found.

*hunger and thirst dont kill the player
*the save files cannot be loaded. (either that or i dont know how to) my bad. i didn't realise i had to type my dwarfs name again  ::)

heres a few suggestions i think might help

*perhaps a death screen asking if you'd like to retry
*perhaps every 5 years the fort could be attacked and you will be drafted to fight the enemy
*a load system.
*HP increases every 5 toughness maybe

now i really dont mean to sound mean and of course it's and early game but heres my contribution anyway.

P.S.  i've read the readme included :)

p.s.s good work :D keep it up :)
« Last Edit: September 07, 2009, 05:46:38 pm by skaltum »
Logged
I just realized, after adding the new body parts to the other races, that I have an entire squad of dwarves with a shield in each hand and swinging their axes with their penises. There's nightmare fuel for those goblins, in more ways than one.

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: My C++ Projects (Dwarf Caretaker v0.5)
« Reply #5 on: September 07, 2009, 05:51:42 pm »

Thanks!  The hunger and thirst thing is definately a bug.  I had it working before the re-write, guess I forgot it in the new version...  :-[

The death screen is definitely a good idea, and special events would be great!  As far as toughness->HP goes, I'll see what I can do, I like the idea, and with the new code, I may be able to implement it without too much trouble.

Thanks again!


v0.6 Update:
  • BUG FIX - Player can die of starvation and dehydration again.
  • NEW - The maximum damage to any wound is increased by 1 for every 3 levels of toughness..
  • NEW - Death screen asking if you want to quit or restart.
  • NEW - ASCII art title screen!
  • NEW - Renamed and added choices to eat, drink and work to better represent DF.
  • NEW - Leaving happiness at 1 can now result in your dwarf commiting suicide.
Link in original post.  I think save compatability was trashed with this release, as the game now saves the number of turns you've been starving/dehydrated/depressed.  Old games appear to load fine, and don't throw any errors on me, but may have some strange bugs later.

Thanks for your help with this skaltum.  Seriously, I've never really managed to get far with anything like this cause I always have trouble getting anyone to test-play them and give some decent critique, ideas and bug reports...

Speaking of which, it's getting late on a school night for me, so while I won't be doing any more coding tonight, I should be able to at least have a couple special events planned and the implimentation figured out by tomorrow night.
« Last Edit: September 07, 2009, 09:32:19 pm by timmeh »
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

skaltum

  • Bay Watcher
  • DRAW!
    • View Profile
Re: My C++ Projects (Dwarf Caretaker v0.6)
« Reply #6 on: September 08, 2009, 07:22:10 am »

okay i'm testing it and so far the improvements are working.

i have found an unfortunate exploit. on the death screen. if the player dies of starvation or dehydration the reset screen works fine but by pressing any other key than the ones specified it will take the player straight back to the status screen just after they die. unfortunatly this means the pump bug is still active :(


the body part HP increases correctly. works
death screen. works
starvation and dehydration will kill the player. works
DB. still works :)

bugs

*the death screen can be cheated by pressing any key other than the ones specified
**this leads to the pump bug still being active
**and cheating death
* i dont know if this is a bug or not but the dwarf doesn't seem to commit suicide. could possibly be that i wasn't depressed enough turns.
*by holding any key other than the task ones on the status screen the dwarf will avoid any stat changes but will still age.
*the sparing damage appears to be overpowered. i played moderate and dealt 14 dmg in a punch and got kicked for 19 dmg. with 19 toughness.


and this is what i've found so far. and again good work :D this is great work for a fledgling C++ game.

p.s  i've never coded in C++ before.
Logged
I just realized, after adding the new body parts to the other races, that I have an entire squad of dwarves with a shield in each hand and swinging their axes with their penises. There's nightmare fuel for those goblins, in more ways than one.

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: My C++ Projects (Dwarf Caretaker v0.6)
« Reply #7 on: September 08, 2009, 06:07:29 pm »

Spoiler (click to show/hide)

New version, yay!  :P

Fixed the bugs you found for me, and added random sieges (1/500 chance or so, but only if your toughness is at least 5).  I reworked the combat, but I'm still not particularly happy with the lower-level numbers... that being said, the higher level combat is no longer quite so ridiculous :P

Thanks!

v0.7 Changes

BUG FIXES:
  • Death screen now quits when any button other than those specified is pressed.
  • Pressing button that isn't tied to an action on the main screen no longer passes time without stat changes.
CHANGES:
  • Combat rebalanced, easy/hard fights may be even easier/harder earlier on, but as you progress they get more and more balanced.
  • Some combat text reworded to match the rest of the game's 3rd person setting.
NEW:
  • Damage reports in combat now let you know what wound was hit.
  • Job related game-overs sometimes report a specific part as well.
  • The fortress will be attacked from time to time, and if your dwarf is tough enough s/he will be drafted for it's defense.
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

chaoticag

  • Bay Watcher
  • All Natural Pengbean
    • View Profile
Re: My C++ Projects (Dwarf Caretaker v0.7)
« Reply #8 on: September 09, 2009, 05:52:52 am »

Blocking causes my game to freeze...
Logged

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: My C++ Projects (Dwarf Caretaker v0.7)
« Reply #9 on: September 09, 2009, 06:22:35 am »

10 Seconds?! NO!!! What have you done to us!!!  :P

Anyway, an unhandled exception occurs when I spar.  I punched twice and poof.  Program is gone.  I tried the other stuff and it seems to work fine but there's something wrong in the sparring section.

I'm using Windows XP.
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: My C++ Projects (Dwarf Caretaker v0.7)
« Reply #10 on: September 09, 2009, 06:51:43 am »

I'll comment on some things I've been corrected in the past by people who knew much more than me.

Why are the variables declared as global?  That's a bad idea.  You should declare variables within the scope you intend to use them.

There's some functions, like int Wound(int *wounds, int number) that you aren't using.  It would be good to comment that so you know what is really relevant and what may be removed.

I see you using rand()... what seed are you using?  I can't find one...

What do you know about classes?  structs?

If you use a class you will be able to have all those variables belonging to it so you will only need to pass the class variable in the function instead of passing all of the separate variables:
Before:
Load(string name, long int &age, int &hunger, int &thirst, int &happiness, double &toughness, int &dwarfBucks, int &starving, int &dehydrate, int &suicide, int *wounds)

Load(cNameOfClass &localname);

You will be able to reduce the amount of paramateters passed on all of your functions and won't have to change them if you decide to add a new variable (e.g. Intelligence) to your class.

---------------
More trivial stuff:
It is a good idea to give each file you save or use a specific extension to recognize it.  e.g. ".sav"

A comment in the line above each function explaining what it does is a good idea too.  So one can see what type it returns, what are the parameters and the name and have a brief description about it without having to read the code.
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: My C++ Projects (Dwarf Caretaker v0.7)
« Reply #11 on: September 09, 2009, 07:46:33 am »

Hmmm... I'll look into the sparring as soon as I finish school...

I can move the variables around some.  I didn't really have a full understanding of variable scope when I put them there, but that's really my only excuse :P

The Wound() function is being used in the actWork() function to give out the random wounds you can receive when doing more dangerous jobs, and I plan on re-writing it to allow me to use it everywhere else wounds are dealt before the next release.

Dang you're right... I had been seeding it with the time, I guess I forgot to put that back in when I did the re-write... that'll definitely be fixed.

I don't really know anything about structs, but I understand classes.  I didn't realize I could do that though, so I'll look into changing that too.

Oddly enough, I tried adding a suffix to save files when I first implemented them and got an error... I'll try again and see what happens.

And comments... yeah... I really have not been making enough recently, I know... I'l probably go through and add comments to most of it before I re-release.

[EDIT]:  @Alexhans - I don't think punching twice was the problem, as once I told it to seed the rng with the time again I could punch twice.  The problem appears to be with you or your opponent blocking, and the default seed had him blocking if you punched twice.  Working on figuring out why...

[EDIT2]:  Never mind... I feel like an idiot now...  can't divide by zero, so finding the remainder of rand()/int(tough/4) didn't work when tough/4 was rounded to 0...  working on a solution now...
« Last Edit: September 09, 2009, 09:14:44 am by timmeh »
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: My C++ Projects (Dwarf Caretaker v0.7)
« Reply #12 on: September 09, 2009, 09:39:42 am »

the unhandled exception is an Integer division by zero.

[edit 11:55 GMT - 3]I didn't see your Edits... :P  Glad you found the mistake.
« Last Edit: September 09, 2009, 09:55:41 am by Alexhans »
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: My C++ Projects (Dwarf Caretaker v0.7)
« Reply #13 on: September 09, 2009, 12:34:07 pm »

Well, I've run into a bit of a problem... I've rewritten most of it to use a class for the dwarf instead of global variables, but for some reason the functions I wrote to change the dwarf's stats don't appear to be working...

Example Function:
Spoiler (click to show/hide)
Example Call:
Spoiler (click to show/hide)

They pretty much all look like that, 'cept a couple use different variable types, and the wounds array one is a little more complicated.  What bugs me, is that it returns the value just fine, in the example above, happiness is displayed just fine, but in this example:
Spoiler (click to show/hide)
it doesn't actually change happiness...

I'll look into it some more and edit this post when I figure it out...

[EDIT]: Got it!  I should have been passing a reference to the existing dwarf instance, not a new one, as I was apparently doing.  Fixed that problem, new version should be up soon.
« Last Edit: September 09, 2009, 01:07:02 pm by timmeh »
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: My C++ Projects (Dwarf Caretaker v0.7)
« Reply #14 on: September 09, 2009, 02:19:56 pm »

great  :)

as a gameplay suggestion... wouldn't it be cool to have status names instead of just numbers?  They would be more descriptive and more ambiguous.   

80-100:  Starving
60-80: Hungry
40-60: Somewhat hungry
20-40: Satisfied
1-20: full.

You get my drift.

Maybe it's not the wisest thing to do if you want to check the values in the console but it might be a good trait for the future.
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.
Pages: [1] 2 3 ... 29