Enemy with health , armour ...

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
IRR007
Posts: 2
Joined: Fri Nov 30, 2007 11:57 am

Enemy with health , armour ...

Post 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:
Steel Style
Posts: 168
Joined: Sun Feb 04, 2007 3:30 pm
Location: France

Post 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.
Last edited by Steel Style on Fri Nov 30, 2007 12:25 pm, edited 1 time in total.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
Danny Gilbert
Posts: 54
Joined: Thu Oct 25, 2007 1:38 pm
Location: Montreal, Canada

Agent class (Artificial intelligence)

Post 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 !)
:)
IRR007
Posts: 2
Joined: Fri Nov 30, 2007 11:57 am

Post 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
ultran00b
Posts: 35
Joined: Tue Oct 30, 2007 3:30 pm

Post 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!".
Use the debugger, young Skywalker...
Danny Gilbert
Posts: 54
Joined: Thu Oct 25, 2007 1:38 pm
Location: Montreal, Canada

Hummmm !

Post 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:
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post 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.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply