Stop WordPress From Removing HTML

Anyone who has worked with HTML in WordPress knows that wordpress has a nasty habit of filtering out html tags/elements that you have specifically placed in the HTML editor. Many claim this is wanted behavior, but we all know this behavior is about the most annoying thing about WordPress and other blogging systems. So let’s fix that.

While there are many ways to stop WordPress from filtering html, I believe the most unobtrusive way to achieve this is to define custom tags that wordpress will pretty much leave alone. Originally I was modifying core WordPress files, but after a little digging I found out how to hook on to variables that have been generated in the core, and add to them. This way you aren’t messing with important things (too much), and your changes will persist through WordPress updates!

Without further ado, simply add this function to your functions.php file in your theme’s directory, changing <<yourtag>> appropriately:

function my_valid_elements($initArray) {
	$initArray['extended_valid_elements'] .= ',<<yourtag>>[*],<<yourtag2>>[*]';
	return $initArray;
add_filter('tiny_mce_before_init', 'my_valid_elements');

After that is done, the visual editor will no longer filter out your innocent html tags.


  • WordPress will still change all attributes of your html to lower case. If you have a plugin that requires case-sensitive attributes, you’re still out of luck :-(
  • WordPress will still modify certain tags. For instance, I couldn’t figure out how to stop it from converting <image> to <img attr=”"> despite an hour of searching through code
  • Special thanks to Engfer at, and many others who have posted similar code!

Something Big: Finishing Touches

After last week’s plunge into technical systems, I was glad to be able to focus on the content half of the scene. So glad, in fact, that I forgot to take screenshots of the progression! Oops… oh well. So, without any progression, here is what a grassy, blank-looking thing from last week turns into after lightmaps, detail sculpting, texture painting, trees, houses, bridges, and fog are added:

Continue reading »

Something Big: Technical Work

As it turns out, there was a piece of technical work that I had forgotten about: Pathfinding on terrain. This in turn led to other changes in my pipeline–and yay, more work. In the end, though, I managed to use some sweet systems to cut out a lot of manual work.

Continue reading »

Making Something Big

So far I’ve mainly focused on ironing out my workflow and coding systems. That stuff is very important and all, but often times it’s not very exciting! And I prefer exciting.

Continue reading »

Optimizations and Android APKs

Please note that the new shaders unintentionally use real-time shadows, and trees are missing due to upcoming new environments.

While this build features no new gameplay elements, I have managed to increase the frame rate by 15-20% and cut the file size down by half (by two-thirds for the webplayer, even). Now that’s progress!

To achieve this, I upgraded my terrain system to the newest version, Terrain 4 Mobile Black Edition. This has some great new features that I can use, such as billboards for grass and small plants to detail scenes, as well as better editor controls. I’m currently using the demo version of the system to compare and benchmark. The demo has a bug in the shader I want to use, so in this build and frame rate benchmark I’m using a more complex shader than I need to. Obviously I’ll be grabbing the full version for the next build to increase performance even more!

Another optimization I did was removing all unnecessary assets from my assets directory. Over time I’ve accumulated some really great systems, models, and textures. Unfortunately, whenever Unity switches build platforms–from Android to the Web Player, for instance–it re-imports them (to optimize for the platform). Before cleaning it would take me over two hours to build a Web Player demo for you guys and switch back into Android development. Now it takes 15 minutes.

I also found out how to turn on anisotropic filtering on floor textures to make them much more sharp. It adds extra calculations to their rendering, however, which reduces the frame rate by about 5%. In the end, I’m not sure if I like the effect because it brings clarity to all parts of the screen, which makes the overall world appear more empty. The new terrain system’s billboard system will help me fill those areas up with objects that are cheap to render, so it’s kind of a toss-up. Let me know if you notice the emptiness effect, and if you like the sharper textures overall.

Lastly, I’m going to be including compiled Android installation files in every demo from here on out. You’ll find the download link on the Web Player demo. At this point I know few people will actually take the time to install the demos to their device, but hopefully this will change :-)

Trello, Growth System, Touchscreen Controls cont.

Townsend is approaching the mid-way point in terms of a playable demo–most of the basic functionality is there and moderately polished, and there’s actually something players can do (plant stuff!). For me, this also means it’s time to start organizing tasks in a better way than just whatever needs to be done. So I made a Trello board for my development tasks. Trello is a free, online taskboard service, and it’s awesome for coordinating tasks with a team or just yourself. Seriously, if you are constantly doing team projects, go check it out!

Once that was up, I tackled a few tasks. First was finishing touchscreen controls. In the last demo you could only walk around with a touchscreen; couldn’t actually plant anything. I fixed that, and changed the command to plant things to a double-tap (or double-click). Lo and behold, I quickly found that this gesture sucks for the computer. The problem is that the computer is fast enough for the player (and thus the camera) to start moving between clicks, which then moves your second click off a bit. As for other gesture ideas, there’s long-press, two-touch, and mode-switching, but none of them have proven to be very fitting for the interaction :-/. For now, I’m just letting this go until I can fix the fps on touchscreens and test it there.

I also finished the growth system. I added fun particles that puff out when a plant grows to its next stage, as well as particles that flow from ripe plants to indicate their finished status. Also, plants will now grow through multiple stages if necessary after returning to a paused game instead of just progressing through one stage.

Finally, I added a visual indicator to show players what cell on the grid they are trying to plant on. Note that in the demo the grid extends through the entire town so the indicator is always shown, but soon the grid will be consolidated to plantable fields and other spaces of interaction (inside houses, for instance). At that point, the indicator will only show when clicking on these interaction spaces as intended.


Touchscreen Controls (no demo)

In my last post I simply mentioned touchscreen controls as sort of a side thing that wasn’t very important. But this is not the case. I put a lot of emphasis on how people will interact with what I’m making and how their overall experience will be. Thus, I put a lot of thought into the control scheme of Townsend.

First, what’s the kind of interaction that players will be using the most? Probably movement. I specifically opted for a point and click (err, touch?) movement system, so it follows that movement will just be a single tap, single touch gesture. The next most used command would probably be interacting with objects or farming.

The next easiest form of input on a touchscreen is double-tapping (double tap, single touch). My undergraduate capstone was focused on gestures that replace right-clicking on touchscreens, so I know that although double-tapping is the easiest to manage as a user, much of the negatives are placed on the developer. I haven’t figured out how to detect double-tap without triggering a single tap command while avoiding the introduction of lag into both commands. It’s kind of nitty-gritty, so I’m going to leave it by saying that it’s going to be hard, but I’ll have to figure something out.

Then there’s camera controls. Townsend is a 3D game, and I really want to show this. Thus, I chose two-touch and drag as the gesture to control camera angle. This is a pretty simple gesture, and it will hopefully enable gamers to really interact with the world. To complete this, I’m including the ability to zoom in and out by three-touch and drag.

I haven’t even touched the inventory controls yet, so that may open a small can of worms in the near future. In my personal testing of this control scheme, things seem intuitive. If you would like to test it out for yourself, let me know!

Sorry iPhone users! I don’t have a mac, so I can’t export to iPhone yet.

Planting and Graphics

Notice: I apologize for the large filesize on the demo as well as the roots of the trees in the webplayer. Not sure exactly what caused this.

Well, it’s amazing for me to look back at the date on my last Townsend blog post and realize that it was nearly a year ago. I took a break from game development for a few months as I finished my last year of college, but throughout the school year I did some work on Townsend here and there. Finally, just over a month ago I graduated with a degree in Informatics, and from that point on I have focused on developing Townsend.

This demo features some substantial changes. First, I have changed the lighting, textures, and models to give Townsend more of a toony look. I chose this route because although I have developed a pipeline that can produce life-like assets, they take far more skill and (more importantly) time to make and animate. On the other hand, I don’t want Townsend to look so toony that it appears to be a game you would have seen on the first generation iPhone, so it’s been something of a fine line to traverse. The tree models that you see in this build are more or less final, and I’m very happy with their outcome in terms of look and efficiency. What do you think? Feedback would be appreciated!

The other big change in this build is that there is now a growing system. You can place down lettuce by hitting alt while hovering over the shimmering plot of dirt (there are some other vegetables in there currently, but they are just there for testing). This lettuce plant will then progress through different stages until reaching its final stage of growth.

On the surface, this doesn’t seem like much. Even from a coding standpoint, it seems rather trivial to implement. However, I made this system very efficient so as to be able to handle the growth of hundreds of plants at a time, as well as easy and intuitive to develop with. It also bases its cycles off of the system clock, not a device’s framerate. Lastly, Unity’s documentation really doesn’t cover native collections such as stacks and queues, and I desperately needed to figure out how to use them for this system as well as others. After lots of searching and prodding I figured out the syntax, dependencies, and scope, and am now ready to use them in other important systems (such as an inventory).

The last change for this build is touchscreen controls. This shouldn’t effect you when using a webplayer (hopefully), so it may not appear to be a big step in the demo. However, it is awesome to finally have a build on my phone and tablet! Not only is it awesome to play the game as it was intended, I can finally accurately test the game’s framerate.

I am putting a ton of time into Townsend these days and I hope to have a playable demo of Townsend out by the end of August. I love game development as a hobby, but I am also determined to develop this project into a fully functional game on the mobile marketplaces.

Website Design

I work at a tech company called Apptio, who delivers a complicated suite of business software to IT departments of large companies. Luckily for me, this software is served entirely through the web in HTML, CSS, and Javascript, so I can use CSS to style and control it. I enjoy my work, but because we support browsers as old as IE7, have a complex codebase, and are generating HTML instead of writing it, I can only use a fraction of the technology that the web offers.

And everything is different with this website.

Continue reading »

Website Comments

Over the last two days I’ve been finding my way around the wordpress menus and taking css styling one step at a time. Yesterday, I took on the comments section. Initially it didn’t seem very daunting, but anyone who has styled an html form would have told me otherwise. After a few minutes of firebug, I quickly wised up and put some extra thought into it.

Continue reading »