So far, the suggestions on how to incorporate an additional array or list of NPCs which tracks their locations on the current tile map has seem to have assumed that there is a one to one coorespondence between an NPC an a tile. That may not work for everybody''s games, however.
Perhaps several NPCs could share a tile or, if movement is pixel*pixel, several tiles could share an NPC (up to 4 tiles). The first solution that comes to my mind is to have an X and Y pixel offest that is also kept stored. So assuming that a normal array of pointers for the tile map would be something like MapNPC(X,Y), a pixel perfect one would be MapNPC(X,Y,pX,pY) where X and Y are tiles in the map structure and px and py are pixel offests that would be added to the NPC''s location. Of course, this is only important for drawing purposes, and AI considerations like line of sight. Since most sprites are actually located by their top left pixel, there''ll never _really_ be an actual overlap; the top left pixel will only be located on one tile.
And if several NPCs could occupy the same tile then, again, just add another dimension to the array to give something like MapNPC(X,Y,N), where N is the number of NPCs on that particular tile.
[] Sprite and Map structure relations?
Yes, if more than one NPC is going to truely occupy the same cell (rather than "looking" like they occupy the same cell), then I''d need a list of some sort, probably a link list which stores multiple NPCs. For 8/16 bit console RPG clone, I believe this isn''t necessary under most circumstances. At least the type I have in mind are bog standard straight overhead RPG. So I think I won''t bother with that "multiple NPC" situation for the sake of simplicity (as well as being unnecessary for this sort of engine).
rrc2soft: Yes, I''ve already checked the layers with snes9x long time ago. Sometime in 1999 I spent ages looking into all sorts of old console RPGs, to see how everything was organized, including how cells were drawn. ToP was one of the games I looked into. Fish "inside" water and NPCs in shadows are nice. And it''s on a 16 bit Snes as well.
What caught my eye the most, though, are the behavior of those little animals wandering about in towns... I think they make RPG so immersive and increase the liveness. There are plenty of RPGs out there which has cows and dogs and cats walking around with NPCs, but not quite like in ToP. Animals in ToP are really alive... they "behave" like animals, whereas in other RPGs, often animals are just human NPC with a picture of animal - they behave like people.
rrc2soft: Yes, I''ve already checked the layers with snes9x long time ago. Sometime in 1999 I spent ages looking into all sorts of old console RPGs, to see how everything was organized, including how cells were drawn. ToP was one of the games I looked into. Fish "inside" water and NPCs in shadows are nice. And it''s on a 16 bit Snes as well.
What caught my eye the most, though, are the behavior of those little animals wandering about in towns... I think they make RPG so immersive and increase the liveness. There are plenty of RPGs out there which has cows and dogs and cats walking around with NPCs, but not quite like in ToP. Animals in ToP are really alive... they "behave" like animals, whereas in other RPGs, often animals are just human NPC with a picture of animal - they behave like people.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement