Planet Gamedev

Game AI for Developers

BROADCAST: Evolve: Building PvP Artificial Intelligence for Hunters and Monsters (July 9th)

by Alex J. Champandard at July 02, 2015 09:00 AM

BROADCAST: Evolve: Building PvP Artificial Intelligence for Hunters and Monsters (July 9th)

This upcoming broadcast on Thursday, July 9th at 19:00 UTC will take place online within your browser using streaming audio/video:

“This interview with Troy Humphrey's digs into the AI behind Evolve, from the underlying systems to the gameplay behaviors. Troy will share details about the technology and insights from development.”

To subscribe for email reminders and check the exact time in your current timezone, visit this broadcast's page on AiGameDev.com.

BROADCAST: nucl.ai Conference Live Stream (July 20th)

by Alex J. Champandard at July 02, 2015 09:00 AM

BROADCAST: nucl.ai Conference Live Stream (July 20th)

This upcoming broadcast on Monday, July 20th at 07:00 UTC will take place online within your browser using streaming audio/video:

“Join us live on July 20-22 for three days of Artificial Intelligence in Creative Industries, including presentations about character animation, agent behavior, analytics & data-science, crowds and ambient life, systemic design, procedural generation — and many more! http://nucl.ai/ ”

To subscribe for email reminders and check the exact time in your current timezone, visit this broadcast's page on AiGameDev.com.

Gamasutra Feature Articles

Blog: Her Story is not your story

July 02, 2015 08:00 AM

"Her Story is not your story. Piecing it together is your experience and how it shapes in your mind is unique to you, but that doesn't make it your story." ...



Designing You Must Build A Boat amid the rising tide of game releases

July 02, 2015 08:00 AM

Indie dev Luca Redwood opens up about his experience trying to follow up his hit mobile game 10000000 with You Must Build A Boat amid a rising tide of game releases that make discoverability tough. ...

Gamasutra Feature Articles

PS4 and Xbox One aren't big in China, yet TV-based games grow in popularity

July 01, 2015 11:39 PM

The official launches of Sony and Microsoft's game boxes hasn't made a big impact on the market -- but there are big expectations for the TV-based gaming space. ...

Riot invests in game VoIP provider Curse

July 01, 2015 10:26 PM

A year after Curse launched its Curse Voice service, the publisher of League of Legends has backed the well-funded startup. ...

Game From Scratch

Blender 2.75 released

by Mike@gamefromscratch.com at July 01, 2015 10:10 PM

Today the Blender foundation announced the release of Blender 2.75. Not really a ton there from game developers specifically but a solid release all the same.

 

Image by Cosmos Laundromat - cosmoslaundromat.org

Blender Foundation and the blender.org developer community are proud to present the official Blender 2.75 release. The main highlights of this release are:

  • Blender now supports a fully integrated Multi-View and Stereo 3D pipeline
  • Cycles has much awaited initial support for AMD GPUs, and a new Light Portals feature.
  • UI now allows font previews in the file browser.
  • High quality options for viewport depth of field were added
  • Modeling has a new Corrective Smooth modifier.
  • The Decimate modifier was improved significantly.
  • 3D viewport painting now supports symmetry and the distribution of Dynamic Topology was improved
  • Video Sequence Editor: Placeholders can now replace missing frames of image sequences
  • Game Engine now allows smoother LOD transitions, and supports mist attributes animation
  • And: 100s of bug fixes and smaller feature improvements.
Released: July 1, 2015.

Complete release notes are available here.

 

Geeks3D Forums

Blender 2.75 Released

July 01, 2015 09:01 PM

The Blender Foundation and online developer community are proud to present Blender 2.75!

   Download the 2.75 Release 

  • Blender now supports a fully integrated Multi-View and Stereo...

Gamasutra Feature Articles

Video: A design retrospective of Civilization: Beyond Earth

July 01, 2015 08:08 PM

Civlization: Beyond Earth leads David McDonough and Will Miller reveal how they took evolved the perennially popular civilization-building game for humanity's possible future on an alien planet. ...



Get a job: Cryptic Studios seeks an experienced Animator

July 01, 2015 07:45 PM

The studio that built Neverwinter is looking for an experienced animator to take a senior role at Cryptic's Los Gatos, CA-based office and work on massively multiplayer online games. ...

First Flight is Sony's new crowdfunding platform for internal projects

July 01, 2015 07:00 PM

Sony is experimenting with new ways of doing business by launching First Flight, a crowdfunding platform Sony teams can use to gauge public interest and drum up public investment in new business projects. ...

Don't Miss: Why the metrics aren't the message

July 01, 2015 06:00 PM

In this timeless feature, industry veteran Laralyn McWilliams explains how a pivotal moment in her life showed her that over-reliance on analytics and player friction in games isn't the answer. ...

Swedish broadcasting firm pays $86M for a majority stake in ESL

July 01, 2015 05:50 PM

The Modern Times Group, best known for its TV sports broadcast networks, will buy a 74 percent stake in eSports firm ESL for € 78 million (~$86.3 million USD) to expand its eSports coverage. ...

Report: Attending the The International Roguelike Developers Conference

July 01, 2015 05:07 PM

John Harris returns with a special version of his @Play series: A report from the International Roguelike Developers Conference, where talks were given on the state of the beloved genre. ...

Sponsored: Creating a simple puzzle game in Unity

July 01, 2015 04:56 PM

Microsoft brings you a tutorial on how to make a simple puzzle game in Unity. Check out the in-depth walkthrough, which includes plenty of code. ...

10 things you should know about ... QA

July 01, 2015 04:30 PM

"We look at your work with the eyes of the client, the licensor, the first party manufacturer, the user. We wear their hats so we can tell you what they will experience." ...

Game Design Aspect of the Month

Upcoming Workshop: Writing for Sci-Fi, Fantasy & Horror Game Worlds

by noreply@blogger.com (Sande Chen) at July 01, 2015 03:54 PM


Hi! I'm pleased to announce a writing workshop I'm leading in conjunction with Playcrafting NYC. If you're interested in science fiction, fantasy, and/or horror and want to populate your game world with monsters, creatures, aliens, fantastical beasts, and otherworldly cultures, you can benefit from this participatory workshop.  It's next week, July 6th, details here.

I've written about the workshops I've attended to learn more about my own writing. I want this workshop to be about improving your work. I'll provide the framework but you will be the ones writing or developing your game world during the class.  Above all, let's have fun!

My background is a mixture of theatre, film, journalism, economics, and writing.  I received a S.B. in Writing and Humanistic Studies (now the major of Comparative Media Studies) at MIT, where I took classes on everything to do with science and writing, including science fiction.  My first game design doc was within science fiction; my first game writing gig, the space combat RPG Terminus, was science fiction.  Afterwards, I worked on the episodic fantasy series Siege of Avalon, MMO Wizard101, and the dark fantasy RPG, The Witcher.  As you might surmise, if you love genre fiction, then there may be opportunities waiting for you in the video game industry.

Sande Chen is a writer and game designer whose work has spanned 10 years in the industry. Her credits include 1999 IGF winner Terminus, 2007 PC RPG of the Year The Witcher, and Wizard 101. She is one of the founding members of the IGDA Game Design SIG.

Gamasutra Feature Articles

Games affecting people

July 01, 2015 03:52 PM

Raph Koster that despite arguments to the contrary, we must accept -- we do accept -- that games have an effect on people, and we must also be conscious of that power. ...



Bug-testing scientific research on video games

July 01, 2015 11:03 AM

"Science is self-correcting by repeating the studies to reaffirm or dis-confirm findings. This is quite similar to game testing: Game bugs are identified, game testers repeatedly replicate the conditions." ...

GDC Europe State of the Industry: Devs moving from mobile to PC

July 01, 2015 09:00 AM

GDC Europe 2015 officials have released the results of the third annual European State of the Industry Survey, which offers insight into which platforms are most appealing, the perceived value of crowdfunding and what VR means for the industry at large. ...

5 rules to break when developing a mobile game

July 01, 2015 08:02 AM

CrowdStar made its mobile game Covet Fashion a hit with fans by ignoring the conventional wisdom. Here, CEO Jeffrey Tseng shares his tips for success. ...

Surrendering control and trusting in players with Her Story

July 01, 2015 08:02 AM

For Her Story developer Sam Barlow, surrendering his story to players was a mental hurdle he had to overcome as a writer. But it seems to have paid off. ...

Timothy Lottes

The Making of: ROM City Rampage

by Timothy Lottes (noreply@blogger.com) at July 01, 2015 06:16 AM

Gamasutra Feature Articles

Sony hits '70-90%' console market share in Europe with PS4

June 30, 2015 10:12 PM

"Well, we have market leadership in every country in Europe, and have very significant market leadership in continental Europe. Extremely significant," says SCEE president Jim Ryan. ...



Star Citizen's FPS module delayed, as Roberts exposes AAA dev to the public

June 30, 2015 09:35 PM

Star Citizen has almost $85 million to play with, but even a massive budget like that doesn't isolate you from production problems: its FPS module has been delayed. ...

Timothy Lottes

Sugar Free Peppermint Chocolate Chip Custard Ice Cream [SFPCCCIC]

by Timothy Lottes (noreply@blogger.com) at June 30, 2015 09:53 PM

Been experimenting with ketogenic friendly ultra-low-carb ice cream. This, along with bacon-wrapped sour cream, is one of the perks of the extremely high fat and low carb life style. First experiment didn't go as planned, placing the result in the freezer was a mistake. Apparently sugar in normal ice cream actually is the key component which enables the ice cream to maintain a great texture when frozen. Second pass, I'm keeping the result in the fridge. Ingredients for part one,

1 pint - whole cream
3 - egg yokes
1/4 tsp - peppermint extract
4 drops - pure liquid stevia (in water)

Blend everything together in a blender on high. Pour in a pan on the stove, stirring and slowly bring up to 160 deg F. Pour in a chilled container, store in fridge until chilled. Extra ingredients for part two,

1 - Lindt 90% chocolate square

Pour chilled mixture in ice cream maker, along with chopped chocolate square. Lindt 90% is better than the lower cocoa thanks to it's higher fat content. Churn until mixture looks like ice cream. Add to chilled container, store in fridge until chilled. Eat. Turned out awesome. Going to try higher peppermint next time and maybe another drop of stevia...

Gamasutra Feature Articles

Video: How Disney designs VR experiences for themeparks

June 30, 2015 08:33 PM

Walt Disney Imagineering was one of the original VR pioneers in the late 1980s, and at GDC 2015 Imagineer Bei Yang shared lessons learned from 20 years of crafting VR experiences. ...



Fallout 4, Star Wars Battlefront lead Game Critics' E3 award noms

June 30, 2015 08:04 PM

In the wake of E3 2015, its interesting to note that Bethesda's Fallout 4 and Electronic Arts' Star Wars Battlefront picked up multiple nominations for this year's Game Critics Best of E3 Awards. ...

Get a job: Firaxis is hiring a Multiplayer Programmer

June 30, 2015 07:31 PM

Civilization: Beyond Earth studio Firaxis Games is looking for a network programmer with C/C++ and Visual Studio skills to help develop multiplayer game mechanics at its Baltimore, MD offices. ...

Australia's new age ratings program sees hundreds of games banned

June 30, 2015 07:18 PM

Heads up, devs: if your game has been refused classification by the International Age Ratings Coalition, it may be banned from sale in Australia on Google Play/Firefox as part of a new pilot program. ...

Don't Miss: Unorthodox tips for improving your programming skills

June 30, 2015 06:17 PM

There are plenty of good resources out there that teach technical skills; this timeless post concentrates on more personal lessons that you often only learn through experience or trial and error. ...

Elder Scrolls Online creative chief steps down to join Gearbox

June 30, 2015 06:05 PM

Longtime designer Paul Sage recently stepped down as creative director of Zenimax Online Studios' Elder Scrolls Online MMORPG and returned home to Texas to take on a similar role at Gearbox. ...

Mojang has now sold over 20M copies of Minecraft on PC

June 30, 2015 05:43 PM

Mojang has managed to sell over 20,000,000 copies of Minecraft on PC as of this morning, bringing the remarkably popular sandbox game up into the league of top-sellers like Super Mario Bros. ...

Free-to-play evolution: It's all about adapting to the ride

June 30, 2015 05:04 PM

"With massive downloads, the user behaviour is spread across a wide set of personas, players with different skill levels, experience and expectations from the game. How do you cater to them all?" ...

Opening new windows into player choices

June 30, 2015 04:18 PM

A design tool for giving players a new window into the choices your game offers: Mike Stout walks you through how you can offer players ways into your game systems. ...

Come out to GDC Europe and learn how Cities: Skylines was made

June 30, 2015 04:01 PM

Leading experts discuss best practices for developing mobile games for the Chinese market, and Colossal Order deconstructs its hit city-builder Cities: Skylines at GDC Europe in Cologne, Germany this August. ...

6 metrics for better game narrative

June 30, 2015 03:27 PM

Former BioWare writer Alexander Freed: "Game metrics are nothing more or less than a way of increasing your understanding of your audience." ...

How a Hellraiser tie-in became Super 3D Noah's Ark

June 30, 2015 01:26 PM

This excerpt from Gabe Durham's terrific book on the game Bible Adventures lays out the backstory on one of the most unusual FPS games ever made. ...

5 in-game events all free-to-play games should track

June 30, 2015 10:52 AM

"Having granular details of how players interact with different elements in your game allows you to really understand how it's performing and what specific areas you need to concentrate on." ...

Esports betting platform Unikrn secures $7 million in further funding

June 30, 2015 10:46 AM

Unikrn has secured $7 million in further funding during their Series A round of investment. Investors include Binary Capital and Mark Cuban. ...

It's all about retention

June 30, 2015 08:01 AM

What every F2P game needs, and how to get it: "In all its simplicity, retention is a fancy word for describing people coming back to your game. Good retention means you've got people playing." ...

Building a narrative out of push notifications in Lifeline

June 30, 2015 08:00 AM

3 Minute Games set out to make a simple text adventure. They ended up hitting upon a killer app for gaming on the Apple Watch. ...

David Perry Blog

Ex Machina (The Movie)

by David Perry at June 30, 2015 04:29 AM

I never went to see this movie in the theater, didn’t watch the trailers, I literally knew nothing about it.  I ended up watching it to see if the computer graphics are “there yet”.

There are technological leaps coming that can’t happen until a myriad of individual technologies progress dramatically.  A simple example would have been Virtual Reality or Augmented Reality as there were numerous components (displays, gyros, rendering etc.) that all had to advance to make the combined experience possible.

I saw Ray Kurzweil speak years ago at a conference and he compared our knowledge of the human brain, being like we’d just been given the first ever CPU in a computer case.  But we couldn’t open the case, we could just put sensors around it and try to work out how it’s so smart.

This movie is the perfect example of how far we still have to go.  I watch lectures on just about every component that could make robotic AI that would pass the Turing Test (where you believe the software is a human), but each component still has so far to go.  From batteries, to silent motors, to vision systems, to cognition, awareness etc.  Even things like “common sense” are insanely difficult challenges.

I’ve seen attempts on the Turing test were people have put computers in public places and recorded the questions they get asked so they can write great “surprising” responses.  But if you ask something bizarre or complicated you always break it.  “What did you mean by your answer two questions ago?”…  Oh snap.   “What price is fish?”…  Oh snap.

So I absolutely loved this movie.  It’s the kind of work that inspires technologists, much like the Light Saber in Star Wars or the Hoverboard in Back to the Future.  Robots are generally “robots” and I think this is a kick in the pants to push much harder to stop accepting the “walking like robots” “talking like robots” etc.

The movie making technology was also equally incredible, I didn’t see the use of all the typical motion capture suits with marker balls and green screens.  I like that to make a movie about artificial intelligence was technically very hard.

Anyway, as you can probably tell, this is my favorite kind of experience, when it’s all just a really good surprise.

It reminds me of seeing “The Terminator” for the first time.  I knew nothing about that either, I was stuck in the rain outside a movie theater in England, and a friend and I went in and watched it in an empty theater.  We were both blown away.

So robot makers keep heading towards making the Terminator T-800 Model 101, when they should be studying ballet dancers.

They need to see this movie.


Just for contrast, here’s what Chatbots sound like today, it’s a nightmare!


Movie Making Info – Video Contains some spoilers.


Filed under: Movies Tagged: Ex Machina

Gamasutra Feature Articles

Q& A: How your games can find players, on recommendation site Product Hunt

June 29, 2015 11:00 PM

Gamasutra speaks to Russ Frushtick, head of the Product Hunt games category, which is currently in beta -- about the site's hopes to connect developers to players. ...

Toys and games come together, as Disney merges divisions

June 29, 2015 10:32 PM

Disney Infinity is having a big effect on the company, and its consumer products and interactive divisions are becoming one. ...

Shigeru Miyamoto isn't deeply involved in the Nintendo NX's design

June 29, 2015 10:04 PM

"I've pulled myself back out of some of the hardware section... Of course I am observing and looking at the hardware, but I am not actively participating and making decisions." ...

Fallout Shelter's success is shaking things up at Bethesda

June 29, 2015 09:43 PM

"First and foremost, we're continuing to look more and more at doing things in the space that make sense on their own. Because we don't really control who in the mobile space is going to decide to play your game." ...

Video: The physics of proper pole control in Super Pole Riders

June 29, 2015 08:12 PM

At GDC 2015, Bennett Foddy talks about the problems he faced in designing the physics of the pole-vaulting and ball-kicking mechanics in his fiendish multiplayer game Super Pole Riders. ...

Get a job: Red 5 is hiring an experienced Audio Programmer

June 29, 2015 07:52 PM

Firefall developer Red 5 Studios is on the hunt for a senior audio programmer to join the team at the studios' Irvine, CA offices and work on designing, implementing and debugging audio systems. ...

Budgeting for the most successful Kickstarter in video game history

June 29, 2015 07:47 PM

Castlevania veteran Koji Igarashi made $5.5 million for Bloodstained, and there are a lot of lessons to be learned from how he did it. Here's an analysis based on an extensive conversation with him. ...

Mojang closes the book on Scrolls

June 29, 2015 07:38 PM

Minecraft developer Mojang is wrapping up work on its strategic digital card game Scrolls, noting in a farewell post that the game's servers will be kept online through at least July of next year. ...

Report: 24% of games in Steam's Summer Sale generated 94% of revenue

June 29, 2015 07:12 PM

Sergei Galyonkin, developer of the Steam Spy analytics platform, has published a blog post that offers developers some intriguing insight into Valve's most recent Steam Summer Sale. ...

Don't Miss: Blizzard's Diablo II postmortem, 15 years later

June 29, 2015 06:39 PM

15 years ago this week, Blizzard released Diablo II. Celebrate by reading EP Erich Schaefer's account of what went right and wrong during development of one of Blizzard's most impactful games. ...

Nvidia deconstructs its VR game rendering tech for developers

June 29, 2015 05:52 PM

Nvidia continues to pitch devs on its VR tech with a technical deep dive into its "Gameworks VR" suite of virtual reality rendering tools written by a former Sucker Punch graphics programmer. ...

Taking your game the direction it wants to go, and finding an audience

June 29, 2015 04:57 PM

A postmortem of Lemma, a first-person, voxel-based game which evolved during its production and eventually found an audience on Steam, thanks, in part, to YouTubers. ...

Rewarding failure, and focusing on control in platformer design

June 29, 2015 04:06 PM

Rude Bear Resurrection focuses on tight control and on letting players -- all players -- make it through its masocore gameplay experience. Developer Alex Rose details both in this blog. ...

OpenGL

Remograph Releases OpenGL-based Remo 3D v2.5

June 29, 2015 03:52 PM

Remograph today announced the release of Remo 3D v2.5. This new version 2.5 of Remo 3D brings a new Modify UV tool, improvements to the script and macro support and other various fixes. The full list of new features and improvements can be found in the release notes on our website. Remo 3D was developed using OpenGL, OpenSceneGraph, FLTK and Lua.



Gamasutra Feature Articles

This Week in Video Game Criticism: What's old is Shenmue again

June 29, 2015 03:15 PM

This week, our partnership with game criticism site Critical Distance brings us picks from Johnny Kilhefner on topics ranging from reactions to Shenmue 3's Kickstarter to Tale of Tales' decision to take a break from game development. ...

Why did the ending of Mass Effect 3 sink the audience's opinion of the whole series?

June 29, 2015 02:12 PM

"One has to wonder if the game would have benefitted from some kind of more enjoyable coda or epilogue. Going into that fun experience for just a few minutes might have made a large difference." ...

GameDev.Net Articles

How the PVS-Studio Team Improved Unreal Engine's Code

June 29, 2015 01:07 PM

This article was originally published at Unreal Engine Blog. Republished by the editors' permission.

Our company develops, promotes, and sells the PVS-Studio static code analyzer for C/C++ programmers. However, our collaboration with customers is not limited solely to selling PVS-Studio licenses. For example, we often take on contract projects as well. Due to NDAs, we're not usually allowed to reveal details about this work, and you might not be familiar with the projects names, anyway. But this time, we think you'll be excited by our latest collaboration. Together with Epic Games, we're working on the Unreal Engine project. This is what we're going to tell you about in this article.

As a way of promoting our PVS-Studio static code analyzer, we've thought of an interesting format for our articles: We analyze open-source projects and write about the bugs we manage to find there. Take a look at this updatable list of projects we have already checked and written about. This activity benefits everyone: readers enjoy learning from others' mistakes and discover new means to avoid them through certain coding techniques and style. For us, it's a way to have more people learn about our tool. As for the project authors, they too benefit by gaining an opportunity to fix some of the bugs.

Among the articles was "A Long-Awaited Check of Unreal Engine 4". Unreal Engine's source code was extraordinarily high quality, but all software projects have defects and PVS-Studio is excellent at surfacing some of the most tricky bugs. We ran an analysis and reported our findings to Epic. The Unreal Engine team thanked us for checking their code, and quickly fixed the bugs we reported. But we didn't want to stop there, and thought we should try selling a PVS-Studio license to Epic Games.

Epic Games was very interested in using PVS-Studio to improve the engine continuously over time. They suggested we analyze and fix Unreal Engine's source code so that they were completely clear of bugs and the tool wouldn't generate any false positives in the end. Afterwords, Epic would use PVS-Studio on their code base themselves, thus making its integration into their development process as easy and smooth as possible. Epic Games promised to not only purchase the PVS-Studio license, but would also pay us for our work.

We accepted the offer. The job is done. And now you are welcome to learn about various interesting things we came across while working on Unreal Engine's source code.

Pavel Eremeev, Svyatoslav Razmyslov, and Anton Tokarev were the participants on the PVS-Studio's part. On the Epic Game's, the most active participants were Andy Bayle and Dan O'Connor - it all would have been impossible without their help, so many thanks to them!

PVS-Studio integration into Unreal Engine's build process


To manage the build process, Unreal Engine employs a build system of its own - Unreal Build Tool. There is also a set of scripts to generate project files for a number of different platforms and compilers. Since PVS-Studio is first of all designed to work with the Microsoft Visual C++ compiler, we used the corresponding script to generate project files (*.vcxproj) for the Microsoft Visual Studio IDE.

PVS-Studio comes with a plugin that can integrate into the Visual Studio IDE and enables a "one-click" analysis. However, projects generated for Unreal Engine are not the "ordinary" MSBuild projects used by Visual Studio.

When compiling Unreal Engine from Visual Studio, the IDE invokes MSBuild when starting the build process, but MSBuild itself is used just as a "wrapper" to run the Unreal Build Tool program.

To analyze the source code in PVS-Studio, the tool needs a preprocessor's output - an *.i file with all the headers included and macros expanded.

Quick note. This section is only interesting if you have a customized build process like Unreal's If you are thinking of trying PVS-Studio on a project of yours that has some intricate peculiarities about its build process, I recommend reading this section to the end. Perhaps it will be helpful for your case. But if you have an ordinary Visual Studio project or can't wait to read about the bugs we have found, you can skip it.

To launch the preprocessor correctly, the tool needs information about compilation parameters. In "ordinary" MSBuild projects, this information is inherent; the PVS-Studio plugin can "see" it and automatically preprocess all the necessary source files for the analyzer that will be called afterwards. With Unreal Engine projects, things are different.

As I've already said above, their projects are just a "wrapper" while the compiler is actually called by Unreal Build Tool. That's why compilation parameters in this case are not available for the PVS-Studio plugin for Visual Studio. You just can't run analysis "in one click", though the plugin can be used to view the analysis results.

The analyzer itself (PVS-Studio.exe) is a command-line application that resembles the C++ compiler regarding the way it is used. Just like the compiler, it has to be launched individually for every source file, passing this file's compilation parameters through the command line or response file. And the analyzer will automatically choose and call the appropriate preprocessor and then perform the analysis.

Note. There's also an alternative way. You can launch the analyzer for preprocessed files prepared in advance.

Thus, the universal solution for integrating the PVS-Studio analyzer into the build process is to call its exe-file in the same place where the compiler is called, i.e. inside the build system - Unreal Build Tool in our case. Sure, it will require modifying the current build system, which may not be desirable, as in our case. Because of that, just for cases like this, we created a compiler call "intercepting" system - Compiler Monitoring.

The Compiler Monitoring system can "intercept" compilation process launches (in the case with Visual C++, this is the cl.exe proces), collecting all of the parameters necessary for successful preprocessing, then re-launch preprocessing for files under compilation for further analysis. That's what we did.


Attached Image: image2.png
Figure 1. A scheme of the analysis process for the Unreal Engine project


Unreal Engine analysis integration comes down to calling, right before the build process, the monitoring process (CLMonitor.exe) that will make all the necessary steps to do the preprocessing and launch the analyzer at the end of the build process. To run the monitoring process, we need to run a simple command:

CLMonitor.exe monitor

CLMonitor.exe will call itself in "tracking mode" and terminate. At the same time, another CLMonitor.exe process will remain running in the background "intercepting" the compiler calls. When the build process is finished, we need to run another simple command:

CLMonitor.exe analyze "UE.plog"

Please pay attention: in PVS-Studio 5.26 and above you should write:

CLMonitor.exe analyze -l "UE.plog"

Now CLMonitor.exe will launch the analysis of previously-collected source files, saving the results into the UE.plog file that can be easily handled in our IDE plugin.

We set a nightly build process of the most interesting Unreal Engine configurations followed by their analysis on our Continuous Integration server. It was a means for us to, first, make sure our edits hadn't broken the build and, second, to get in the morning a new log about Unreal Engine's analysis with all the edits of the previous day taken into account. So, before sending a Pull Request for submitting our edits to the Unreal Engine project repository on GitHub, we could easily make sure that the current version was stable in our repository by simply rebuilding it on the server.

Non-linear bug fixing speed


So, we have solved the project build process and analysis. Now let's talk about bug fixes we've done based on the diagnostic messages output by the analyzer.

At first glance, it may seem natural that the number of warnings output by the analyzer should drop evenly from day to day: about the same number of messages is suppressed by certain PVS-Studio mechanisms as the number of fixes that are done in the code.

That is, theoretically you could expect a graph looking somewhat like this:


Attached Image: image3.png
Figure 2. A perfect graph. The number of bugs drops evenly from day to day.


In reality, however, messages are eliminated faster during the initial phase of the bug fixing process than at the later stages. First, at the initial stage, we suppress warnings triggered by macros, which helps quickly reduce the overall number of issues. Second, it happened so that we had fixed the most evident issues first and put off more intricate things until later. I can explain on this. We wanted to show the Epic Games developers that we had started working and there was a progress. It would be strange to start with difficult issues and get stuck there, wouldn't it?

It took us 17 working days in total analyzing the Unreal Engine code and fixing bugs. Our goal was to eliminate all the general analysis messages of the first and second severity levels. Here is how the work progressed:


Attached Image: image4.png
Table 1. The number of warnings remaining on each day.


Notice the red figures. During the first two days, we were getting accustomed to the project and then suppressed warnings in some macros, thus greatly reducing the number of false positives.

Seventeen working days is quite a lot and I'd like to explain why it required this amount of time. First, it was not the whole team that worked on the project, but only two of its members. Of course, they were busy with some other tasks as well during this time. Secondly, Unreal Engine's code was entirely unfamiliar to us, so making fixes was quite a tough job. We had to stop every now and then to figure out if and how we should fix a certain spot.

Now, here is the same data in the form of a smoothed graph:


Attached Image: image5.png
Figure 3. A smoothed graph of the warning numbers over time.


A practical conclusion - to remember ourselves and tell others: It's a bad idea to try estimating the time it will take you to fix all the warnings based on only the first couple of days of work. It's very pacey at first, so the forecast may appear too optimistic.

But we still needed to make an estimate somehow. I think there should be a magical formula for this, and hopefully we'll discover it and show it to the world someday. But presently, we are too short of statistical data to offer something reliable.

About the bugs found in the project


We have fixed quite a lot of code fragments. These fixes can be theoretically grouped into 3 categories:

  1. Real bugs. We will show you a few of these as an example.
  2. Not actually errors, yet these code fragments were confusing the analyzer and so they can confuse programmers who will study this code in the future. In other words, it was "sketchy" code that should be fixed as well. So we did.
  3. Edits made solely because of the need to "please" the analyzer that would generate false positives on those fragments. We were trying to isolate false warning suppressions in a special separate file or improve the work of the analyzer itself whenever possible. But we still had to do some refactoring in certain places to help the analyzer figure things out.

As I promised, here are some examples of the bugs. We have picked out the most interesting defects that were clear to understand.

The first interesting message by PVS-Studio: V506 Pointer to local variable 'NewBitmap' is stored outside the scope of this variable. Such a pointer will become invalid. fontcache.cpp 466

void GetRenderData(....)
{
  ....
  FT_Bitmap* Bitmap = nullptr;
  if( Slot->bitmap.pixel_mode == FT_PIXEL_MODE_MONO )
  {
    FT_Bitmap NewBitmap;
    ....
    Bitmap = &NewBitmap;
  }
  ....
  OutRenderData.RawPixels.AddUninitialized(
    Bitmap->rows * Bitmap->width );
  ....
}

The address of the NewBitmap object is saved into the Bitmap pointer. The trouble with it is that right after this, the NewBitmap object's lifetime expires and it is destroyed. So it turns out that Bitmap is pointing to an already destroyed object.

When trying to use a pointer to address a destroyed object, undefined behavior occurs. What form it will take is unknown. The program may work well for years if you are lucky enough that the data of the dead object (stored on the stack) is not overwritten by something else.

A correct way to fix this code is to move NewBitmap's declaration outside the if operator:

void GetRenderData(....)
{
  ....
  FT_Bitmap* Bitmap = nullptr;

  FT_Bitmap NewBitmap;
  if( Slot->bitmap.pixel_mode == FT_PIXEL_MODE_MONO )
  {
    FT_Bitmap_New( &NewBitmap );
    // Convert the mono font to 8bbp from 1bpp
    FT_Bitmap_Convert( FTLibrary, &Slot->bitmap, &NewBitmap, 4 );

    Bitmap = &NewBitmap;
  }
  else
  {
    Bitmap = &Slot->bitmap;
  }
  ....
  OutRenderData.RawPixels.AddUninitialized(
    Bitmap->rows * Bitmap->width );
  ....
}

The next warning by PVS-Studio: V522 Dereferencing of the null pointer 'GEngine' might take place. Check the logical condition. gameplaystatics.cpp 988

void UGameplayStatics::DeactivateReverbEffect(....)
{
  if (GEngine || !GEngine->UseSound())
  {
    return;
  }
  UWorld* ThisWorld = GEngine->GetWorldFromContextObject(....);
  ....
}

If the GEngine pointer is not null, the function returns and everything is OK. But if it is null, it gets dereferenced.

We fixed the code in the following way:

void UGameplayStatics::DeactivateReverbEffect(....)
{
  if (GEngine == nullptr || !GEngine->UseSound())
  {
    return;
  }

  UWorld* ThisWorld = GEngine->GetWorldFromContextObject(....);
  ....
}

An interesting typo is waiting for you in the next code fragment. The analyzer has detected there a meaningless function call: V530 The return value of function 'Memcmp' is required to be utilized. pathfollowingcomponent.cpp 715

int32 UPathFollowingComponent::OptimizeSegmentVisibility(
  int32 StartIndex)
{
  ....
  if (Path.IsValid())
  {
    Path->ShortcutNodeRefs.Reserve(....);
    Path->ShortcutNodeRefs.SetNumUninitialized(....);
  }
  FPlatformMemory::Memcmp(Path->ShortcutNodeRefs.GetData(),
                          RaycastResult.CorridorPolys,
                          RaycastResult.CorridorPolysCount *
                            sizeof(NavNodeRef));
  ....
}

The return result of the Memcmp function is not used. And this is what the analyzer didn't like.

The programmer actually intended to copy a region of memory through the Memcpy() function but made a typo. This is the fixed version:

int32 UPathFollowingComponent::OptimizeSegmentVisibility(
  int32 StartIndex)
{
  ....
  if (Path.IsValid())
  {
    Path->ShortcutNodeRefs.Reserve(....);
    Path->ShortcutNodeRefs.SetNumUninitialized(....);

    FPlatformMemory::Memcpy(Path->ShortcutNodeRefs.GetData(),
                            RaycastResult.CorridorPolys,
                            RaycastResult.CorridorPolysCount *
                              sizeof(NavNodeRef));
  }
  ....
}

Now let's talk about a diagnostic message you are sure to encounter in nearly every project - so common is the bug it refers to. We are talking about the V595 diagnostic. In our bug database, it is at the top of the list regarding the frequency of its occurrence in projects (see examples). At first glance, that list is not as large as, say, for the V501 diagnostic. But it's actually because V595 diagnostics are somewhat boring and we don't write out many of them from every single project. We usually just cite one example and add a note like: And 161 additional diagnostic messages. In half of the cases, these are real errors. This is what it looks like:


Attached Image: image6.png
Figure 4. The dread of V595 diagnostic.


Diagnostic rule V595 is designed to detect code fragments where a pointer is dereferenced before being checked for null. We always find some quantity of these in projects we analyze. The pointer check and dereferencing operation may be set quite far from each other within a function - tens or even hundreds of lines away, which makes it harder to fix the bug. But there are also small and very representative examples like, for example, this function:

float SGammaUIPanel::OnGetGamma() const
{
  float DisplayGamma = GEngine->DisplayGamma;
  return GEngine ? DisplayGamma : 2.2f;
}

PVS-Studio's diagnostic message: V595 The 'GEngine' pointer was utilized before it was verified against nullptr. Check lines: 47, 48. gammauipanel.cpp 47

We fixed this in the following way:

float SGammaUIPanel::OnGetGamma() const
{
  return GEngine ? GEngine->DisplayGamma : 2.2f;
}

Moving on to the next fragment:

V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 289, 299. automationreport.cpp 289

void FAutomationReport::ClustersUpdated(const int32 NumClusters)
{
  ...
  //Fixup Results array
  if( NumClusters > Results.Num() )         //<==
  {
    for( int32 ClusterIndex = Results.Num();
         ClusterIndex < NumClusters; ++ClusterIndex )
    {
      ....
      Results.Add( AutomationTestResult );
    }
  }
  else if( NumClusters > Results.Num() )    //<==
  {
    Results.RemoveAt(NumClusters, Results.Num() - NumClusters);
  }
  ....
}

In its current form, the second condition will never be true. It is logical to assume that the mistake has to do with the sign used in it that initially was meant to provide for removing unnecessary items from the Result array:

void FAutomationReport::ClustersUpdated(const int32 NumClusters)
{
  ....
  //Fixup Results array
  if( NumClusters > Results.Num() )
  {
    for( int32 ClusterIndex = Results.Num();
         ClusterIndex < NumClusters; ++ClusterIndex )
    {
      ....
      Results.Add( AutomationTestResult );
    }
  }
  else if( NumClusters < Results.Num() )
  {
    Results.RemoveAt(NumClusters, Results.Num() - NumClusters);
  }
  ....
}

And here's a code sample to test your attentiveness. The analyzer's warning: V616 The 'DT_POLYTYPE_GROUND' named constant with the value of 0 is used in the bitwise operation. pimplrecastnavmesh.cpp 2006

/// Flags representing the type of a navigation mesh polygon.
enum dtPolyTypes
{
  DT_POLYTYPE_GROUND = 0,
  DT_POLYTYPE_OFFMESH_POINT = 1,
  DT_POLYTYPE_OFFMESH_SEGMENT = 2,
};

uint8 GetValidEnds(...., const dtPoly& Poly)
{
  ....
  if ((Poly.getType() & DT_POLYTYPE_GROUND) != 0)
  {
    return false;
  }
  ....
}

Everything looks fine at a first glance. You may think that some bit is allocated by mask and its value is checked. But it is actually just named constants that are defined in the dtPolyTypes enumeration and they are not meant for allocating any certain bits.

In this condition, the DT_POLYTYPE_GROUND constant equals 0, which means the condition will never be true.

The fixed code:

uint8 GetValidEnds(...., const dtPoly& Poly)
{
  ....
  if (Poly.getType() == DT_POLYTYPE_GROUND)
  {
    return false;
  }
  ....
}

A typo detected: V501 There are identical sub-expressions to the left and to the right of the '||' operator: !bc.lclusters ||!bc.lclusters detourtilecache.cpp 687

dtStatus dtTileCache::buildNavMeshTile(....)
{
  ....
  bc.lcset = dtAllocTileCacheContourSet(m_talloc);
  bc.lclusters = dtAllocTileCacheClusterSet(m_talloc);
  if (!bc.lclusters || !bc.lclusters)   //<==
    return status;
  status = dtBuildTileCacheContours(....);
  ....
}

When copy-pasting a variable, the programmer forgot to rename it from bc.lclusters into bc.lcset.

Regular analysis results


The examples above are by far not all the bugs found in the project, but just a small part of them. We cited them to show you what kind of bugs PVS-Studio can find, even in world-class thoroughly-tested code.

However, we'd remind you that running a single code base analysis is not the right way to use a static analyzer. Analysis needs to be performed regularly - only then will it enable you to catch a huge bulk of bugs and typos early in the coding stage, instead of the testing or maintenance stages.

The Unreal Engine project is a wonderful opportunity to prove our words with real-life examples.

Initially we fixed defects in the code without keeping track of whether they were fresh changes or old. It simply wasn't interesting in the early stages, when there were so many bugs to get through. But we did notice how the PVS-Studio analyzer started detecting bugs in freshly written or modified code after we cut the number of warnings to 0.

In fact, it took us a bit longer than 17 days to finish with this code. When we stopped making edits and achieved a "zero defect" message from the analyzer, we had to wait for two days more for the Unreal Engine team to integrate our final Pull Request. During this time, we continually updated our version of the code base from the Epic's repository, and analyzing the new code.

We could see the analyzer detect bugs in new code during those two days. Those bugs, we also fixed. This is a great example of how useful regular static analysis checks are.

In fact, the tip of the "number of warnings" graph now looked like this:


Attached Image: image8.png
Figure 5. A schematic graph representing the growth of the warning number after it was cut to 0.


Now let's see what we managed to find during those last two days, when analyzing fresh updates of the project code.

Day one

Message one: V560 A part of conditional expression is always true: FBasicToken::TOKEN_Guid. k2node_mathexpression.cpp 235

virtual FString ToString() const override
{
  if (Token.TokenType == FBasicToken::TOKEN_Identifier ||
      FBasicToken::TOKEN_Guid) //<==
  {
    ....
  }
  else if (Token.TokenType == FBasicToken::TOKEN_Const)
  {
    ....
}

The programmer forgot to write Token.TokenType ==. It will cause the condition to always be true since the named constant FBasicToken::TOKEN_Guid is not equal to 0.

Message two: V611 The memory was allocated using 'new T[]' operator but was released using the 'delete' operator. Consider inspecting this code. It's probably better to use 'delete [] CompressedDataRaw;'. crashupload.cpp 222

void FCrashUpload::CompressAndSendData()
{
  ....
  uint8* CompressedDataRaw = new uint8[BufferSize];         //<==

  int32 CompressedSize = BufferSize;
  int32 UncompressedSize = UncompressedData.Num();
  ....
  // Copy compressed data into the array.
  TArray<uint8> CompressedData;
  CompressedData.Append( CompressedDataRaw, CompressedSize );
  delete CompressedDataRaw;                                 //<==
  CompressedDataRaw = nullptr;
  ....
}

This bug doesn't always show up in practice as we are dealing with allocation of an array of items of the char type. But it is still a bug that can cause undefined behavior and must be fixed.

Day two

Message one: V521 Such expressions using the ',' operator are dangerous. Make sure the expression is correct. unrealaudiodevicewasapi.cpp 128

static void GetArrayOfSpeakers(....)
{
  Speakers.Reset();
  uint32 ChanCount = 0;
  // Build a flag field of the speaker outputs of this device
  for (uint32 SpeakerTypeIndex = 0;
       SpeakerTypeIndex < ESpeaker::SPEAKER_TYPE_COUNT,    //<==
       ChanCount < NumChannels; ++SpeakerTypeIndex)
  {
    ....
  }

  check(ChanCount == NumChannels);
}

A nice, fat bug.

The comma operator ',' is used to execute the two expressions to the either side of it in the left-to-right order and get the value of the right operand.

As a result, the loop termination condition is represented by the following check only: ChanCount < NumChannels.

The fixed condition:

static void GetArrayOfSpeakers(....)
{
  Speakers.Reset();
  uint32 ChanCount = 0;
  // Build a flag field of the speaker outputs of this device
  for (uint32 SpeakerTypeIndex = 0;
       SpeakerTypeIndex < ESpeaker::SPEAKER_TYPE_COUNT &&
       ChanCount < NumChannels; ++SpeakerTypeIndex)
  {
    ....
  }
  check(ChanCount == NumChannels);
}

Message two. V543 It is odd that value '-1' is assigned to the variable 'Result' of HRESULT type. unrealaudiodevicewasapi.cpp 568

#define S_OK       ((HRESULT)0L)
#define S_FALSE    ((HRESULT)1L)

bool
FUnrealAudioWasapi::OpenDevice(uint32 DeviceIndex,
                               EStreamType::Type StreamType)
{
  check(WasapiInfo.DeviceEnumerator);

  IMMDevice* Device = nullptr;
  IMMDeviceCollection* DeviceList = nullptr;
  WAVEFORMATEX* DeviceFormat = nullptr;
  FDeviceInfo DeviceInfo;
  HRESULT Result = S_OK;                      //<==
  ....
  if (!GetDeviceInfo(DataFlow, DeviceIndex, DeviceInfo))
  {
    Result = -1;                              //<==
    goto Cleanup;
  }
  ....
}

HRESULT is a 32-bit value split into three different fields: error severity code, device code, and error code. To work with HRESULT, special constants are used such as S_OK, E_FAIL, E_ABORT, and so on. And to check HRESULT values, such macros as SUCCEEDED and FAILED are used.

Warning V543 is output only when the programmer attempts to write values -1, true, or false into a variable of the HRESULT type.

Writing the value "-1" is incorrect. If you want to report some unknown error, you should use the value 0x80004005L (Unspecified failure). This and other similar constants are defined in "WinError.h".

Wow, this was a lot of work!


It may make some programmers and managers feel sad to learn that they need over two weeks to integrate static analysis into their project. But you don't necessarily have to go this way. You just should understand that the Epic Games developers chose an ideal path, yet not the simplest and quickest one.

Yes, the ideal scenario is to get rid of all the bugs right away and then promptly address only new messages triggered by freshly written code. But you can also start benefiting from static analysis without having to spend time up front fixing the old code.

PVS-Studio actually offers a special "message marking" mechanism for this purpose. Below is a general description of this feature:

All the messages output by the analyzer are marked in a special database as inactive. After that, the user can see only those messages which refer to freshly written or modified code. That is, you can start benefiting from static analysis right away. And then, when you have time and mood, you can gradually work on messages for the old code.

For details on this subject, see the following sources: documentation, how to quickly integrate static analysis into your project.

"Have you reported the bugs to the authors?"


After publishing every new article about checking some project, people will ask: "Have you reported the bugs to the project authors?" And of course we always do! But this time, we've not only "reported the bugs to the authors" but fixed all those bugs ourselves. Everyone interested can benefit from the results themselves in the Unreal Engine repository on GitHub (after you've created an Epic Games account and linked your GitHub account)

Conclusion


We hope that developers using Unreal Engine will appreciate PVS-Studio's role in improving Unreal Engine's source codend we are looking forward to seeing many awesome new Unreal Engine-based projects!

Here are some final conclusions to draw from the results of our work:

  1. The Unreal Engine project's code is extremely high-quality. Don't mind the large number of warnings at the initial stage: it's a normal thing. Most of those warnings were eliminated through a variety of techniques and settings. The number of real bugs detected in the code is very small for such a large project.
  2. Fixing someone else's code you are not familiar with is usually very difficult. Most programmers probably have an instinctive understanding of this. We are just telling an old truth.
  3. The speed of "sorting out" analyzer warnings is not a linear one. It will gradually drop and you need to keep that in mind when estimating the time it will take you to finish the job.
  4. You can only get the best from static analysis when you use it regularly.

Thanks to everyone for reading this article. May your code stay bugless! Sincerely yours, developers of the PVS-Studio analyzer. It's a good time right now to download and try it on your project.