How to Get Distance field fonts in LibGDX using Hiero, and finding an updated version of Hiero

hiero

Distance fields are used in LibGDX for being able to make fonts clearer when resizing them, which allows you to have clearer text using just one font size on all devices instead of needing to include several (or have low quality looking text)

LibGDX Wiki Instructions, or what not to do

The LibGDX official wiki does a good job of explaining what and how to use distance field for clearer font in LibGDX: https://github.com/libgdx/libgdx/wiki/Distance-field-fonts, but seems to be unbelievably vague about using the Hiero font tool, with links to 2012 pre- “distance field” versions of hiero, and no apparent way to find or run a version that works. They even so far as to suggest use github to download the entire LibGDX source project, re-compiling it to get access to from the gdx-tools project.

I installed the windows version to connect to github, cloned the repository and downloaded the 1GB source, changed my workspace in eclipse, and tried to compile the source, only to be met with 1000s of compiling errors, hours into getting it to work, and no closer to running a “version of Hiero that supports distance fields”.

How to actually get a supported version of Hiero

Luckily I was able to find an article written by Packt Publishing on how to run Hiero(https://www.packtpub.com/books/content/scaling-friendly-font-rendering-distance-fields).

But it’s actually somewhat simple:

  1. Download the latest stable version of LibGDX from their site (not through Maven/ Gradle/ GitHub/ Google Code/ flavor of the week, but through the link they say “We strongly discourage using these old release builds….”): http://libgdx.badlogicgames.com/releases/
  2. Unzip that into a temp folder (or just copy it from the zip into the folder in the next step)
  3. Create a folder where you want to run Hiero from- prob just a folder in your working directory called “hiero”
  4. Copy the following files into that folder:
    • gdx.jar
    • gdx-backend-lwjgl.jar
    • gdx-backend-lwjgl-natives.jar
    • gdx-natives.jar
    • gdx-tools.jar
  5. Now Right click in the folder, create a new text document, and rename it to: Hiero.bat (Make sure you can see the .jar on the other files in the folder, or you have to turn off “hide extensions for known file types” in windows folder options)
  6. Open the Hiero.bat by right clicking on it, and opening it with a text editor(right click and hit edit)
  7. Inside the text document put this: java -cp gdx.jar;gdx-natives.jar;gdx-backend-lwjgl.jar;gdx-backend-lwjgl-natives.jar;gdx-tools.jar com.badlogic.gdx.tools.hiero.Hiero
  8. Close the text editor and double click on the Hiero.bat, and it should run Hiero! (you should see ‘Distance field’ on the bottom of the effects section on the right side)

Now the LibGDX Wiki can be helpful again!

Now that we actually have a version of Hiero running that we can follow along with the wiki article, the article becomes useful again. Follow the directions under:
Generating the font

I found that this works reasonable for generating fonts down to size 18, with the same values that the wiki uses (spread=4, padding =4 for all, x, y =-8, but scale looked best for me at 24, probably because I used a smaller font size)

The rest of the article was pretty straight forward for me, and I was able to get distance fields working pretty well in the game (low distortion at larger or smaller font size, with minimal artifacts around lowercase t’s, but overall much better than normal scaling).

The only real disadvantage is that I was using Hiero to generate drop shadows to make text more readable before, but distance fields don’t allow you to export it with Hiero (have to clear all effects aside from distance field). The article hints at being able to add directional drop shadows “using the texture’s gradient”, but offers no additional information.

Let me know if you find a way to get drop shadows or other effects working! Text isn’t the central focus of games, but is necessary for a lot of communication, and for now I just put a black transparent box behind any text field to allow it to be readable without drop shadows.

Back from a long hiatus!

I haven’t been very active on the blog lately for two reasons.

1) The website was going down daily because host gator, and now Linode was detecting too much disk access (from people trying to hack the server)- I guess any site that has been around long enough will have hundreds of bots brute forcing trying to get control of the server O_o

So I reinstalled linux, and re-setup everything, but the website database was broken because akismet plugin filters out spam comments, but at the cost of bloating the database up to insane sizes, making it completely unusable.

2) Been working full time on my games, trying to pay rent, and buy food. Basically working all the time. We’ve release several games so far, and it has been a learning process because neither me nor my wife had worked at any game companies beforehand (and even they require significant experience before you can work there XD ). So we saw that mobile games were starting to boom, and took a chance at working on them. I’ve been mainly using LibGDX these days, and have created several games. But now that Unity Basic is free, and much faster to actually get your game done (instead of spending weeks creating usable UI, without actually working on gameplay), I’ll be using that more instead.

But I was able to fix the SQL for the database, and get the site live again, so I’ll be posting more tutorials, or at least help for other developers when I run into problems with no existing information out there, or gaping holes in the information they give.

I hope to help many more people get started with creating their own games and applications! It’s difficult to get in without any help, but once you start, you can gain momentum and create the things you’ve dreamed about! (although at 1/10000000 the scope 😉

Android Studio Application Development Book Review Giveaway!

I recently reviewed “Android Studio Application Development”, and Packt Publishing has been gracious enough to allow me to raffle off 3 e-copies of the book!

Comment, and let me know why you would be interested in the book, and I’ll use a random number generator to select 3 people! So then check back (or leave your email address and name and I’ll contact you if you won, and forward the info to Packt Pub for them to add the book to your account)!

Great deal on technical books at PacktPub for a limited time(till January 3rd)!

$5 ebook Bonanza2
PackPub $5 Everything deal!

Awesome news for anyone looking to learn some new topics this holiday season! Pack Publishing is offering ALL of their e-books AND video tutorials for only $5 a piece!

For game development related topics, and for general computer/ technology tutorials/ books, they seem to have the most, and up to date content. If you’ve been thinking of learning LibGDX, Java, C#, Unity, HTML5, Web development, whatever, all the books are only $5!
Only until Jan 3rd, so hurry and pick out your favorite Christmas presents! 😀

You can pick them up here: http://bit.ly/1jdCr2W

Pickup a great LibGDX tutorial book that I was one of the technical reviewers for!

Learning LibGDX Game Development is a great LibGDX tutorial book that I have the pleasure to be associated with 😀

I mainly just double checked everything, made sure it was easy enough to follow, but the author did a surprisingly concise, yet well thought out series of tutorials, culminating in having a finished “runner” type game, using LibGDX, so you can deploy to Android, PC, Linux, Mac, even iOS now.

I learned some things about Scene2d, and I can say if you’re interested in saving some time trying to learn al; by yourself, this will give you an enormous head start.

I got a copy of the book, and my name on it, but don’t get anything else for being a technical reviewer, but I would have bought the book based on the content. Check out the table of contents for an idea of the awesome stuff it covers, you’re pretty much guarenteed to learn a lot from it.

You can pick it up from their website now at:

Unity basic for Android and iOS now free!

Good news for all you other indie developers out there- Unity basic for Android and iOS is now free!

http://blogs.unity3d.com/2013/05/21/putting-the-power-of-unity-in-the-hands-of-every-mobile-developer/

Unity basic seems like it would be more than sufficient for the needs of most indie developers. This means that there will be a lot more people trying out Unity, publishing games, and making the platform stronger. Plus, the Unity developers will probably still make a good amount of money from additional purchases in the asset store.

I had been holding off developing in Unity until my current games could be generating enough income to easily justify the purchase, or for when I started going towards more 3d games, but I think I will try to publish a Unity game within the next couple months, to really test out the platform.

Mastering UDK Game Development Review

Good book to learn how to create non FPS game genre’s with UDK.

This book provides information specifically on how to start creating different types of games using the UDK, but it’s aimed at level designers, or at least someone who knows their way around using the UDK, but might not be comfortable using straight UnrealScript. A better title for the book might have been “How to create several unique game genere’s using UDK and Kismet: for intermediate users”, because for that, the book is actually pretty good.

The author walks you through everything, and you’ll be amazed at the stuff you can create with the UDK, if you’re an intermediate user, or even a beginner equipped with ‘Google’. You can then dream up ways to customize it, to make the games your own, and expand on them, and fill them out. My main complaint with the book is that although it does step you through everything nicely, there isn’t a lot of explanation about why you do stuff- you would have to go back and play more on your own to understand it better, or have hopefully already used the tools, and understand how they affect your game.

I would recommend this book for anyone who is interested in how to use UDK to setup a basic game of the genres listed in the ‘table of contents’, and who doesn’t want to delve into programming yet. But you’ll have an easier time if you have had some experience with UDK before.

You can pick it up from:
http://www.packtpub.com/mastering-udk-game-development/book

AndEngine for Android Game Development Cookbook Review

I really enjoyed this book because it appears to be helpful both to game developers who want to start using the AndEngine, as well as people that might be new to game development in general. Every cookbook “recipe” is something that you will need to use eventually while programming games, but it’s laid out so if you are looking for a particular concept you can find it easily, or if you are a beginner to game development, you can read through the book from beginning to end, and get all the tools you will need to create pretty much any game, and get ideas on things that you can add, that you might have not otherwise thought of.

The author touches upon such a wealth of topics, from basic drawing, animated sprites, parallax backgrounds, box2d physics(with many examples), menu systems, and so much more, which makes this book valuable for the solutions that can be applied to other gaming frameworks you chose to use in the future.

The author even includes the source code for a fully professional quality game, and references which recipes were used to create each portion of it!

If you are interested in developing games using AndEngine, this is a great place to start. If you want a book that will stay a valuable reference in your library as you continue down the path of game development, get this book.

You can pick it up from:
http://www.packtpub.com/andengine-for-android-game-development-cookbook/book

Development Blog: 2d side scrolling mining game- on screen controls, basic animation


Try it here:

I got rid of it rendering tiles off screen, and increased the world size (which decreased the steepness of the hills for now).

I also added touch screen support (jumping and moving), figured out how I want to handle different resolutions, and changed in a basic guy graphic and background.

I will probably add the ability to “harvest” blocks, and put them down again, since that is the major mechanic. Some problems I have to figure out- the smallest level size in Terraria causes an “outofmemory error” on android… so I’m going to try to lean down my tiles to see if it works- or will have to generate the tiles as needed like minecraft does, and only keep the tiles loaded that are near the player…..

Also, figuring out how to tunnel out caves into the level, and branching caves.

(also- it seems to have hick ups when running in firefox, but not chrome…)

Development Blog: 2d side scrolling mining game

Reasons

I wanted to document my progress on my new game, which is a 2d side scrolling, mining type game, somewhat similar to Minecraft or Terraria, or the hundreds of other games somewhat like that out these days. I noticed that there are no good ones on the Android Market/ Google play, and I’d personally like to be able to build/ play on my Android.

I also will be using my code from another game, to have multiplayer added in from early on in the game. Looking at Terraria- the guy who made it started with a “Super Mario Bros” clone.
I’ve wanted to create a 2d side scrolling game similar to Mario Bros, and Commander Keen with decent production value for some time, so this project should help satisfy that longing as well.

Planning

Looking at Terraria, everything that is in there would take me a very, very long time to create, it’s is quite an impressive game. So, initially I only hope to have the same basic functionality as Minecraft or Terraria, which would be being able to move around in the world, and being able to harvest and replace blocks.

Then, I will start adding in crafting, and monsters, and expand from there. I would really like to add some unique elements to the game. I’ve thought from the beginning, when you can jump up into “space” in Terraria when you get too high- that it would be cool to have space stations, or even a minimum amount of space area to explore- such as a “moon”/satellite environment.

I would have also liked to have villages in the game with… “smarter” NPC’s, so that the world would become more alive. Add more RPG elements to the game as well- since both other games borrow from the genre.

Initial Progress

Well, the first step in creating any side scroller, that is tile based, is to create tiles. So I created a very small, tiled world, partially “air” and partially “dirt”.

just_tiles

Next step

The next step will be to add “character blocks” (about 1.5 width/height in hit area) to the world, and allow control, as well as have the camera following it.