惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
量子位
V
Visual Studio Blog
博客园 - Franky
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
罗磊的独立博客
小众软件
小众软件
V
V2EX
GbyAI
GbyAI
B
Blog RSS Feed
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
有赞技术团队
有赞技术团队
月光博客
月光博客
Recent Announcements
Recent Announcements
雷峰网
雷峰网
F
Fortinet All Blogs
M
MIT News - Artificial intelligence

Red Blob Games: latest blog posts

Red Blob Games: English: a vs an Red Blob Games: Differential heuristics Red Blob Games: Responsive design calculator Red Blob Games: Academic citations Red Blob Games: Highlighting interactive code blocks Red Blob Games: Optimizing page size Red Blob Games: Writing a guide to SDF fonts Red Blob Games: URLs with trailing punctuation Red Blob Games: What I did in 2025 Red Blob Games: Goodbye Sass Goodbye Sass Red Blob Games: RotMG map seeds Red Blob Games: Mapgen4 Mapgen4's use of WebGL2 Red Blob Games: Mapgen4 river shader Red Blob Games: Mapgen4 renderer Red Blob Games: Harnessing ChatGPT hallucinations Red Blob Games: Let Let's write a search engine, part 2 of 2 Red Blob Games: Let Let's write a search engine, part 1 of 2 Red Blob Games: Hexagon conversions Red Blob Games: Mapgen4 trade routes Red Blob Games: De-optimizing mapgen4 Red Blob Games: Hexagon spiral coordinates Red Blob Games: Thoughts on Flash Red Blob Games: What I did in 2024 Red Blob Games: Hexagon page animations Red Blob Games: SDF Halos SDF Halos
Red Blob Games: Text effects
2024-03-31 · via Red Blob Games: latest blog posts

In Week 4 of the year, I tried out various ways of using distances in signed distance field fonts. In Week 5 I wanted to do something different. I decided to explore what I could do treating each character as its own sprite and then applying sprite antimation. The week turned out to be fun but I didn’t learn as much as I hoped I would. To start, I copied the code from the previous week so that I would have a working program right away. Then I removed things I didn’t care about this week and added new code. This is like forking a project but for my weekly experiments I tend to copy the code instead of forking.

During the initial experiments I made an interesting discovery:

Varying sprite shape

This is an ordinary font made more interesting by using a non-rectangular sprite.

This is what the font normally looks like:

Rectangular sprite shape

I had changed the shape from a rectangle to a trapezoid, thinking it’d be fun to see the bottom or top wider. But if you look closely, it’s more than that. There are straight lines that have become bent. Look in particular near the bottom of the h or p, or the inside left of the h. What could cause this?

Trapezoid sprite shape

I don’t know. And I could spend time going down this rabbit hole, but my goal this week was to play with sprite animation. So I wrote it on a list of things to investigate later. And I made a list of things I did want to try:

  • [ ] sink into ground
  • [ ] rise out of ground
  • [ ] bold
  • [ ] slant
  • [ ] rotate
  • [ ] wavy (left/right) character
  • [ ] shadow with variable distance
  • [ ] fall from above, bounce when it hits the ground
  • [ ] curved path
  • [ ] break into smaller squares / dissolve
  • [ ] horizontal spin
  • [ ] flip up/down like a train station sign
  • [ ] rotate left/right on a cube
  • [ ] text rotates on a giant wheel like price of right
  • [ ] apply any of the above effects with a ramp or sine wave pattern to some characters

I find that making a list like this helps me a lot. It keeps me from getting too distracted. Breaking things down into even smaller steps helps me become even more productive. So I went through the various ideas, one by one, and it was fun. But I didn’t learn as much as I had hoped to. Most of these were routine animations, and doing them in code without some kind of tool was sometimes tedious. One of the more fun animations was the “War And Peace Gun” that shot out the text of War And Peace:

I also really enjoyed putting different animations in a sequence:

I didn’t write up my experiments in nearly as much detail as the previous few weeks, but I saved some videos of the animations. See the collection here.

So that was it for my experiments with signed distance field font rendering. I spent three weeks on it and I learned a lot. I now have something I can use for future projects. In particular, I’d like to draw text on my procedurally generated maps. But that’s a project for another day. The next week (Week 6) I tried putting this knowledge into practice by integrating it into a C++ game.