Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jritts

RPG programming - NPC's

This topic is 6608 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''m making a RPG in directdraw, and I was wondering if anyone could post some ideas on how to represent characters. I was gonna make a base character class that exports general features, like pathfinding, taking/giving damage to another character, etc. Then i''d derive classes for specific kinda of NPC''s, like merchants (a Character with inventory data), etc. Is there a better way to do it? Also, the game isn''t tile-based (i''m using a compressed 2-bit bitmap to define where characters can walk), but i want decent pathfinding. What sort-of algorithm should I use? I''ve never taken on an RPG before, and I''d really appreciate some offerings. if anyone cares to see another project i''ve started, go to http://ieng9.ucsd.edu/~jritts. it''s a spacewar clone with stereo sound and decent particle effects, and it''s sorta fun, and i''d appreciate comments on that too! Thanks! James

Share this post


Link to post
Share on other sites
Advertisement
Sounds to me like you have the right idea for defining characters by starting with a base class from which specific types of characters are derived. It''s the way I would do it.

As for pathfinding, it can get complicated, depending on how complicated your paths are. You may want to do some searching and reading on some of the different ways of doing path-search on binary trees such as depth-first, breadth-first, hill-climbing, and least-cost. It gets a bit into AI, and can be complicated to understand and code though. There''s got to be some examples on the net, or some folk in here who can give you a simpler method though. Perhaps if you briefly explained your path layout a bit more, someone will think of a simple solution for you.

aig

Share this post


Link to post
Share on other sites
quote:
Original post by jritts
...
I was gonna make a base character class that exports general features, like pathfinding, taking/giving damage to another character, etc. Then i''d derive classes for specific kinda of NPC''s, like merchants (a Character with inventory data), etc. Is there a better way to do it?



I remember reading an article somewhere that said instead of deriving a merchant from your base character, derive it from a base clase of something like role or job. This way your character could take on mulitple roles or jobs. For example what would happen if your merchant was also an innkeeper? Your base class of character could have a list of all the jobs it currently has.

This could also work for PC characters. For example, you could have your character as a Knight and as Monk, or a thief and a seer. It also works if your character wants to change jobs, ie your Knight becomes a Paladin. All you have to do is assign it a differnt job or role to play.

When you look at it, the character HAS_A job and not IS_A job.

Andrew


Share this post


Link to post
Share on other sites
Ah, good comments Andrew! I like that way better. You could create two base classes: one from which to derive character creature-types (human, elf, orc, whatever), and one from which to derive roles (innkeeper, merchant, bard, whatever).

Characters "would-be" a creature-type (or even combination of types using multiple inheritance), and "would-have" a list of roles. By keeping a list of roles in the definition of the creature, the creature can change activities easily. Cool!

aig

Share this post


Link to post
Share on other sites
aw man...that really gets me thinking about characters. thanks a lot andrew, that really opens some doors.

about pathfinding, it''ll be strictly 2D. i want to be able to pass a coordinate to a method of the character class and have that function generate an array of waypoints for the character to follow that avoid any obstacle in between current and destination positions. if no obstacles, the array has only one element - the coordinate that was passed.
Where the character can be is defined in a single bitmap, where black is off-limits, white is walkable. The reason I''m using bitmaps to define as much as possible is to make it easy for the artist. I want him to be able to almost completely design a zone with just his tablet.

any more suggestions would be appreciated

-James

Share this post


Link to post
Share on other sites
one thing about the RPG is that there aren''t really any classes per se. a character has stats, and we''ll likely follow AD&D-like conventions for combat, but we''re trying to make the game more about the story than about classes and races and stats. we''re hoping we''ll strike a balance where the game will have the interface flexibility and ease of a PC rpg, and the strong story and also character identity of a console rpg. does that make sense?

-J

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!