Working on the base building class (abstract parent)
4 posters
New Dawn :: Development :: Coding
Page 1 of 1
Working on the base building class (abstract parent)
Can anyone think of anything else that should be included in all buildings:
Here is the basic class design I am working on right now.
Attributes (what a building has)
Behaviors (What all buildings do)
the following rule assumption is being made:
*Buildings start as level zero, but that is for buildings that do not exist. Once the building exists it starts at level one. Therefore, building a new building is actually upgrading a level zero non-exixstant building into a level 1 base level in existance.
Here is the basic class design I am working on right now.
Attributes (what a building has)
- upgrade cost
level
a counter to indicate the number of turns to build or upgrade
a flag for whether the building exits
and a max level
size???
Behaviors (What all buildings do)
- build/upgrade
demolish
repair
get upgrade costs
check pre-req's
the following rule assumption is being made:
*Buildings start as level zero, but that is for buildings that do not exist. Once the building exists it starts at level one. Therefore, building a new building is actually upgrading a level zero non-exixstant building into a level 1 base level in existance.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
sounds good to me. Although I don't think we'll need size or repair. The rest of it is fine, I think, perhaps we need to store the file name of the buildings graphics in there somewhere.
Yeah building levels start a 0 hence there "not built" .
If anyone esle has any ideas keep listing them below
Yeah building levels start a 0 hence there "not built" .
If anyone esle has any ideas keep listing them below
Re: Working on the base building class (abstract parent)
Actually file path and the image/sprite should be in "resource manager" class and renderable class should have a pointer to that image.
Eralpb- Novice
- Posts : 1
Points : 5395
Reputation : 0
Join date : 2009-07-27
Re: Working on the base building class (abstract parent)
perhaps you may show us an example,
p.s Welcome!
p.s Welcome!
Re: Working on the base building class (abstract parent)
Ported over the basic class stuff, mod'ed playerResources files slightly (set the show's to const, implemented an overloaded <<, and a copy constructor for utility purposes).
Have some actual designing stuff written up that I will post momentarily for what I have.
Plan on working on implementing some of the more specific functionality to BuildingClass later tonight (early morning for Europe). I am going to post the code I have right now up in just a few minutes, not really done, but to show everyone where I am going with things. (Will comment the code more fully later tonight as well)
Have some actual designing stuff written up that I will post momentarily for what I have.
Plan on working on implementing some of the more specific functionality to BuildingClass later tonight (early morning for Europe). I am going to post the code I have right now up in just a few minutes, not really done, but to show everyone where I am going with things. (Will comment the code more fully later tonight as well)
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
Right okay chears. I did a few basic data sets for buildings earlier I'll post that up for you to have a look at. Its prety much the same as before though so I dunno if it'll be any use to you.
Re: Working on the base building class (abstract parent)
Alright, have a real dirty prototype up, still need to add a few functions but it is starting to behave a little more like we want. I uploaded the current files to the Wiki again, until the SourceForge gets taking care of.
I plan to start writing a Building Class documentation so that others can start using it in other areas. However, the biggest client class is going to be a territory class which still needs to be written as well. I emulated it by hard code in my tester file.
Hopefully I will have this document up in the next 24 hrs, and possibly go back and properly comment code. (Other coders, I apologize for the shape of the code right.)
Unfortunately, my academic life is requiring attention so I must attend that for a little while.
I plan to start writing a Building Class documentation so that others can start using it in other areas. However, the biggest client class is going to be a territory class which still needs to be written as well. I emulated it by hard code in my tester file.
Hopefully I will have this document up in the next 24 hrs, and possibly go back and properly comment code. (Other coders, I apologize for the shape of the code right.)
Unfortunately, my academic life is requiring attention so I must attend that for a little while.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
That's still handled relatively easy, provided we still intend on using an array for all possible buildings in the game--We just set the corresponding entry to -1 (cannot be built flag). For that building when the nation reads its buildings from the list if it cannot make that type.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
Edit - Its rather a question of which type of Town Hall is to be built rather than if it can be built or not. Yes your right that a -1 or something would be easy enough to represent that that type of building is not avaliable to the player
Just though of something else we would need when checking if we can build a structure.
As we will eventualy have several different nations to have the option of playing with, we would need to store which building the specific Nations can build.
However I don't think this will need to go in your building class but rather in a seperate NationalClass.
We would then do a check depending on the players nation as to what buildings can be constructed by that nation.
This data should be read in from an external file depending on the Nation that the player selected via an ID.
for example the first building represents the "Town Hall" however on culture may use wood as a primary resource whilst another uses stone.
For this we would need 2 different files for two different "Town Hall" data sets. ie how much it costs etc . . . . . . Depending on which data set the player is to use they will be charged for construction etc accordingly.
The data set that the player is to use should be stored in the "NationFile" according to the players Nation.
territory_1 = { 1, 0, 0, 0, . . . . .
in the Nation File
TOWNHALL townhall_2.txt
whilst another nation may have
TOWNHALL townhall_3.txt
You may have to make a PlayerClass and from there make a referance to a valid Nation via an Id or something.
All we would need to store about the Nation at this time is its name and an Id number as well as the file that it is to read data from.
Make sence . . Perhaps Hairein you could work on this as jsmoore82 is already working on something else
Peter
Just though of something else we would need when checking if we can build a structure.
As we will eventualy have several different nations to have the option of playing with, we would need to store which building the specific Nations can build.
However I don't think this will need to go in your building class but rather in a seperate NationalClass.
We would then do a check depending on the players nation as to what buildings can be constructed by that nation.
This data should be read in from an external file depending on the Nation that the player selected via an ID.
for example the first building represents the "Town Hall" however on culture may use wood as a primary resource whilst another uses stone.
For this we would need 2 different files for two different "Town Hall" data sets. ie how much it costs etc . . . . . . Depending on which data set the player is to use they will be charged for construction etc accordingly.
The data set that the player is to use should be stored in the "NationFile" according to the players Nation.
territory_1 = { 1, 0, 0, 0, . . . . .
in the Nation File
TOWNHALL townhall_2.txt
whilst another nation may have
TOWNHALL townhall_3.txt
You may have to make a PlayerClass and from there make a referance to a valid Nation via an Id or something.
All we would need to store about the Nation at this time is its name and an Id number as well as the file that it is to read data from.
Make sence . . Perhaps Hairein you could work on this as jsmoore82 is already working on something else
Peter
Re: Working on the base building class (abstract parent)
Alright, added the research field to the base building class, cleaned up the code, and also commented the class. Hope this looks a lot better. Still have to-do's on it but this does allow a better documented sense of how I am trying to approach the problem. Posted to the wiki as I am pending on sourceForge.
Appreciate feedback on the code if possible.
Thanks.
Appreciate feedback on the code if possible.
Thanks.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
Chears!, I'll have a look tonight, see what I can do. I'll update the researchClass then to a similar layout, if you havent done so already.
Can you come up with a list of potental buildings that we may include in the Game please. with a few stats to go with them, if you have time?
I think I've got someone else who wants to code for us as well so that'l reduce everyones work loads
peter
Can you come up with a list of potental buildings that we may include in the Game please. with a few stats to go with them, if you have time?
I think I've got someone else who wants to code for us as well so that'l reduce everyones work loads
peter
Re: Working on the base building class (abstract parent)
That would be nice to have another coder on board. If we could get the territory or player classes started and have a design doc for them, it would make that go a little quicker and we could actually start tying systems together.
I will start working on prototyping other building types to start flushing out both the base and children classes a little more, but that is going to keep me busy for awhile. I also need to start working with the building .csv file for its fields for easier reading and also forward looking into database management system.
I will start working on prototyping other building types to start flushing out both the base and children classes a little more, but that is going to keep me busy for awhile. I also need to start working with the building .csv file for its fields for easier reading and also forward looking into database management system.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
From what Ive looked at it looks good, although I did a bit of fiddiling, and I found that when a building is made the resources aren't deducted, neither dose the program stop if the player is lacking a particular resource.
I half fixed this by inserting this line of code
perhaps you haven't had time to look at this yet. As the player after building the blacksmith still had the same amount of resources.
I half fixed this by inserting this line of code
- Code:
if((doesPlayerHaveEnough(player, build.getUpgradeCost()) == true) && (doesTerritoryHaveIt(build.getBuildingsRequired(), territory_1) == true))
perhaps you haven't had time to look at this yet. As the player after building the blacksmith still had the same amount of resources.
Re: Working on the base building class (abstract parent)
yeah, I haven't gone back and updated the tester yet. Broke my laptop screen the other day travelling to school so my productivity is going to be really hampered for a little bit. But, I am planning on posting more later.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
Admin wrote:
Make sence . . Perhaps Hairein you could work on this as jsmoore82 is already working on something else
Peter
Hi all,
i'm still working on the top-level architecture for the 3d client and hope to post this weekend or early next week. After that, i'll be available for any further low-level designs, although personally i'd prefer to continue defining the systems top-to-bottom since that's how i'm used to working.
I'll contact admin once i've finished my current task, then he can decide.
Hairein- Regular
- Posts : 32
Points : 5462
Reputation : 3
Join date : 2009-07-28
Age : 54
Location : Aachen, Germany
Re: Working on the base building class (abstract parent)
I don't mind doing the lower level stuff, its about where my skill level is at currently. I will try to meet you in the middle as we develop. Can you do me a favor and look at my code that I have submitted so far for the building class to make sure it will be compatible with the system you are designing. I don't see why it shouldn't be, it is just the basic background logic. I believe the graphics can be layered on top and handled through a wrap type sytem.
Thanks.
Thanks.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
Hi can you post any work youve done this week onto the wikik please. Back from Ireland, now, so I have access to the internet once again
Re: Working on the base building class (abstract parent)
posted the last two weeks not much was done for it was finals week at school and my kids were on their last week of visiting from my ex-wife before they go home this evening. Started work on the file reading system an have included examples of what I am working with as terms of readng. I need to goback and readjust the overloaded extraction operators to work more with this data input. Right now they are just power reading it from any source.
Also, I need to still reupdate the tester file to fully exploit the building class in a morerobust way and show off the features of the last three builds that I have done.
I am sorry I have been slacking. I will try to make up for it over the next couple of weeks while school is out of session.
Also, I need to still reupdate the tester file to fully exploit the building class in a morerobust way and show off the features of the last three builds that I have done.
I am sorry I have been slacking. I will try to make up for it over the next couple of weeks while school is out of session.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
no problem. I'll look at it in a minute. I had a brief look Monday, and I can see that a lot of work has gone into your code.
One tiny thing though, has the Upkeep.cpp file acctualy been made, just that it wasan't in your zip file, ta
I've done a bit more programing myself, for the Unit side of things. Not sure if its the right way to go but I've posted my work for it so far onto the wiki.
One tiny thing though, has the Upkeep.cpp file acctualy been made, just that it wasan't in your zip file, ta
I've done a bit more programing myself, for the Unit side of things. Not sure if its the right way to go but I've posted my work for it so far onto the wiki.
Re: Working on the base building class (abstract parent)
The upkeep class wasnt modified since I originally posted it in the 31July09.zip file. But if you would want me to repackage I can do that later when I get back from work later.
jsmoore82- Regular
- Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA
Re: Working on the base building class (abstract parent)
It's alright, i already got it from your previous upload
Similar topics
» Working on the base Research Class
» Sample class dialog between player, territory, and building to build or upgrade
» Reading Building data from file
» What I am working on at the Moment READ!
» Renaming playerResources class
» Sample class dialog between player, territory, and building to build or upgrade
» Reading Building data from file
» What I am working on at the Moment READ!
» Renaming playerResources class
New Dawn :: Development :: Coding
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Sun Jun 20, 2010 7:45 pm by Admin
» Events are happing
Wed Apr 14, 2010 11:29 pm by Admin
» Progress! . . .
Fri Apr 09, 2010 5:10 pm by Admin
» Soulmen(jordan)
Wed Feb 24, 2010 7:56 pm by soulmen
» Basic starting blocks
Wed Feb 24, 2010 7:41 pm by Admin
» Okay so uni isn’t so demanding as I first thought.
Mon Oct 26, 2009 4:39 pm by Admin
» MP Architecture: Client/Server or Peer-2-Peer?
Sun Oct 04, 2009 2:34 pm by Daemn
» What I am working on at the Moment READ!
Fri Sep 25, 2009 5:15 pm by Admin
» Development Framework available at SourceForge
Tue Sep 22, 2009 9:46 am by Hairein