Jump to content
Sign in to follow this  
  • entries
    45
  • comments
    115
  • views
    54990

Day 4

Sign in to follow this  
Kylotan

366 views

After much wrangling with the useful-but-crashhappy KDevelop, I hacked in the latest stuff into my tactical shooter. It now has 5 characters on the map, each of which will follow its own path simultaneously.

As always, I prototype things in the quickest way possible to get them working and then migrate all the globals into locals or members, etc. Regarding large designs and object models, I work on the principle of You Aren't Gonna Need It, which is a deliberately exaggerated way of saying you shouldn't design elaborate objects that are theoretically suitable for any purpose and reusable, when you may not end up using a lot of that functionality. Right now my Character class just looks like this:

class Character
{
public:
Character();

public:
int x, y; // position
Path currentPath;
int currentPathNode; // index into currentPath
};


It's not elegant, and it is certainly going to grow as development continues. But there's little point me enumerating all the future methods now, because they will still change after that point. Similarly, the second public block will eventually become private, but I am waiting to see what sort of access patterns the code requires before I decide on an accessor interface that will allow me to make the members private.

My next day of coding may feature a change from tile-based movement to pixel-based movement. Characters already use the finer-grained coordinates so in theory this should just be a case of adding in an interpolation layer to move a couple of pixels at a time and a detection routine to see if the character is in the middle of the destination tile yet (with a little margin of error).
Sign in to follow this  


0 Comments


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!