Irrlicht noob questions with C# (.NET)

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
Loki
Posts: 7
Joined: Fri Jul 14, 2006 1:09 pm
Location: Otherworld
Contact:

Irrlicht noob questions with C# (.NET)

Post by Loki »

I've got several questions about the engine. I've only played with it enough to proof of concept my idea using the examples. I'm new to game design, but not new to programming. I just wanted to get some answers from the experts and see if any of the things I want to do are possible.

I'm developing the game as a 2d game - I'm a programmer and not an artist :) Well, one of the features I'm trying is dynamically built maps using premade tiles - think of it like a game board that you see skewed.

Using a test I have written I can define each tile in an XML file - to be later served up via web service, and then the engine pulls it apart into an easier to use System.Data.DataTable. The info I stash here is vital game data, as well as the tile image, and I compute the cooridnates for the tile here. This Datatable is "cached" so that I only have to get the map on load.

Next I run through the table and drop each tile onto the screen. I noticed in the example that the background has to be repainted for each frame. Is it possible to render the tiles to the screen, and then behind the scenes take an Image of the entire map (even if it is bigger than the screen size), save that out to a file, and then use that single image as the map, rather than loading in each tile every iteration (not a big deal to do that if I put it in it's own thread though). Looking thought the Irrlicht.Video in the api I couldn't see anything that would let me save the map out. It would be nice if you could import a texture from a .NET object, like a System.Drawing.Image or a memory stream. :) Then I wouldn't have to save out the map.

The next part of this is that if I make my 2d map larger than the screen, is there a way to slide the user, either by moving the camera so their sprite is always in the center of the screen, or let them shift the screen over manually?

Thanks for your help guys.
shurijo
Posts: 148
Joined: Sat Feb 21, 2004 3:04 am

Post by shurijo »

You can do that using .NET classes. Just use the System.Drawing classes to read each tile and draw it to a new Bitmap image, save it, then load it into Irrlicht. You'll have to save it, but you could probably delete it after its loaded into an Irrlicht Texture (?).

If you want to be cool, I'd recommend using a TerrainSceneNode to render the newly merged Texture and then download and use a heightmap & detail map, too. Does the game need to use Tiles? Or could you just use a Tile Map Editor to assemble the tiles then save as a single image and deliver that image over your webservice rather than do the merging/stitching on the client?

Currently, there's not a way to access the video data through the .NET wrapper (there's a way in the native C++ library, see code snippets forum under screenshot post).

If you move the camera, then the map will recenter. You would use the Event Handler to capture mouse or key input to move the camera.

When you say 2D, is it a real 2D - like using Irrlicht Draw2D methods? If so, then you can't use an Irrlicht Camera (camera nodes are for 3D space).
Loki
Posts: 7
Joined: Fri Jul 14, 2006 1:09 pm
Location: Otherworld
Contact:

Post by Loki »

Here's a sample map. This is rendered from a DataTable but I'll try some of your suggestions.

http://files.otherworld-rpg.com/tiletest2.gif

The thing is that my game will have city building, so each Tile can change. That's why I wanted to build the map from my XML, save it as an image and then just render the image until it knows that the map is old/needs to be updated.

The game is more like 2.5D. I'm using the draw2d methods, but if I can achieve the same look with the 3d rendering so that I can have a camera that will move up/down/left/right with the character across the map, I could change to that.

I liked some of your suggestions. If you have any other ideas, I'd be happy to hear them. Thanks.
Teh Loki

Broken Bokken Productions
http://otherworld-rpg.com
shurijo
Posts: 148
Joined: Sat Feb 21, 2004 3:04 am

Post by shurijo »

If you are going for that look, you could probably just use GDI+ (using the normal System.Drawing namespace classes) and not even need Irrlicht. I started on a few iso games like that (first with GDI and next with Irrlicht, but never finished any). The Draw2D is going to be very slow (compared with 3D renderings) for a lot of tiles on the screen.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You should read the isometric tutorial and see how orthogonal projection can be used. Then you can use 3d objects with the intended look.
Loki
Posts: 7
Joined: Fri Jul 14, 2006 1:09 pm
Location: Otherworld
Contact:

Post by Loki »

hybrid wrote:You should read the isometric tutorial and see how orthogonal projection can be used. Then you can use 3d objects with the intended look.
The problem with 3d objects is that I have no talent in making 3d models. :)

I've changed this up a bit. What we decided to do is to build a single terrain background map, ie grass, sand, dirt, water, and then make smaller swatches with edges that will blend into the background. Then I will just dynamically load extra terrain pieces over the map. That way I don't have to load every single tile. I only need to load whatever is extra.

I think I will try to use the 3d engine with my 2d graphics so I can get the camera to pan. Thanks for your help!
Teh Loki

Broken Bokken Productions
http://otherworld-rpg.com
Locked