Page 1 of 1

Enemy with health , armour ...

Posted: Fri Nov 30, 2007 12:13 pm
by IRR007
Hi
I'm working on my next game and i got a problem , i don't know how can i add enemy in my game with theirs own health and armour.
Someone can help me,show me the right way, the best way to add this or a simple code :D ?
Thanks. :wink:

Posted: Fri Nov 30, 2007 12:21 pm
by Steel Style
"Lean C++" can be a 2 word reponse.
Or create a class called "ennemy" which contains IAnimatedMeshSceneNode, int Health and int Armor.

Posted: Fri Nov 30, 2007 12:22 pm
by JP
You'd have a class to encapsulate all your enemy code, including variables for their health and armour etc.

Then you'd create instances of that class to represent your enemy and when they got hit by a bullet you'd decrease their health/armour.

Agent class (Artificial intelligence)

Posted: Fri Nov 30, 2007 2:05 pm
by Danny Gilbert
Nothing to do with IRRLICHT engine. Irrlicht is for 3D/2D scene, this is a graphic engine with some bonus. To "manage" player, friend, enemy, all characters in your game, this is an AI (artificial intelligence) issue.

Look for AGENT, steering behavior, path finding engine, physical engine, goal engine, etc. You need to create a base class that is an Agent. After that, your Agent can be any kind of "character" you want with PROPERTIES and METHOD like size, max speed, mass, acceleration, energy, number of life, etc. Method can be like EAT, CHASE, SEEK, ATTACK, DEFENDS, WALK, etc. This is a big issue. If you know C++, you know what is object programming and AGENT is an object with properties and method.

A more ABSTRACT class could me a MovingEntity. You can
create Agent as a derived class of MovingEntity and create other Vehicule class (like car, boat, plane, etc.) as a derived class of MovingEntity.

Big hint..... Read MORE about Artificial Intelligence. Irrlicht will be use only to show your Agent or Vehicule in the 3D scene. Nothing more. In your agent, you can have a Property that is a pointer to a Billboard with position. The Irrlicht Engine, when will Update the Agent, will show the billboard at the good position.

Have fun ! (lots of work to do but very interesting !)
:)

Posted: Fri Nov 30, 2007 2:56 pm
by IRR007
I was afraid you could say to use classes :? ,i dont understand to good classes ,can someone show me a simple code how to use classes , or an example of enemy classes with some variables like health , armour , etc :? ?
Thanks

Posted: Fri Nov 30, 2007 3:10 pm
by ultran00b
I don't really support spoon-feeding people code, but I will provide a link to a tutorial here. And a few other words: "When in doubt, Google it!".

Hummmm !

Posted: Fri Nov 30, 2007 3:17 pm
by Danny Gilbert
Sorry for y :wink: ou, but if you want to create a 3D video game with some kind of "intelligence", you are now in the MAJOR LEAGUE of software engineering.

There are "billion" of examples and book about Object Oriented Software
and you really need to be strongly familiar with this before "trying" to code software (game). Maybe you can understand easyly how to create one class and some instance of this class but it is far more complicated to create a video game with many instance (agent, trigger, vehicules) with interaction between each one. You NEED to KNOW STL (Standard Template Library) to manipulate bunch of object (instance). You need to understand INHERITANCE, VIRTUAL CLASS and FUNCTION, POLYMORPHISM, etc. STL will help you manipulate LIST, MAP, VECTOR, and so on. You need to control list of agent (or instance), list of drawing and animation items, etc. You can also learn DESIGN PATTERN in C++.

My big guess is that you need to design object oriented software for at least 2 or 3 years before trying to design video game. As I said before, you are in MAJOR LEAGUE without knowing coding OO software !!!

Maybe you can try with some small puzzle game or Card game.
Try finding Object Oriented software around CARD GAME.
It could be a good start. You need to start at the beginning.

Good luck !
:wink:

Posted: Fri Nov 30, 2007 3:43 pm
by rogerborg
OO isn't necessary, especially as a sole developer. It's perfectly possible to write an entire game in C (or any other non-OO language).

To begin with, find out what a struct is. Once you've familiar with the idea of defining, declaring and using a single object containing multiple types of data, then you can take the next step up, to classes.