Advertisement Jump to content
Sign in to follow this  

How would you approach this?

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been thinking recently about my current project, and one thing that seems like it would be useful is some sort of generic construct to define a work in progress. That is, something that isn't a 'complete' game object, but defines a completed game object. This is a turn based 4X game project, and some examples of this would be: - A building project, which has a technology pre-requisite, requires workers to labor on it, and provide it natural resources. - Race customization, where the player picks different bonuses/detriments, which will have their own pre-requisites, or cost. - Spaceship design, where the various parts will have different pre-requisites or restrictions. I imagine these portions would generally be done more explicitly in most games. I think there's a strong correlation, and some sort of definition code would be most useful, and might spread to other areas which make them work more nicely with the 'production' part. So, how would you approach this sort of code? What things do you think would be important to focus on? [edit: In C++, though if another language solves this problem far more elegantly, it would be interesting to know.]

Share this post

Link to post
Share on other sites
Okay, how about this sort of general setup?

A project may provide entries, which describe what it has. Keywords for the entires will be something like provide, cost, require, invalidate, restrict.

Entries would then follow something like:

<keyword> <string-key> <serialization>

provide would declare things that the pick/project/whatever provides. This could be a game object, or a line of serialization to be passed along to the final construct. It might just be a flag or status which is required by others.

cost would be something that removes a certain number [for numeric entries] or else the construct is incomplete/invalid.

require would be something that does not remove a certain number [for numeric entries] but that value must exist or else the construct is incomplete/invalid.

invalidate would be something that immediately incompletes/invalidates the construct for whatever reason [which is likely to be the string-key].

restrict will likely be some sort of functor to prevent certain work, or invalidate the construct if certain conditions aren't met [like building a landlocked seaport].

Though this still seems terribly unwieldy, and the implimentation fairly complex...

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!