Need Help, I'm new to Irrlight

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
CodeDragon
Posts: 10
Joined: Sun Oct 17, 2010 8:45 am
Location: Belgium

Need Help, I'm new to Irrlight

Post by CodeDragon »

Hello,
I'm CodeDragon and am new to game development.

I have a few questions:

- How can I make players hit each other with guns etc.. , How can I check if the bullit (Which is in the air) hits him/her.

- How can I make a good map?

- How can I store textures in a variable for pre-loading?

- How can I store my player details? (Is the next code ok or not?)

Code: Select all

#ifndef PLAYER_H 
#define PLAYER_H 
#include <irrlicht.h>
#include "Weapon.h"
#include "Inventory.h"

#define MaxPlayers 16

struct sVector
{
	float X;
	float Y;
	float Z;
};

class cPlayer
{
private:
public:
	sVector Recoil;
	sVector Location;

	BYTE iLife;
	BYTE pTeam;

	pWeapon CurrentWeapon;
};

#endif

- And how can I make pickup marks like this:

Image

That is points to the camera.


Thanks for helping if you do.
~ CodeDragon
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Read every tutorial and you'll learn everything that you have just asked for.
Everything except the "make good map" part, you need to know how to model in order to make a good map.
You shouldn't need to worry about maps at first I think, you can make them when you'll have your game engine running :)

You should start by making small demos with each feature instead of trying to make complete game.

Get comfortable with the engine and then start coding.

And again Read all of the tutorials carefully :wink:
Working on game: Marrbles (Currently stopped).
CodeDragon
Posts: 10
Joined: Sun Oct 17, 2010 8:45 am
Location: Belgium

Post by CodeDragon »

serengeor wrote:Read every tutorial and you'll learn everything that you have just asked for.
Everything except the "make good map" part, you need to know how to model in order to make a good map.
You shouldn't need to worry about maps at first I think, you can make them when you'll have your game engine running :)

You should start by making small demos with each feature instead of trying to make complete game.

Get comfortable with the engine and then start coding.

And again Read all of the tutorials carefully :wink:
I will try it ;)
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Need Help, I'm new to Irrlight

Post by CuteAlien »

CodeDragon wrote:Hello,
I'm CodeDragon and am new to game development.
Hello CodeDragon,
CodeDragon wrote: I have a few questions:

- How can I make players hit each other with guns etc.. , How can I check if the bullit (Which is in the air) hits him/her.
Usually you use trace-lines for that. Which means you check a line for collisions that starts from your gun and has a certain length (just any large enough value) in the direction of your gun. Check example 07 for how to do collisions.
CodeDragon wrote: - How can I make a good map?
The most common way is to use some map-editor. A simple editor is for example irrEdit, but there are also other editors which might work. Or you might write your own map-editor (for larger games that's often a good idea as you can easier do game-specific stuff in your editor then). An alternative is sometimes to model your whole level in a 3D Modeling application (like Blender). Or any kind of mixture - doing most stuff in Blender and the rest in irrEdit.
CodeDragon wrote: - How can I store textures in a variable for pre-loading?
Irrlicht automatically does cache textures when they are loaded.
CodeDragon wrote: - How can I store my player details? (Is the next code ok or not?)

Code: Select all

#ifndef PLAYER_H 
#define PLAYER_H 
#include <irrlicht.h>
#include "Weapon.h"
#include "Inventory.h"

#define MaxPlayers 16

struct sVector
{
	float X;
	float Y;
	float Z;
};

class cPlayer
{
private:
public:
	sVector Recoil;
	sVector Location;

	BYTE iLife;
	BYTE pTeam;

	pWeapon CurrentWeapon;
};

#endif
It is your code - so you can code any way you want as long as it works. Although not everyone might like your style. For example in my case I dislike a few parts:
- Using an own vector class when Irrlicht already has one.
- Using BYTE (very MS-specific style, no real gain)
- pWeapon sounds like you typedef'ed a pointer - something I've seen a few times. I think it makes the code harder to read as you no longer see on first view if it's a pointer like a * clearly shows. (also see http://marc.info/?l=openbsd-cvs&m=117270339530912).
CodeDragon wrote: - And how can I make pickup marks like this:

Image

That is points to the camera.
Usually it's simply a 3D Node. Sometimes a Billboard (Images that always look towards the camera, see IBillboardSceneNode). And then it checks for collision with the player - so when you run over it, it gets picked up.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply