Posts Tagged ‘deploy-ng’

October 2018 Development Update

Sunday, November 11th, 2018 by fireclaw

PyWeek

Two weeks ago, the semi-annual PyWeek challenge was held. In case you are not familiar with PyWeek, it’s a challenge to create a game within only seven days. The contestants are free to use any engine as long the game is written mostly in Python. Before the challenge begins, contestants vote on a theme in order to inspire and challenge the entrants’ creativity. The theme for the October challenge was “Flow”.

In this 26th PyWeek, two contestants have used Panda3D for their submissions. We’d like to highlight some of the challenges they faced and show how Panda3D helped them to finish their games in such a short time. They both used development builds of the upcoming Panda3D 1.10, which made for a great opportunity to test the new features, and the new deployment system in particular. Being able to quickly install Panda3D using pip has also been a very welcome feature for PyWeek, since installing Panda3D has been a stumbling block for PyWeek users in the past.

Chart of Flowrock

Chart of Flowrock

This entry was created by our community member wezu. It is an original take on the dungeon crawler game using only three keyboard buttons where possible moves are represented with a flowchart diagram at the bottom of the screen.
One feature from the Panda3D engine that helped wezu getting this game done was the intervals. These are functions to manipulate values—such as an object’s position and rotation—over a given period of time without the need to use tasks to manage those updates manually. Using intervals, he was able to quickly develop convincing walking animations with head bob and tilting when turning.

The game’s impressive graphical style was achieved thanks to a shader framework wezu developed, which is publicly available at GitHub. It has been made as a drop-in replacement for the built-in Cg-based ShaderGenerator, implementing various modern effects using GLSL 1.30. This proved to be a bit of a challenge in testing: while GLSL 1.30 shaders are typically usable on most platforms, OpenGL support has always been a bit behind on macOS, and has in fact even been deprecated by Apple as discussed in a previous blog post. This forced him to implement a special “potato mode” for low end and macOS systems that wouldn’t utilize these shaders. In this mode, the game would still be playable, just without those fancy graphics.
Working on an improved shader pipeline that avoids some of the driver-specific compatibility issues is high on the agenda for the Panda3D developers, which will help making shader-based game work reliably on multiple platforms without requiring extensive testing and tweaking the shaders for different drivers.

Chart of Flowrock won silver rating in the Production category and ranked sixth overall among the individual entries.

Let There Be Light

Let There Be Light

Our second entry that has been made for PyWeek was created by our main engine developer rdb. This game is a kind of strategic puzzle building game where you have to build an energy grid in order to supply cities with power and enable them to grow. The energy demand of the cities grows over time so you have to carefully plan your network so that your wires don’t overheat. For this game rdb decided to take a less heavily graphics-focused approach, instead going for a minimalistic art style with flat colors, low-poly models and simple lighting. The game employed numpy for calculating the currents through the nodes of the energy grid.

As the power lines were one of the most important elements of the game, some attention to detail was given with how they are rendered. The LineSegs class made it easy to draw nice catenaries between the pylons. Panda3D made the math rather easy to ensure that the wires connected up properly to the pylons regardless of their orientation: dummy points were added to the pylon models indicating the points where the wires should attach, so it was only necessary to use getRelativePoint() to determine the correct two points to draw the arc between.

As the player interacts with the game primarily using the mouse, extra attention was given to ensure a good user interface so that it is clear to the player what to do. Panda3D’s text nodes and billboard effects made it particularly easy to add labels in the 3D scene to clearly communicate where the user needs to click and what will happen when they click it, and intervals made it easy to give the important labels a nice animation to draw the eye. The free Font Awesome icon font was used to easily render crisp icons.

The sound and music had to be pushed off to the last few hours of the final day, but fortunately loading and playing spatialized sounds in Panda3D takes only a few lines of code. Having sound effects can really help with the user experience like this by giving direct feedback to the player’s actions. Smoothly adjusting the play rate of the music depending on the game speed was a nice touch appreciated by the reviewers, which took only a few minutes to implement using Panda3D.

Let There Be Light won gold ratings in the Fun and Production categories, Silver in the Innovation category and became the winner of PyWeek 26 among the individual entries.

Engine Developments

Despite the distraction of PyWeek, development of the engine has not remained idle. Plenty of bugfixes and stability improvements bring the engine ever closer towards the upcoming 1.10 release. We’ll give you a small selection of the many changes that have happened.

If you have ever tried loading models in a model format other than Panda3D’s own bam or egg formats, you may have already come across the Assimp loader, which has been in the Panda3D source for a while but was considered experimental. This uses the Assimp library, which supports most of the 3D formats in common use. This importer is now enabled by default and can be used in recent development builds.

On the graphical side were a few fixes and enhancements too. A big change was made in the rendering system to resolve some inconsistencies in how colors and material were being applied in the absence of lighting. It is normally the case that materials are not visible unless you have a light applied to the model, but in some cases (such as in the presence of a color scale), the material colors could show up anyway. It was also not always clear when vertex colors would show up or when they would be suppressed by the material. These behaviors have now been made consistent between the different rendering back-ends and the shader generator. If these changes are affecting your game, just let us know and we can help you resolve these problems.

As of 1.9.0, Panda3D has a GLSL preprocessor which among other things allows #include statements to include other files within the current shader. This is crucial for games that rely heavily on shaders, as functions often need to be shared between different shaders or just separated for better code organisation. It has recently seen some improvements, such as the ability to use it with procedurally generated shaders that are passed into Shader.make(), some optimizations to reduce the preprocessed size, and some parsing fixes.

There also have been some improvements on the Windows front. It is now possible to change the undecorated and fixed-size attributes of already-opened windows. There have also been some improvements in the build time when compiling with Eigen support on Windows.

The deploy-ng system has received a new feature: it can now use an optimized version of the Panda3D binaries, stripped of debug information and safety checks, when deploying a game. deploy-ng can make use of an optimized version of the Panda3D wheels that are available on our pip mirror under a special +opt tag. This allows deployed games to be smaller and faster while still providing the benefit of all the debug features and safety checks in the SDK.

A look behind the curtains

Monday, November 20th, 2017 by fireclaw

Much has happened in Panda3D development for the upcoming 1.10 version. To bring you up-to-date with the latest developments, we will summarize some of the new changes here. Also, to further keep you informed about new and upcoming features, we’ll start a regular blog post series highlighting new developments.

Aside from a lot of optimization changes to improve various parts of Panda’s performance, as well as numerous bugfixes to improve stability and compatibility, there were some larger changes as well.

Python support

The first thing we’d like to highlight is the ability for Python users to install Panda3D via the pip package manager. No more fiddling with platform dependent installers—it takes only a single command to install the right version of Panda3D for your platform and Python version:

pip install panda3d

As a bonus feature, this allows you to install Panda into a virtualenv environment, allowing you to try out the latest development version in isolation without fear of contaminating your existing setup.

Furthermore, Panda3D has been updated to be compatible with the latest Python 3 versions. This includes interoperability with the pathlib module and the Python 3.6 path protocol, as well as fixes for the upcoming Python 3.7.

The Shader Generator

If you are using the shader generator in your application, you may significantly benefit from upgrading to 1.10. It has been overhauled to address a major performance concern for applications with complex scenes containing a large amount of render states, which could cause lag due to an excessive amount of shaders being generated.

Some new features have been added as well, such as support for hardware skinning and multiple normal maps.

Text rendering updates

The text rendering subsystem has been improved significantly. Panda’s text assembler used to perform well mainly for smaller texts, whereas frequently updating large blocks of text could cause considerable lag. But the improved text assembler code is up to 75 times as fast, making assembling large swaths of text a non-issue.

A comparison with HarfBuzz disabled and enabled. Of note is the spacing between the A and V, the "fi" ligature. The Arabic text renders like a mess without HarfBuzz.

A comparison with HarfBuzz disabled and enabled. Of note is the spacing between the A and V, the “fi” ligature. The Arabic text doesn’t render correctly at all without HarfBuzz.

Furthermore, the HarfBuzz library can now be utilized to implement text shaping, which not only enables support for ligatures and correct kerning but also allows us to better support languages with more complex shaping requirements, such as Arabic. This includes support for right-to-left text rendering, with automatic language detection enabled by default. Although bidirectional text is not yet fully supported, you can explicitly switch or re-detect direction for specific text segments using embedded TextProperties.

If Panda3D has been compiled with HarfBuzz support, it can be enabled using the text-use-harfbuzz variable. Otherwise, more basic kerning support can be enabled using text-kerning true, although many fonts will only kern correctly with HarfBuzz enabled.

Media playback

Panda3D now directly supports the Opus audio codec, a high-quality open standard designed to efficiently encode both speech and other audio. This is implemented via the opusfile library, so that it doesn’t require pulling in the heavier and more restrictively licensed FFmpeg libraries.

The FFmpeg plug-in now also supports loading video files with an embedded alpha channel, such as is possible with WebM files encoded with the VP8 codec. However, FFmpeg offers both a preferred native implementation and a decoder based on libvpx. The default is the native implementation, so if you wish to play VP8 videos with alpha channel, you should set the ffmpeg-prefer-libvpx configuration variable to true, to force FFmpeg to use the libvpx implementation.

 

We’d also like to highlight ongoing work outside the main Panda3D development branch. These things have been developed for Panda3D and will be merged into the main branch when they have reached maturity. But until then, they can be checked out from their respective branches on GitHub.

Deployment

First off, significant progress has been made on a new deployment system thanks to invaluable contributions by the community. The project is tentatively named “deploy-ng” and intends to make it easier more reliable to package and distribute your finished application, and as such it stands to replace the current deployment system entirely.

This new deployment system builds upon the existing Python setuptools, adding an extra plug-in to easily package your Panda3D applications. It already is quite usable, but still needs some love and testing until it’s production ready.

Graphics back-ends

A significant amount of work has been done on the effort to support two new graphics back-ends. The first of these is the WebGL back-end, happening on the webgl-port branch. This allows us to run Panda3D applications in the browser without requiring the use of a browser plug-in. The bulk of the work on the renderer itself has already been done, but there remains work to be done to make it easier to package up a Panda application for the web. Check out the proof-of-concept demos or the online editor demo if you’re curious about the possibilities.

On the vulkan branch, a prototype renderer for the new Vulkan graphics API has materialized as well. Like OpenGL, Vulkan is a cross-platform open graphics standard developed by Khronos. Unlike OpenGL, however, Vulkan offers a more low-level interface to the underlying graphics hardware, enabling a reduction in driver overhead for CPU-bound applications. Before you get too excited though, it’s not yet capable of running much more than a few of the sample programs. There is a lot more work to be done before it will reach feature-parity with or performance benefits over the OpenGL renderer, and it is unlikely to be a priority for the next release.

glTF 2.0

Behind the curtains there also is work going on to support glTF 2.0. This is a new JSON-based model transmission format recently standardized by the Khronos Group, the consortium that is also responsible for OpenGL, and plug-ins are already available to export it from various content creation tools. Importantly, glTF 2.0 defines a modern standard for physically-based materials, and as such is considered a milestone in the development of a physically-based rendering pipeline in Panda3D.

Input devices

Gamepad support is something that many in the community have been asking about for a long time. The input framework is receiving a significant overhaul to allow us to support game controllers, while also laying the groundwork for exposing commercial virtual reality hardware using a straightforward API. This work is happening on the input-overhaul branch and will be merged into the master branch soon.

 

That’s all for now, but keep an eye open for upcoming blog posts with all new and interesting updates in the coming months. In the meantime we encourage you to try the latest version for yourself and let us know how it works for you.