I moved to a new URL! Check it out!

posts tagged with: sfml

Dev Log: Boring Stuff

Dev Log: Boring Stuff
My work with C# and SFML pushes on. I'm also trying out a new thing which is working remotely! I need to break free of the shackles of my bedroom and be more comfortable with working at over locations, so right now I'm making this blog post from a local cafe with my laptop as I work on C# stuff and rant about how Nintendo sucks.

Every time I travel my work schedule get's totally screwed up and it takes me days to get back into a groove, so in an attempt to try and correct this I'm getting used to working in different locations. Anyway...

Image


Yesterday I added a bunch of structure code to Gaiaden (tentative title!) for combat. My dream right now is to have a bunch of different damage types, armor, shields, and all that kinda crap, but we'll see how much of that makes it into the final game code. Usually that kind of stuff gets cut in the end because it ends up being way too much work that doesn't add a whole lot to the game, but right now I'm letting myself dream big!

Dev Log: Game Loops

Dev Log: Game Loops
I pretty much spent the whole day learning that certain video cards, or hardware configurations, seem to really hate rendering large textures.

Image


I've been messing around with some early versions of the background for my new game. I'm composing it from a number of images -- there's the ground, a couple of gradients for water and haze, and a couple of cloud layers. All of my desktop machines seem to have no issue running this (the render time is 1 to 2 ms) but my laptop seems to get very upset about this with a render time of nearly 15ms.

I also discovered that using the SetFramerateLimit() function in SFML is bad news, at least in C# land. I sent my current build to a friend who ran it on his Macbook (running parallels to boot into Windows) and it ran at about 30 frames per second (short of the desired 60.) His Macbook has no problem playing any other Windows games, so this was a bit odd. After messing around in the game for about 5 minutes the framerate jumped to 60 for no reason that we could see. Super weird.

After these weird results I went back to my code and ripped out the SetFramerateLimit() in favor for my own timing code that would limit the framerate. Not only does this seem to just work better than SetFramerateLimit(), but it also fixed the framerate on my friend's Macbook.

Image


Eventually I will be releasing the full source of my framework for people to laugh at, or possibly use and contribute to. I haven't yet reached the point where I think I can do that comfortably, but I would imagine that sometime this month I'll be ready to show it off. It's very similar to Flashpunk, and is basically a big mash up of a lot of the engines and frameworks I've seen or used. In the mean time, you can also check out #Punk by Jacob Albano which is more of a faithful port of Flashpunk to C# using SFML as the core.

SFML Text Pixel Fix

SFML Text Pixel Fix
Yesterday I posted about an annoying little bug in the SFML Text class which displays a stray pixel on the upper left hand corner of the first character of the string.

Right now the theory is that this section of code is responsible. After some discussion with some smart people, a temporary work around was found.

When the font texture is created, apparently it will create the texture based on the string that you're using. If your string starts with "Q" then the first letter of the texture will be "Q", and since SFML also creates a 2x2 set of pixels on the upper left of the texture, those pixels will be visible at certain positions because of pixel interpolation.

The work around is to first create a dummy text class that starts with a character that you'll never use. In my code I'm using a random ascii character. I'll probably never ever use that ascii character in my text, so if the white pixel is inside the character then it doesn't matter since I will never use it!

After the dummy text character is created then you're safe to create your intended text object -- as long as you're using the same font and character size, that is! So make sure for each combination of font and character size you're creating a dummy text instance. You never have to draw the dummy text, just draw your actual intended text.

This is kind of a sketchy work around, but for now as far as I can tell it totally works.

I posted a thread on the SFML forum documenting this as well.

Dev Log: SFML Text Woes

Dev Log: SFML Text Woes
My most recent development is getting text working in my SFML based framework. Unfortunately I've run into some sort of problem with the text rendering though.

Image


Whenever I render text, there seems to be a tiny artifact that appears on the upper left corner for the first character of the string, but it only appears in certain positions. The artifact seems to be less than a pixel since moving it around the screen causes it to flicker on and off. In this example I'm rendering text 9 times, 8 times for the outline, and once for the center, and you can see the artifact also rendered 9 times in the top left corner of the Q character.

Image


This is happening independent of fonts, and characters. The only instance I have seen this not occur is when the text is never moving on the screen, or when the first character actually occupies the upper left corner of its bounding box (for example the Y character in Arial.)

Does anyone out there know what's going on here and how I can fix it? If it makes any difference, currently my framework renders everything to a render texture which is then drawn to the window... not sure if this has anything to do with it, but I've been running tests with just drawing SFML text straight to the window with similar results so far.

Programming!

Screenshot Saturday

Image


Just now getting back into coding stuff! I'm almost to the point where I can actually start building a game instead of just random testing scenarios, woohoo!

New Game Mockup!

New Game Mockup!
Now that I'm doing all this stuff with C# and SFML, some people have been wondering what exactly it is I'm doing with it! I have two games that I want to try and make with my new C# knowledge. They're both previous game jam games of mine, and here's what I want to do first:

Image


Image


You may recognize this from the game I made for Ludum Dare 17. It's actually available for download in my games section -- just scroll down to Gaiadi and download it to give it a whirl. Gaiadi is just a prototype, but now I want to turn the concept into a fully fleshed out game.

I've been trying to get this project going for a long time now, and I think attempting it in a high resolution will be pretty fun ... as long as nothing goes horribly wrong! This is by no means a guarantee that I will be releasing this game any time soon, but just what I'll be focusing on for the next big chunk of time.

As for my metroidvania project in flash from Global Game Jam... that's not 100% dead, but right now I am putting it on hold to focus on this.