Jump to content

  • Log In with Google      Sign In   
  • Create Account






REP Engine Updated and New Font System

Posted by Programmer16, in SAGE, REP Engine 30 May 2012 · 514 views

REP Engine Updated

I spent most of last night getting REP Engine updated to use the new code base as it was quite outdated by now. I also have somewhat of a project template that I'm using now (based off of SAGE) that I wanted to update REP to. The template starts me off with a splash screen thingy, a state system, a basic scripting system, and storage; basically the stuff I need to get a prototype off the ground really quick. Anyway, REP is back up and running, but I still need to decide on a project for that.

New Font System

I spent some time yesterday going through and finding some free TrueType and OpenType fonts (around 15) to try out for SAGE just to have only one of them actually work with XNA's system; this frustrated me A LOT (I spent about 2-3 hours scouring for the fonts.) I've also been kind of bored with the system as it doesn't offer much, so I decided to go back to AngelCode's Bitmap Font Generator (http://www.angelcode...roducts/bmfont/). I spent about the last two hours going through and getting the system up and running and some nice features implemented:
  • Alignment (and eventually auto-ellipsis support; maybe some other stuff)
  • Formatting (current text coloring)
  • Effects
  • Batching
Alignment is easy, so I won't cover that. Formatting is done via BitmapFontFormatter; basically it allows you to color strings based on indices. So, if I want to color the first 5 characters:
Formatter.SetColor(Batch, 0, 5);

Effects is the cooler part. Basically it is a class that allows you to modify character glyphs on the fly. Currently I have a sine-wave effect, 'flashing' effect (highlighting characters one at a time), and a flipping effect. Each is adjustable and the flipping effect has two modes: single character or whole string. The single character mode just moves through the string flipping one character at a time while the whole string mode flips each character until it reaches the end. There is a little quirk with the whole string mode: if you don't use batching, the string will flip, but as soon as it gets to the end, the string goes back to normal. This is pretty much as designed; without the batching, the glyphs get generated on the fly, so one it reaches the end and goes back to the beginning, the states are all reset (the effect works by setting the state of the characters from the beginning to the current index each frame.)

Using a formatter and batching is not necessary; you can simple call SpriteBatch.DrawString() as normal (via extensions.)

Here's a shot showing the testing I was doing:
Attached Image

I also updated the UI system to use it:
Attached Image

While the UI system does support effects (the sine-wave effect is being used in the shot above), they have to be set manually and do not adhere to state (so, the same effects are used across each state.) In the future I may move them into the theme system and allow them to be set per state and such, but I don't believe it is really worth it at the moment (though, it'd be really cool to have the sine-wave only show up when hovering over. Maybe later lol.)

Demo Update

I am still working away on the demo; I've been working on some different scenes the last couple days. I've decided to skip the editor at the moment. I'm aiming for this weekend, again (maybe Friday so I can get it out in time for Weekend Reading), but I can't make any promises. Other than it will more than likely be REALLY ugly lol. Here are some of the concepts I did up last night:
Attached Image

The stairs and perspective are a little off, as well as it has a kind of MC Escher appeal due to the lower wall. So, I tried again:
Attached Image
Stairs are better, the MC Escher is still there. Hooray for programmer art!

Now, back to work!




I love these types of screens, reminds me of Sierra games (Space Quest in particular). However, I think the upper floor should align its walls with the lower floor.. or something. The corner at the upper door seems offset to the lower floor.

Keep it up! :-)

I love these types of screens, reminds me of Sierra games (Space Quest in particular). However, I think the upper floor should align its walls with the lower floor.. or something. The corner at the upper door seems offset to the lower floor.

Keep it up! :-)


Thanks O-san, I appreciate the comment! The upper floor is exactly why I did two versions; I just can't seem to get it to line up properly and have the stairs still look decent.
PARTNERS