Polycode Development Update 002
Hello. This is the semi-regular Polycode development update and here’s what I’ve been working on for the past couple of weeks.
Retina display support.
My main development MacBook finally bit the dust (quite suspiciously on the same day the new line of MacBook Pros were launched) and I was forced to get a new computer. I got a 13-inch Retina MacBook Pro and very quickly realized just how terrible non-retina apps look on the retina screen, so of course I got side-tracked immediately into updating Polycode to support retina displays.
In a Mac app that supports retina displays, the OpenGL pixel viewport is set to a really huge size, since the screen itself is 2560x1600, while the mouse window coordinates are mapped to a smaller size, since the all of the UI controls have to stay “normal” sized on the screen. This means that you basically have to double the resolution of all of the rendered text and all of the image assets have to be doubled in size.
I added native support for this in the Polycode core API, and there is an option now to automatically upres the text resolution while running on a retina mode display. I also redesigned the default Polycode UI themes as vectors and exported standard and retina resolution versions of them.
For all other assets, there is a little bit of a manual switching involved. You can check if the app is running in retina mode and add the folder with retina assets to the resource manager instead of the regular one, and then load your assets relative to those folders, and the switch will be more or less automatic.
Here’s a full resolution screenshot of the IDE running in retina mode so you can get a better idea:
Asset Importer Front End and Mesh Viewer
I updated Polycode’s command line asset import tool “polyimport” with a few new options and created a front end UI for it in the IDE. Now you can import 3D assets directly from the IDE without running stuff in the command line and preview the meshes in the IDE. Check out the video at the end for a demo.
I also started porting the old 2D only editor into the third dimension. Most of the work so far has been around creating 3d transform gizmos (those little arrows that let you move, scale and rotate entities in 3D space) and getting camera controls to feel good. Since I am mostly a Blender user, the control scheme is modeled on Blender’s “trackball” control scheme and uses the same shortcuts.
Here’s a quick demo of importing a normal mapped model from Blender into Polycode and adding it to the entity editor:
That’s it for now! I will be working on finalizing the 3d editor in the next couple of weeks, so stay tuned for more updates on that!
Polycode semi-weekly Development Update 001
This is the first in what will hopefully become a series of somewhat regular status updates regarding Polycode development. I get a lot of questions about development progress and it’s hard to reply to them all, as it is also hard for folks to keep track of what’s going on themselves without reading through commits across multiple git branches, so these status updates should hopefully ameliorate some of this disconnect.
The main thing this update will concern is the rather large API change that I am currently working on under the “screenrewrite” branch and some IDE improvements.
You did what now?
Before I went on a two month development hiatus in August due to moving and work, I was getting geared up to finally release Polycode in binary form as its first semi-official release. However, I’ve been thinking for awhile about how to best implement a feature that a friend had requested a few months ago, which was freely combining 2D and 3D in the same scenegraph. Polycode, from its very start, had a hard separation between 2D and 3D via Screens and Scenes, and while you could mix the two, they were completely separate, even though underneath it was all going through the same renderer calls and they shared the same base entity class. This made a lot of design sense when it was written: Screens had a system for easy mouse input callbacks, topleft positioning, y-down coordinate systems, 2D entities were subclassed from ScreenEntities, which had a lot of useful 2D functionality and all the other stuff that let you easily throw together 2D graphics without worrying about the third dimension. However as Polycode grew more and more complex, this separation began to make less and less sense. Some code had to be basically duplicated between 2D and 3D entities, there would have to be two separate IDE editors for 2D and 3D scenes, and most importantly, you could not switch your existing scenes between 2D and 3D if you wanted to.
With all of that in mind, I decided to remove Screens and ScreenEntities from Polycode entirely and keep one scene graph that could be easily initialized to and switched between 2D and 3D modes. I understand that this is a huge change that will break a lot of existing code, but I strongly feel that it is an important design improvement that had to be done and if it didn’t happen now, before an official release, it would be nearly impossible to pull off later down the line with more people using Polycode.
This change already produced numerous immediate benefits. You get all the skeletal animation of 3D meshes in 2D, same material system and lighting in 2D as you did in 3D, you can switch between 2D and 3D at any time and mix 2D and 3D scenes in any order. The entity mouse input callbacks now use ray picking instead of screen coordinate tests, which means that you can add mouse event callbacks to any entity in both 2D and 3D and many other conveniences of not having two separate systems.
The drawbacks of this change are obviously the fact that it will completely break all of your existing Screen-based code and the obsoleteness of the 2D scene editor in the IDE. The code breaking, as terrifying as it seems should not be so bad (I ported the UI module, which was 100% ScreenEntity based, to the new system in a couple of hours using mostly find and replace).
The 2D editor code will be updated into the third dimension over the coming weeks and the IDE will finally have one unified scene editor, usable for both 2D and 3D and will be able to open (but obviously not save) entity2d files for backward compatibility.
Another fairly major change in the API is the removal of direct transform accessors in the entities. This feature was added as a convenience fairly recently, but has since proven to be too slow in practice (all positioning in Polycode is matrix-based and having direct transform accessors means either rebuilding the matrix on every frame or checking if the values have changed, both of which are very CPU intensive for large quantities of entities). So now, you have to use foo->setPositionX(1.0), for example, instead of foo->position.x = 1.0. Not a big deal, but might also break some existing code.
Some other things that I have been working on is better project and document management in the IDE. Instead of all projects being in one file tree, you can now switch between projects as separate workspaces and edit their layout as you see fit.
I added an editor splitting system to the IDE, so you can slice and dice the workspace however you want and a tab system so you can create separate workspaces for different tasks. For example, you can have a coding tab that has two files open side by side, and a content editor tab with a material editor, scene editor and sprite editors open in it.
I also added a light theme to the UI and the ability to switch between UI themes in the IDE.
This is all still a work in progress right now, but here’s a preview of what it all looks like.
So, this has been the main chunk of work being done during my limited free time these past two months and is currently living in the “screenrewrite” branch, but will soon become the new master. I am viewing this update as a chance to make some sweeping, but much needed optimizations that would be very hard to make after an official release.
The next chunk of work will be rewriting the 2D editor to support 3D scenes and I should have an update on that in a week or two.
Finishing up the last big feature before 0.8.2 release: the post processing shader effect editor.
Creating cubemaps in the material editor.
Rewriting and updating the Polycode shader/material editor.
maninblacksweater asked: 1) Will be able to create applications for Android, iOS, HTML5? 2) What do you think about Love2D, Dreemchest and Agen?
1) Android and iOS support is coming soon after the release. There will most likely never be HTML5 support, though a browser plugin and NaCl support will almost certainly happen.
2) Love2D is great and was an inspiration to many of Polycode’s features. Never heard of Dreemchest or Agen.
Here’s Polycode running happily in Linux.
You might (or might not) have noticed that the Polycode website/tumblr/twitter and the Polycode logo colors have slightly changed. This is part of a global redesign that’s happening as we get it ready for release.
A consistent style guide was developed for the Polycode website and the IDE UI was redesigned to match the global style (and since that is the default Polycode UI theme, this will be the default theme when you create your own UI controls in Polycode).
Anonymous asked: Is polycode free?
Yes, Polycode is free and open source.