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

Beginnings of an idea...

Sign in to follow this  


After much indecision, I'm ended up writing down how I wanted the code to 'look' from a usage point of view, and designed (read: improvised) a back end which would do this nicely. This usually tends to give me good results when I can't see an obvious way to do things. Unfortunatly it can miss out some more obscure or unexpected edge cases, but those can usually be worked out later (when I've got a good grip on what actually needs to be done).

In this case I've got a fairly heavy emphasis on using names to build stuff from a factory, eg: (psedo code)

spawnEnemy(Config config)
e = EnemyFactory.create(config.enemyName)
w = weapons.find(config.weaponName)
if (!w)
w = WeaponFactory.create(config.weaponType)

What this leaves me with is a way of defining radically different configs, all hidden away inside the factories and created by just using the appropriate name string. This leaves the actual in-game code to just worry about *when* to create stuff, not how.

Its all very hardcoded for now, but eventually these configs will be pulled from xml files or similar. The factories themselves will probably also use xml to define variations on the major types provided.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!