Multible Cameras

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
LanceJZ
Posts: 23
Joined: Mon Feb 13, 2012 12:46 am
Location: Seattle
Contact:

Multible Cameras

Post by LanceJZ »

I am unable to find a way of doing this. When I made a prototype in Unity 3D I used layers, I was hoping I could do the same kind of thing in Irrlicht engine. That is, my game Base Defender, it is a side scroller shooter type of game, like Williams Defender is. Now, how I did that was I had a second camera showing the opposite side of the world off the edge of the world the player was facing. In Unity 3D one can set the camera to have no background, I did that for the camera following the player. I put the background model on its own layer, and the player camera could not see that layer. I used two more camera that could see the background model, one following the player, one at the opposite side of the background model.
The only other option I can see at this point is have two more background models off either side of the center background model, but this would be a pain, as I would also have to make a copy of all the enemy objects off the side, so it looks like the player just keeps going, but the player goes in a 'circle'. That would mean three of everything but the player. When the player was < -1500 in the X, they were at placed at 1500 in the X and vise versa, same with all the enemies.
I hope I was able to explain this so it is understandable. If not I can post an image of how the cameras were placed.
Here is a screen shot of the game. https://plus.google.com/u/0/photos/1073 ... 9158926481

Thank you for your time
if (Try()) Do(); else DoNot();
if (Try()) Do(); else DoNot();
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Multible Cameras

Post by CuteAlien »

Sorry, at least I don't understand yet what you are taking about (but I also never heard of Williams Defender so maybe that is my problem). The camera defines the area which you are rendering. The scene defines the visible objects. I don't get your point about multiple cameras in a side scroller (having multiple cameras makes sense for split-screen games for example).
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
LanceJZ
Posts: 23
Joined: Mon Feb 13, 2012 12:46 am
Location: Seattle
Contact:

Re: Multible Cameras

Post by LanceJZ »

CuteAlien wrote:Sorry, at least I don't understand yet what you are taking about (but I also never heard of Williams Defender so maybe that is my problem). The camera defines the area which you are rendering. The scene defines the visible objects. I don't get your point about multiple cameras in a side scroller (having multiple cameras makes sense for split-screen games for example).
I can help you with that. http://en.wikipedia.org/wiki/Defender_(video_game) It is an arcade game from the 80s. When you went off the edge of the playing area, you would then be placed on the opposite edge seamlessly. Maybe that will help you understand?
if (Try()) Do(); else DoNot();
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Multible Cameras

Post by CuteAlien »

I see... I remember Falcon Patrol which worked the same (and looked pretty similar - guess it cloned Defender). First solution that would spring to my mind would be putting the background on a billboard. Then you can work by just changing the texture on that, take a look at the stuff you can do on any layer of textures: http://irrlicht.sourceforge.net/docu/cl ... layer.html

If you set TextureWrapU to ETC_REPEAT and then move the texture with getTextureMatrix ().setTranslation( yourMovementVector ) you should get a scrolling background that repeats.

There's probably a few other ways to get the same results. For example adding nodes to the side all the time and removing them from the other side.
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
LanceJZ
Posts: 23
Joined: Mon Feb 13, 2012 12:46 am
Location: Seattle
Contact:

Re: Multible Cameras

Post by LanceJZ »

CuteAlien wrote:I see... I remember Falcon Patrol which worked the same (and looked pretty similar - guess it cloned Defender). First solution that would spring to my mind would be putting the background on a billboard. Then you can work by just changing the texture on that, take a look at the stuff you can do on any layer of textures: http://irrlicht.sourceforge.net/docu/cl ... layer.html

If you set TextureWrapU to ETC_REPEAT and then move the texture with getTextureMatrix ().setTranslation( yourMovementVector ) you should get a scrolling background that repeats.

There's probably a few other ways to get the same results. For example adding nodes to the side all the time and removing them from the other side.
Ah yes, good old Falcon Patrol, for the C64. It is the same type of game, yes.
That is what I did for the XNA 2D version of my game http://tinyurl.com/LanceXNA, I don't think that is an option, as part of the 3D immersion, the camera moves up with the player, and looks down a little on the ground model as it pans back. The background is 3D so it must be seen with player movement. Thank you for the suggestion, I'll think on that.
(edit)Wait, adding nodes, I can clone nodes, can't I! Oh, I may need to do that if I can't think of something else.
if (Try()) Do(); else DoNot();
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Multible Cameras

Post by CuteAlien »

Btw. - don't add/remove nodes certainly - just teleport them to the other side. Or have everything (or just background) twice - then you can teleport the player itself (a little more memory used, but not so expensive as it's basically just some nodes which share the same mesh-data and they can be culled when outside the screen).
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
LanceJZ
Posts: 23
Joined: Mon Feb 13, 2012 12:46 am
Location: Seattle
Contact:

Re: Multible Cameras

Post by LanceJZ »

CuteAlien wrote:Btw. - don't add/remove nodes certainly - just teleport them to the other side. Or have everything (or just background) twice - then you can teleport the player itself (a little more memory used, but not so expensive as it's basically just some nodes which share the same mesh-data and they can be culled when outside the screen).
Right, thank you, I'll keep that in mind, as I work something out.
if (Try()) Do(); else DoNot();
Post Reply