This presentation explores the process of bringing FEZ to the Sony PlayStation platforms. Beginning with the conversion from the existing C# codebase to C++ native code, the talk will then cover memory management without a garbage collector, tuned optimization techniques for each platform, and will finish with special features added to PlayStation builds
Will talk about kotlin the language and new concepts introduced in the language including functional programming.
And how to use your springframework knowlege to write more concise and elegant backend systems.
We will demo a backend written in spring boot and kotlin and will see how it is so easy to interoperate between java and kotlin code.
Kotlin provides a lot of features out of the box even though those are not supported by JVM. Have you ever wondered how Kotlin does it? If yes, then this presentation is for you.
Kotlin compiler tweaks our code in such a way that, JVM can execute it. this deck goes through lots of Kotlin features and explains how it looks at runtime for JVM compatibility. Of course we are not going to look into bytecode, instead we will look into the decompiled version of the bytecode generated by Kotlin compiler.
NOTE: This was presented at DevFest Kolkata 2019.
Kotlin Bytecode Generation and Runtime Performanceintelliyole
In this talk, we'll dive into the details of how various language features supported by Kotlin are translated to Java bytecode. We'll use the JMH microbenchmarking tool to study the relative performance of various constructs and to understand how we can ensure top performance of the Kotlin code that we write.
This full day course will give you a hands-on, deep dive into React Native. In this course, you will learn how to build cross-platform mobile applications from scratch using Facebook's React Native.
Functions being first-class citizens in JavaScript offers developers a tremendous amount power and
flexibilty. However, what good is all this power if you don't know how to harness it?
This talk will provide a thorough examination of JavaScript functions. Topics
that will be covered in this talk are:
* Functions are objects
* Execution Context and the Scope Chain
* Closures
* Modifying Context
* The Various Forms of Functions.
Attendees will leave this talk understanding the power of JavaScript functions and the knowledge to apply new
techiques that will make their JavaScript cleaner, leaner and more maintainable.
"JavaScript in 2016" by Eduard Tomàs
Some years ago in a far far away company, Brendan Eich created JavaScript. A lot of things happened since then. Times changed, the web grown, the language itself was updated, and we as a developers need to adapt too. Last year the last standard of the language arose: ECMAScript 2015 is here, and has some new and interesting features. In this talk we will show the most relevant ones, and also we will introduce some interesting patterns that you can use in JavaScript: you'll learn how to master the language and made JavaScript your best ally to conquest the world!
From object oriented to functional domain modelingCodemotion
"From object oriented to functional domain modeling" by Mario Fusco
Malgrado l'introduzione delle lambda, la gran parte degli sviluppatori Java non è ancora abituata agli idiomi della programmazione funzionale e quindi non è pronta a sfruttare a pieno le potenzialità di Java 8. In particolare non è ancora comune vedere dati e funzioni usate insieme quando si modella un dominio di business. Lo scopo del talk è mostrare come alcuni principi di programmazione funzionale quali l'impiego di oggetti e strutture dati immutabili, l'uso di funzioni senza side-effect e il loro reuso mediante composizione, possono anche essere validi strumenti di domain modelling.
Will talk about kotlin the language and new concepts introduced in the language including functional programming.
And how to use your springframework knowlege to write more concise and elegant backend systems.
We will demo a backend written in spring boot and kotlin and will see how it is so easy to interoperate between java and kotlin code.
Kotlin provides a lot of features out of the box even though those are not supported by JVM. Have you ever wondered how Kotlin does it? If yes, then this presentation is for you.
Kotlin compiler tweaks our code in such a way that, JVM can execute it. this deck goes through lots of Kotlin features and explains how it looks at runtime for JVM compatibility. Of course we are not going to look into bytecode, instead we will look into the decompiled version of the bytecode generated by Kotlin compiler.
NOTE: This was presented at DevFest Kolkata 2019.
Kotlin Bytecode Generation and Runtime Performanceintelliyole
In this talk, we'll dive into the details of how various language features supported by Kotlin are translated to Java bytecode. We'll use the JMH microbenchmarking tool to study the relative performance of various constructs and to understand how we can ensure top performance of the Kotlin code that we write.
This full day course will give you a hands-on, deep dive into React Native. In this course, you will learn how to build cross-platform mobile applications from scratch using Facebook's React Native.
Functions being first-class citizens in JavaScript offers developers a tremendous amount power and
flexibilty. However, what good is all this power if you don't know how to harness it?
This talk will provide a thorough examination of JavaScript functions. Topics
that will be covered in this talk are:
* Functions are objects
* Execution Context and the Scope Chain
* Closures
* Modifying Context
* The Various Forms of Functions.
Attendees will leave this talk understanding the power of JavaScript functions and the knowledge to apply new
techiques that will make their JavaScript cleaner, leaner and more maintainable.
"JavaScript in 2016" by Eduard Tomàs
Some years ago in a far far away company, Brendan Eich created JavaScript. A lot of things happened since then. Times changed, the web grown, the language itself was updated, and we as a developers need to adapt too. Last year the last standard of the language arose: ECMAScript 2015 is here, and has some new and interesting features. In this talk we will show the most relevant ones, and also we will introduce some interesting patterns that you can use in JavaScript: you'll learn how to master the language and made JavaScript your best ally to conquest the world!
From object oriented to functional domain modelingCodemotion
"From object oriented to functional domain modeling" by Mario Fusco
Malgrado l'introduzione delle lambda, la gran parte degli sviluppatori Java non è ancora abituata agli idiomi della programmazione funzionale e quindi non è pronta a sfruttare a pieno le potenzialità di Java 8. In particolare non è ancora comune vedere dati e funzioni usate insieme quando si modella un dominio di business. Lo scopo del talk è mostrare come alcuni principi di programmazione funzionale quali l'impiego di oggetti e strutture dati immutabili, l'uso di funzioni senza side-effect e il loro reuso mediante composizione, possono anche essere validi strumenti di domain modelling.
Currying and Partial Function Application (PFA)Dhaval Dalal
We look at Currying and Partial Function Application (PFA) in Functional Programming. Languages like Clojure don't have currying, but PFA, where has Haskell currying and not PFA, whereas Scala has both, Groovy wants you to call methods like curry() and rcurry(). In OO paradigm, we use DI (dependency Injection) and we will see how this is automatically subsumed using Currying and PFA.
Being functional in PHP (PHPDay Italy 2016)David de Boer
Functional programming, though far from new, has gained much traction recently. Functional programming characteristics have started to appear in the PHP world, too. Microframeworks such as Silex and Slim, middleware architectures such as Stack and even standards such as PSR-7 rely on concepts such as lambdas, referential transparency and immutability, all of which come from functional programming. I’ll give you a crash course in Erlang, a pragmatic functional language to make you feel familiar with the functional paradigm. By comparing code samples between Erlang and PHP, you’ll find out how you can employ functional programming in your PHP applications where appropriate. You’ll see that functional programming is nothing to be scared of. On the contrary, understanding its concepts broadens your programming horizon and provides you with valuable solutions to your problems.
Wiktor Toporek: JavaScript, będąc dynamicznie typowanym językiem, potrafi być bardzo przyjazny… niestety również bugom. Dobry przyjaciel powinien nam pozwalać na wiele, lecz nie powinien nam pozwalać na zrobienie sobie krzywdy. Podczas prezentacji przekonamy się, iż statyczne typowanie może stać się naszym dobrym przyjacielem w walce z dużym szeregiem błędów – ale to, w jakim stopniu nam pomoże, zależy od tego, jaki wkład będziemy mieli w tę relację.
"Delegates, Delegates everywhere" Владимир МироновAvitoTech
Поговорим про delegated properties и все, что с ними связано. Узнаем, зачем они нужны, какие delegated properties предоставляет стандартная библиотека, напишем несколько своих и рассмотрим более сложные примеры, которые могут быть полезны в мире android-разработки. Мы также посмотрим, во что delegated properties превращаются во время компиляции, и какие сюрпризы нас могут ожидать.
O quanto você está satisfeito com o código que produz? Mais ainda: o quanto você está satisfeito como profissional? Na busca pela melhoria de nossas aplicações, caímos num grande desafio: melhorar a nós mesmos!
Numa conversa franca e descontraída, Samuel e Victor tentarão apresentar idéias sobre como você pode melhorar seu próprio trabalho e sentir orgulho do que faz.
Developing High Performance Websites and Modern Apps with JavaScript and HTML5Doris Chen
Creating high performance sites and apps is crucial for every developer. In this session, we will explore the best practices and performance tricks, including startup time, UI responsiveness, and Memory efficiency to make your apps running faster and fluid. Come learn the tips, tricks, and tools for maximizing the performance of your sites and apps with JavaScript and HTML5.
Developer Experience i TypeScript. Najbardziej ikoniczne duoThe Software House
Wiktor Toporek: TypeScript bez wątpienia jest obecnie pewnym standardem wśród obecnych rozwiązań powstałych w JavaScripcie. Ale czy poza byciem dodatkiem który uzupełnia odrobinę dokumentacje i deklaruje kontrakt jakiego typu parametry przyjmują i zwracają np. funkcje jakiejś biblioteki, można wycisnąć z niego coś więcej? Podczas prezentacji wykorzystamy TypeScript do granic możliwości, używając zaawansowanych technik które sprawiają że interfejs naszego API będzie sam kierował używających go developerów na drogę poprawnego użycia, które jest zgodne z naszymi (twórców) założeniami, poprawiając tym samym ich doświadczenia.
Wiktor Toporek: Pomimo tego że JavaScript mocno ewoluował na przestrzeni ostatnich lat, zakorzeniona w nim jego asynchroniczna natura wciąż może sprawiać problem programistom i to zarówno początkującym jak i tym zaawansowanym. W prezentacji przyjrzymy się jednemu z bohaterów programowania asynchronicznego jakim jest Promise, przeanalizujemy niektóre z pułapek oraz zastanowimy się również czy w pełni wykorzystujemy jego potencjał.
Kotlin is something more than just tool that help you remove boilerplate from you code. It brings much more than just lamdas and handy syntax to your Java or Android project
An introduction to Kotlin for advanced Android beginners, covering command-line compilation of Kotlin files, conditional logic, val/var, basic functions, higher order functions, recursion.
How to add an interactive shell (remote, too) to a C++ application by using my open-source C++14 library:
https://github.com/daniele77/cli
In the slide deck you can learn how to use it, how does it work, and find some thoughts about C++ design and patterns used by the library.
Currying and Partial Function Application (PFA)Dhaval Dalal
We look at Currying and Partial Function Application (PFA) in Functional Programming. Languages like Clojure don't have currying, but PFA, where has Haskell currying and not PFA, whereas Scala has both, Groovy wants you to call methods like curry() and rcurry(). In OO paradigm, we use DI (dependency Injection) and we will see how this is automatically subsumed using Currying and PFA.
Being functional in PHP (PHPDay Italy 2016)David de Boer
Functional programming, though far from new, has gained much traction recently. Functional programming characteristics have started to appear in the PHP world, too. Microframeworks such as Silex and Slim, middleware architectures such as Stack and even standards such as PSR-7 rely on concepts such as lambdas, referential transparency and immutability, all of which come from functional programming. I’ll give you a crash course in Erlang, a pragmatic functional language to make you feel familiar with the functional paradigm. By comparing code samples between Erlang and PHP, you’ll find out how you can employ functional programming in your PHP applications where appropriate. You’ll see that functional programming is nothing to be scared of. On the contrary, understanding its concepts broadens your programming horizon and provides you with valuable solutions to your problems.
Wiktor Toporek: JavaScript, będąc dynamicznie typowanym językiem, potrafi być bardzo przyjazny… niestety również bugom. Dobry przyjaciel powinien nam pozwalać na wiele, lecz nie powinien nam pozwalać na zrobienie sobie krzywdy. Podczas prezentacji przekonamy się, iż statyczne typowanie może stać się naszym dobrym przyjacielem w walce z dużym szeregiem błędów – ale to, w jakim stopniu nam pomoże, zależy od tego, jaki wkład będziemy mieli w tę relację.
"Delegates, Delegates everywhere" Владимир МироновAvitoTech
Поговорим про delegated properties и все, что с ними связано. Узнаем, зачем они нужны, какие delegated properties предоставляет стандартная библиотека, напишем несколько своих и рассмотрим более сложные примеры, которые могут быть полезны в мире android-разработки. Мы также посмотрим, во что delegated properties превращаются во время компиляции, и какие сюрпризы нас могут ожидать.
O quanto você está satisfeito com o código que produz? Mais ainda: o quanto você está satisfeito como profissional? Na busca pela melhoria de nossas aplicações, caímos num grande desafio: melhorar a nós mesmos!
Numa conversa franca e descontraída, Samuel e Victor tentarão apresentar idéias sobre como você pode melhorar seu próprio trabalho e sentir orgulho do que faz.
Developing High Performance Websites and Modern Apps with JavaScript and HTML5Doris Chen
Creating high performance sites and apps is crucial for every developer. In this session, we will explore the best practices and performance tricks, including startup time, UI responsiveness, and Memory efficiency to make your apps running faster and fluid. Come learn the tips, tricks, and tools for maximizing the performance of your sites and apps with JavaScript and HTML5.
Developer Experience i TypeScript. Najbardziej ikoniczne duoThe Software House
Wiktor Toporek: TypeScript bez wątpienia jest obecnie pewnym standardem wśród obecnych rozwiązań powstałych w JavaScripcie. Ale czy poza byciem dodatkiem który uzupełnia odrobinę dokumentacje i deklaruje kontrakt jakiego typu parametry przyjmują i zwracają np. funkcje jakiejś biblioteki, można wycisnąć z niego coś więcej? Podczas prezentacji wykorzystamy TypeScript do granic możliwości, używając zaawansowanych technik które sprawiają że interfejs naszego API będzie sam kierował używających go developerów na drogę poprawnego użycia, które jest zgodne z naszymi (twórców) założeniami, poprawiając tym samym ich doświadczenia.
Wiktor Toporek: Pomimo tego że JavaScript mocno ewoluował na przestrzeni ostatnich lat, zakorzeniona w nim jego asynchroniczna natura wciąż może sprawiać problem programistom i to zarówno początkującym jak i tym zaawansowanym. W prezentacji przyjrzymy się jednemu z bohaterów programowania asynchronicznego jakim jest Promise, przeanalizujemy niektóre z pułapek oraz zastanowimy się również czy w pełni wykorzystujemy jego potencjał.
Kotlin is something more than just tool that help you remove boilerplate from you code. It brings much more than just lamdas and handy syntax to your Java or Android project
An introduction to Kotlin for advanced Android beginners, covering command-line compilation of Kotlin files, conditional logic, val/var, basic functions, higher order functions, recursion.
How to add an interactive shell (remote, too) to a C++ application by using my open-source C++14 library:
https://github.com/daniele77/cli
In the slide deck you can learn how to use it, how does it work, and find some thoughts about C++ design and patterns used by the library.
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...GeeksLab Odessa
SubScript - это расширение языка Scala, добавляющее поддержку конструкций и синтаксиса аглебры общающихся процессов (Algebra of Communicating Processes, ACP). SubScript является перспективным расширением, применимым как для разработки высоконагруженных параллельных систем, так и для простых персональных приложений.
- What's new in .NET Platform
- What's new in Visual Studio 2017
- What's new in C# 7.0: out variables, Tuples, Pattern Maching, ref locals and returns, Local Functions, More expression-bodied members, throw Expressions, Generalized async return types, Numeric literal syntax improvements
Systematic Generation Data and Types in C++Sumant Tambe
This presentation will discuss two classic techniques from the functional domain — composable data generators and property-based testing — implemented in C++14 for testing a generic serialization and deserialization library. We will look at a systematic technique of constructing data generators from a mere random number generator and random type generation using compile-time meta-programming. Along the way, we will discuss monoids, functors, and monads as we encounter them.
Python's "batteries included" philosophy means that it comes with an astonishing amount of great stuff. On top of that, there's a vibrant world of third-party libraries that help make Python even more wonderful. We'll go on a breezy, example-filled tour through some of my favorites, from treasures in the standard library to great third-party packages that I don't think I could live without, and we'll touch on some of the fuzzier aspects of the Python culture that make it such a joy to be part of.
Think Async: Asynchronous Patterns in NodeJSAdam L Barrett
JavaScript is single threaded, so understanding the async patterns available in the language is critical to creating maintainable NodeJS applications with good performance. In order to master “thinking in async”, we’ll explore the async patterns available in node and JavaScript including standard callbacks, promises, thunks/tasks, the new async/await, the upcoming asynchronous iteration features, streams, CSP and ES Observables.
Similar to The Challenge of Bringing FEZ to PlayStation Platforms (20)
Acorn Recovery: Restore IT infra within minutesIP ServerOne
Introducing Acorn Recovery as a Service, a simple, fast, and secure managed disaster recovery (DRaaS) by IP ServerOne. A DR solution that helps restore your IT infra within minutes.
This presentation, created by Syed Faiz ul Hassan, explores the profound influence of media on public perception and behavior. It delves into the evolution of media from oral traditions to modern digital and social media platforms. Key topics include the role of media in information propagation, socialization, crisis awareness, globalization, and education. The presentation also examines media influence through agenda setting, propaganda, and manipulative techniques used by advertisers and marketers. Furthermore, it highlights the impact of surveillance enabled by media technologies on personal behavior and preferences. Through this comprehensive overview, the presentation aims to shed light on how media shapes collective consciousness and public opinion.
0x01 - Newton's Third Law: Static vs. Dynamic AbusersOWASP Beja
f you offer a service on the web, odds are that someone will abuse it. Be it an API, a SaaS, a PaaS, or even a static website, someone somewhere will try to figure out a way to use it to their own needs. In this talk we'll compare measures that are effective against static attackers and how to battle a dynamic attacker who adapts to your counter-measures.
About the Speaker
===============
Diogo Sousa, Engineering Manager @ Canonical
An opinionated individual with an interest in cryptography and its intersection with secure software development.
This presentation by Morris Kleiner (University of Minnesota), was made during the discussion “Competition and Regulation in Professions and Occupations” held at the Working Party No. 2 on Competition and Regulation on 10 June 2024. More papers and presentations on the topic can be found out at oe.cd/crps.
This presentation was uploaded with the author’s consent.
Presentatie 8. Joost van der Linde & Daniel Anderton - Eliq 28 mei 2024
The Challenge of Bringing FEZ to PlayStation Platforms
1. The Challenge of
Bringing FEZ to
PlayStation Platforms
Miguel Angel Horna
Lead Programmer at BlitWorks
2.
3.
4. FEZ
• Released in 2012
• Developed by Polytron Corporation
• In development for over 5 years
• Just 2 people
• Game design/Art: Phil Fish
• Game programmer: Renaud Bédard
5. FEZ
• C# Code
• Xbox 360 version uses XNA
• PC Version uses MonoGame (OpenGL)
• No C# runtime for PlayStation platforms
6. The main decision
• Two options:
• Port C# to PlayStation platforms
• Straightforward (almost) game code port
• No JIT support. Doubts on performance
• OpenGL to native libraries
• Rewrite C# code to C++
• “Native” performance. Better optimizations
• Lots of work. Over 500 classes
7. The main decision
• We chose game code rewrite
• We knew it was going to be hard
• And long… It took almost 1 year to
complete
• Manual rewrite was out of question
• Tried some automatic conversion tools
8. The main decision
• C# to C++ Converter by Tangible
Software
• It made the first (rough) conversion
• Every file had to be completed, edited
and reviewed
• Blind conversion. Much time passed with
no visible progress (not even compiling)
9. The main decision
C#
public IEnumerableTrile> ActorTriles(ActorType type)
{
return TrileSet == null ? Enumerable.Repeat<Trile>(null, 1) : TrileSet.Triles.Values.Where(x =>
x.ActorSettings.Type == type);
}
Auto converted
std::shared_ptr<IEnumerable<Trile*>> LevelManager::ActorTriles(ActorType type)
{
//C# TO C++ CONVERTER TODO TASK: Lambda expressions and anonymous methods are not converted to native
C++:
return get_TrileSet() == nullptr ? Enumerable::Repeat<Trile*>(nullptr, 1) : get_TrileSet()-
>get_Triles().Values->Where(x => x.ActorSettings->Type == type);
}
10. The main decision
Final code
std::shared_ptr<List<std::shared_ptr<Trile>>> LevelManager::ActorTriles(ActorType type)
{
if(get_TrileSet()==nullptr)
{
std::shared_ptr<List<std::shared_ptr<Trile>>> result = std::make_shared<List<std::shared_ptr<Trile>>>();
result->push_back(nullptr);
return result;
}
else
{
return Where(get_TrileSet()->get_Triles(),[=] (const std::shared_ptr<Trile> &t) { return t->get_ActorSettings()-
>get_Type() == type; } );
}
}
11. Conversion
• Properties
• Generate get_, set_ accessors in classes
• Converter generated proper methods
• .. But sometimes didn’t use them
• Needed long rewrites
• Beware of returning temporary references,
some compilers don’t detect that!
12. Conversion
• Be careful with operation order with -= and
too “automated” rewrite
C#
PlayerManager.Velocity -= destination - instance.Center;
C++ wrong
get_PlayerManager()->set_Velocity(get_PlayerManager()->get_Velocity() - destination - instance-
>get_Center());
C++ correct
get_PlayerManager()->set_Velocity(get_PlayerManager()->get_Velocity() - (destination - instance-
>get_Center()));
13. Conversion
• Extension methods
• Extension methods were widely used ...
• … on Enums
• No way to convert it to C++
• Just create normal functions passing the
enum as parameter
C#
var bitangent = orientation.GetBitangent().AsAxis().GetMask();
C++
auto bitangent = FezMath::GetMask(FezMath::AsAxis(FezMath::GetBitangent(orientation)));
14. Conversion
• Lambda expressions & delegates
• Game code heavily used lambda expressions
for events, list queries ...
• Delegates were used a lot too (threads,
scheduled operations, scripting…)
• They don’t have direct conversion to C++ …
• … but they have for C++11
• Lambdas and std::function<>
18. Garbage Collector
• FEZ had random stuttering due to the GC
kicking in
• Deterministic object destruction preferred
• Reference counting
• C++11’s std::shared_ptr<>
• Caused its own kind of bugs ☹
19. Garbage Collector
• Circular references
• Try to access shared_from_this() in
constructors
• Capturing this on lambdas caused
problems (no reference increment)
22. Reflection
• Game scripting used reflection to:
• Trap scripting objects events by name
• Invoke methods by name
• We implemented method, event, triggers…
descriptors for scripting objects
• Generated dynamic methods by using IL Emit
• No dynamic code generation
25. Reflection
• Service dependencies were resolved using
reflection
[ServiceDependency]
public ISoundManager SoundManager { protected get; set; }
[ServiceDependency]
public IContentManagerProvider CMProvider { protected get; set; }
• In C++ there are no attributes, and also we can’t
get the property names
• This was not possible to resolve the same way
26. Reflection
• We created a base class with all the service set_
methods virtual, and doing nothing
• The dependency resolver iterated all registered
services
• A macro called for each combination of property
name and type, tried to dynamic_cast the service
to the type, and if so, called the set_ method
• All components derived from this class, so the
overridden set_ functions actually set the value
28. .NET Framework
• Replacement for some .NET Framework
libraries:
• Threads & Synchronization
• Almost direct map to native APIs
• lock() blocks converted to mutex.Lock() and
Unlock()
• Files
• Also easy to map, and BinaryReader/Writer gave us
the endian safe file access.
29. .NET Framework
• String (Unicode)
• String class derived from std::wstring, but with C#
like methods (SubString(),Replace(),Split()..)
• Collections (Dictionary, List, Array)
• Converter automatically changed them to STL
containers (unordered_map,list,vector)
• Nullable types
• Implemented our own Nullable<T> class
30. .NET Framework
• Events
• Internally containing a std::list<std::function>
• Adding a method to an event requires a lambda
• C# CameraManager.ViewpointChanged += UpdateRotation;
• C++ get_CameraManager()->ViewpointChanged += [=] () {UpdateRotation();};
• Initially same interface than C# (+=, -=)
• No way to compare lambdas to remove, so we had
to change interface and return ID
• UpdateRotationDelegateId=get_CameraManager()->ViewpointChanged.Add([=] ()
{UpdateRotation();});
• get_CameraManager()->ViewpointChanged.Remove(UpdateRotationDelegateId);
31. .NET Framework
• LINQ was widely used to search
• We implemented LINQ-like operations for
STL list,vector, map:
• Where, Any, All, Union, Exists...
• Usage was a bit awkward sometimes
C# if(!tracks.Any(y => y.Name == x.Track.Name))
C++ if(!Any<std::shared_ptr<AmbienceTrack>>(tracks,[=] (const std::shared_ptr<AmbienceTrack>
&y) -> bool { return y->get_Name()==(*x)->Track->get_Name(); }))
32. Bugfixing
• Original game already had bugs
• C# to C++ introduced new ones
• Memory leaks (circular references)
• Mixing normal and reference counted
pointers to same object. Use after delete.
• Returning reference to temporary object in
get_ properties access:
const Vector3 &TrixelEmplacement::get_Position() const
{
return Vector3(X, Y, Z);
}
33. Bugfixing
• Mistakes during manual conversion
• Missing parenthesis on -= operations
• Errors converting lambda expressions in
LINQ operations
• Uninitialized member variables
• C++11 compiler bugs !!
34. Optimization
• OK, now it worked… but slowly
• CPU intensive code
• Lots of geometry with inefficient
instancing
• Complex shaders
35. Optimization (CPU)
• std::shared_ptr is thread safe. We
created a lightweight (unsafe) fast_ptr
• Move some CPU intensive operations to
another thread
• Erasing std::vector elements is slow:
• convert to std::list
• replace removed element with last one and
resize()
36. MonoGame graphics
• For PC, OpenGL based.
• Two options:
• Minimal OpenGL library for each platform
• Custom MonoGame target for each platform
• We anticipated GPU performance
problems
• Chose custom MonoGame targets
37. MonoGame graphics
• Allows platform-specific features
• Fine tuning for platform
• Assets optimized per platform (swizzled,
tiled…)
• Shaders rewritten and optimized for each
platform
38. Optimization (GPU)
• FEZ doesn’t look like a GPU intensive game.
• That’s wrong
• “Trile” (tri-dimensional tile) made of
16x16x16 “trixels” (tri-dimensional pixel)
• Built sculpting a solid trile, removing trixels.
Generates a lot of geometry
• Two pass rendering
41. Optimization (GPU)
• Excessive geometry was choking vertex
shaders
• Only one (while moving) or two (while
rotating) trile faces visible most of the time
• Quick rejection of non-visible faces in CPU
(~⅚ of the total geometry)
• Proper instancing
• Huge speedup
42. Optimization (GPU)
• Complex effects were choking the pixel
shaders
• Simplified code paths
• Wrote specific “fast path” shaders to avoid
branching
• Moved calculations to vertex shader when
possible
• Most shaders unnecessarily used “discard”
44. New features
• Cross-save (additional slot)
• Transparent for the user if online
• No progress merge, just latest data
• Allows play offline, syncs when
online
• Stereoscopic 3D
• Based on existing red/blue mode
• Required extra tweaks