Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 27 Jul 2012
Offline Last Active Jul 12 2013 04:49 AM

Topics I've Started

SFML - Sprites vs Vertex Array

11 November 2012 - 10:43 PM

I've implemented a tile-based RTS-style scrolling map with SFML (.NET binding), and would like to get some opinions on two options I can see.

Currently what I am doing is keeping a large collection of Sprites for the map, and each tile stores its terran type and index into the sprite collection. The sprites are stored in a Dictionary<TileType, Sprite[]>, where the keys are the various tile types (enum: Grass, Forest, Ocean, Desert etc ...), and against each key I store an array of all the sprites for that terrain type.

I have a custom camera object which tracks the in-view area, and can be scrolled around the map. Each render call, I get the tiles that are in view according to the camera, and simply loop through them all, find the appropriate sprite in the collection, set its position and draw the sprite.

This works fine, and I get a solid frame rate (80-100 FPS) with 1200+ tiles on screen and several layers on top with complex alpha blending for transitions etc.

The second option I can see (which I have read a bit about) is to store the map data in vertex arrays, and to use the built-in SFML View object to handle scrolling. I'm not too sure how different this method would be, it seems to be pretty much the same approach with slightly different data structures.

I'm still a bit of a beginner with SFML, and most of my previous work has been with SDL Surfaces which are pretty much the same as the Sprite approach I have taken with SFML. Any thoughts, opinions or advice on this is welcome :)


27 July 2012 - 01:07 AM

So I'm wondering if anyone out there is using SDL.NET for their game projects? Hobby or serious?

There doesn't seem to be any kind of community around it, the official website/forums are pretty much a ghost town, and it's hard to find any substantial literature or discussion revolving around this library.

I understand the portability issues around using .NET, and I am also aware that SDL/C++ is a much safer bet in terms of learning industry standards ... but surely there is plenty to like about SDL.NET for those attempting to learn game development?

My own experiences with it have been great! (granted, I am a C# developer professionally). Productivity is awesome, super easy to prototype and test features, it seems to me to be the perfect way to learn game dev for beginners / those familiar with C#. I just find it hard to get detailed info about advanced issues ... I guess I could download the source code?

Is there any reason why there's not much momentum behind this? Or maybe there is and I just haven't met the people working with it? Any thoughts are appreciated.