Archived

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

Andre Luiz Silva

Sprites awareness of a game world

Recommended Posts

Hello everybody, First of all - Merry Christmas!!! How do you guys usually "tells" your sprites (monsters, enemies, NPCs) about the places they can stand, walk, area of attack, etc in the game world? Would like to see your different approaches of this same problem... Thanks, Andre "- To begin with, said the Cat, a dog''s not mad. You grant that? - I suppose so, said Alice. - Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."

Share this post


Link to post
Share on other sites
no, what I am trying to say is about ways to do the collision detection between sprites (animated ones) and the ground, plataforms, etc...

"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."

Share this post


Link to post
Share on other sites
First of all, I''m brazillian too, but I''ll post in english just to keep things understandable to all
Well, it depends heavily on what approach you are using to render the "world" (tile-based, single bitmap, 3d scene, etc) and also how are you rendering the graphics (DDraw, D3D). Could you specify a little more what you are trying to do?

There are 10 kinds of people: those who know binary and those who don''t

Share this post


Link to post
Share on other sites
The most strait forward way would be to do it that same way you do with the player....this works the same regaurdless of graphical presentation (2D, 3D, whatever).

Basicly each sprite would contain some sort of indicator (pointer, whatever) to the "controller object"...for the player charaacter this would point to a function that gathers player input...for the monsters it would point to the particular AI function that supplies input...then when processing each monster, character, NPC, whatever...you use the "controller object" to get the particular direction the sprite is to travel...then just run this through the collision routines (passing arguments like sprite location, size, and any special flags (like "can walk through walls" or whatever) the routine returns true/false if the move was possable...and there you go....this is very simple, and allows for a lot of flexability (for example scripted cut scenes involveing the player character...just change the "controlling object" pointer to the scripted sequence...and when done reset it back to the player input routine).

But this only deals with the basic control of sprites...to find what direction a sprite should move is a subject best asked in the game AI forum

Share this post


Link to post
Share on other sites