New Dawn
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Latest topics
» The good, the bad, and the ugly
Working on the base building class (abstract parent) EmptySun Jun 20, 2010 7:45 pm by Admin

» Events are happing
Working on the base building class (abstract parent) EmptyWed Apr 14, 2010 11:29 pm by Admin

» Progress! . . .
Working on the base building class (abstract parent) EmptyFri Apr 09, 2010 5:10 pm by Admin

» Soulmen(jordan)
Working on the base building class (abstract parent) EmptyWed Feb 24, 2010 7:56 pm by soulmen

» Basic starting blocks
Working on the base building class (abstract parent) EmptyWed Feb 24, 2010 7:41 pm by Admin

» Okay so uni isn’t so demanding as I first thought.
Working on the base building class (abstract parent) EmptyMon Oct 26, 2009 4:39 pm by Admin

» MP Architecture: Client/Server or Peer-2-Peer?
Working on the base building class (abstract parent) EmptySun Oct 04, 2009 2:34 pm by Daemn

» What I am working on at the Moment READ!
Working on the base building class (abstract parent) EmptyFri Sep 25, 2009 5:15 pm by Admin

» Development Framework available at SourceForge
Working on the base building class (abstract parent) EmptyTue Sep 22, 2009 9:46 am by Hairein

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Working on the base building class (abstract parent)

4 posters

Go down

Working on the base building class (abstract parent) Empty Working on the base building class (abstract parent)

Post by jsmoore82 Sun Jul 26, 2009 3:40 am

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)
  • 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
jsmoore82
Regular
Regular

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Sun Jul 26, 2009 11:13 am

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

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Eralpb Mon Jul 27, 2009 1:08 pm

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
Novice

Posts : 1
Points : 5395
Reputation : 0
Join date : 2009-07-27

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Mon Jul 27, 2009 1:12 pm

perhaps you may show us an example,

p.s Welcome! Smile

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Tue Jul 28, 2009 9:17 pm

how is this coming along now?

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Tue Jul 28, 2009 9:24 pm

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)
jsmoore82
jsmoore82
Regular
Regular

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Tue Jul 28, 2009 9:28 pm

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.

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Wed Jul 29, 2009 4:53 am

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

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Thu Jul 30, 2009 9:13 pm

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
jsmoore82
Regular
Regular

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Thu Jul 30, 2009 9:30 pm

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

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Thu Jul 30, 2009 9:41 pm

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

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Thu Jul 30, 2009 9:57 pm

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

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Thu Jul 30, 2009 10:10 pm

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

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Wed Aug 05, 2009 7:17 pm

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

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.

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Wed Aug 05, 2009 9:19 pm

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
jsmoore82
Regular
Regular

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Hairein Thu Aug 06, 2009 10:06 am

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
Hairein
Regular
Regular

Posts : 32
Points : 5462
Reputation : 3
Join date : 2009-07-28
Age : 54
Location : Aachen, Germany

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Thu Aug 06, 2009 10:49 am

okay no problem

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Fri Aug 07, 2009 2:54 am

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

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Sun Aug 16, 2009 10:41 am

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

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Sun Aug 16, 2009 5:51 pm

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

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Tue Aug 18, 2009 1:55 pm

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.

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by jsmoore82 Tue Aug 18, 2009 4:21 pm

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
jsmoore82
Regular
Regular

Posts : 46
Points : 5495
Reputation : 1
Join date : 2009-07-25
Age : 41
Location : Spokane, WA

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Tue Aug 18, 2009 4:23 pm

It's alright, i already got it from your previous upload

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Admin Fri Aug 21, 2009 8:27 pm

Hi, how is this coming along now?

Admin
Admin
Admin

Posts : 105
Points : 5617
Reputation : 3
Join date : 2009-07-16
Age : 34
Location : Wrexham, United Kingdom

https://spartanstudioforum.darkbb.com

Back to top Go down

Working on the base building class (abstract parent) Empty Re: Working on the base building class (abstract parent)

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum