
Plywood: A New Cross-Platform Open Source C++ Framework - petercooper
https://preshing.com/20200526/a-new-cross-platform-open-source-cpp-framework/
======
petey283
> Most open source C++ projects are libraries that are meant to be integrated
> into other applications. Plywood is the opposite of that: It gives you a
> workspace into which source code and libraries can be integrated. A single
> Plywood workspace can contain several applications – a webserver, a game
> engine, a command-line tool. Plywood simplifies the task of building and
> sharing code between them.

I think this works as a good overview.

~~~
badsectoracula
Well, that is implied by the title: "Plywood: A New [...] Framework".
Frameworks are by definition about providing the core elements to build your
stuff on top of them[0].

[0]
[https://en.wikipedia.org/wiki/Software_framework](https://en.wikipedia.org/wiki/Software_framework)

~~~
craftinator
It has been my experience that most software posted on HN has little
description of what it does, and no description of why it exists. The parent
comment was highlighting the excellently concise mission statement written on
the first page. I wish every project would do as well.

~~~
arzel
Agreed. It seems that people love to just throw around “library” “language”
and “framework” now, but not know the differences.

------
eismcc
Library from authors Arc80 game engine. Author appears to significant game
engine experience:

I’ve worked in the game industry for 14 years. Until 2015, I worked as a
Technical Architect at Ubisoft Montreal, on franchises such as Rainbow Six,
Child of Light and Assassin’s Creed. Before that, I spent a few years
developing desktop graphics software at Corel.

------
chrisseaton
Framework... for what? Turns out it's a framework for writing games, graphics,
sound, that kind of thing.

~~~
Zolomon
From the article: "Please note that Plywood, by itself, is not a game engine!
It’s a framework for building all kinds of software using C++."

~~~
chrisseaton
It seems pretty clearly focused on writing games and similar doesn’t it? Given
those are all the examples.

~~~
kroltan
> Given those are all the examples

[https://github.com/arc80/plywood/tree/master/repos/plywood/s...](https://github.com/arc80/plywood/tree/master/repos/plywood/src/apps)

A video renderer, audio synthesis, parsing, and web server. Linked right from
the article. The first is even the first demo in the article.

------
huxingyi
This framework has the potential to become another Qt if UI is been added. The
coding style and document[0] are solid and similar with Qt[1]. Giving the Qt
is heading in an unpopular way[2], I am looking forward to this framework.

[0]
[https://plywood.arc80.com/docs/modules/runtime/api/string/St...](https://plywood.arc80.com/docs/modules/runtime/api/string/String)
[1] [https://doc.qt.io/qt-5/qstring.html](https://doc.qt.io/qt-5/qstring.html)
[2] [https://www.qt.io/blog/qt-offering-
changes-2020](https://www.qt.io/blog/qt-offering-changes-2020)

------
hobo_mark
I see often, including in this case, that GitHub contains only a squashed
version of the development history. Assuming that the developer keeps working
on top of the original branch with full history, is there a way to keep a
squashed and a not-squashed branch in sync automatically?

~~~
bluejekyll
When you say “squashed” vs “not-squashed”, are you referring to the “squash”
merge feature in Github?

If so, that turns a PR branch into a single commit onto the target branch
(master). Unless the old branches are kept around, the unsquashed commits
won’t be available.

~~~
hobo_mark
I'm referring to the squash feature of git rebase. The developer collapsed
years of commits into one before pushing to GitHub, I am wondering if there is
a way to keep working on top of the original history privately, and pushing to
the "clean" history on GitHub, without having to cherry-pick all new commits
for GitHub by hand.

~~~
mook
git replace¹ should be able to do it; otherwise, grafts² work too.

¹ [https://git-scm.com/docs/git-replace](https://git-scm.com/docs/git-replace)
²
[https://git.wiki.kernel.org/index.php/GraftPoint](https://git.wiki.kernel.org/index.php/GraftPoint)

~~~
hobo_mark
That is it! Fantastic, thanks!

[https://git-scm.com/book/en/v2/Git-Tools-Replace](https://git-
scm.com/book/en/v2/Git-Tools-Replace) gives the exact example of what I had in
mind.

------
anarchyrucks
Title needs an edit to clarify what kind of framework this is.

~~~
choeger
from the examples, I would say, the type that includes the kitchen sink.

~~~
alharith
But my kitchen sink just has dishes in it.

------
nightowl_games
I usually wouldn't care about yet another c++ game framework, but this
author's prototypes are so impressive and artistic that it makes me believe
he's doing something more than just playing around with technology.

------
morio
Browsing over the code I'd say it's solid and seems to have been used in
production. Just about the right amount of abstraction for practical use.

Some parts could be replaced by standard C++ library functionality by now. My
biggest issue so far: Use of bare pointers, especially in parser code. This
should not appear in new code written in 2020. I'm kind of baffled by that as
he seems to use stuff like std::move.

This is no replacement for either Unreal or Unity for sure, it's pretty basic
in functionality.

~~~
phaedrus
I think "no bare pointers, ever" is overly dogmatic. Raw pointers still have a
place, especially in game programming. The standard smart pointer types cover
many common situations, but do not cover all situations (nor do I think were
intended to).

~~~
h0l0cube
> The standard smart pointer types cover many common situations, but do not
> cover all situations (nor do I think were intended to).

They also add a level of indirection, which can manifest as cache misses. If
you're iterating through large numbers of objects, memory locality can be a
huge gain.

~~~
uluyol
This isn't a question of smart vs raw pointers, it's a question of pointer vs
value. A std::vector<T> is considered good code in modern C++ and should often
be preferred over a std::vector<std::unique_ptr<T>>.

~~~
h0l0cube
> it's a question of pointer vs value

Yeah, the indirection I was referring to generalises to this.

Edit:

You might be saying that STL data structures could have been used by the
author to alleviate the memory locality issue, but as noted in another thread,
it's common to use custom STL implementations or use entirely custom memory
management in performance critical applications, to reduce on memory
allocation frequency, memory usage and/or fragmentation. Or maybe the author
is just more 133t than thou.

------
rambojazz
> I’m releasing part of that game engine as an open source framework

I'm curious what this means exactly. Does it mean that requires the non-open
source part to function? Or is it a standalone part of the non-open source
engine that can be used by other projects (like a library)?

~~~
preshing
It's the latter: A standalone framework that can be used by other projects.
It's like a library (or suite of libraries) with separate modules for platform
abstraction, containers, JSON, etc. A bit more "batteries included" than
vanilla C++, and you only link with what you use. These modules are organized
into a workspace that helps set up new build pipelines, to compensate for the
lack of a standard build system in C++.

------
billfruit
Does it include UI components? Or is it designed to be used with third-party
UI components like QT?

~~~
wtracy
No.

It looks to be focused on projects that do not use any UI toolkit at all. CLI
applications and games, basically.

------
BruceEel
> Runtime reflection is, in my opinion, the biggest missing feature in
> standard C++.

Opinions?

~~~
jfkebwjsbx
What is definitely missing is compile time reflection. I don’t think many devs
care about the runtime one.

~~~
pjmlp
We can anyway generate the runtime one at compile time, that is how many Java
and .NET compiler plugins and annotation processors work.

~~~
preshing
This might come true some day, but it seems not in C++20 and in recent static
reflection proposals there was no way to distinguish reflected from non-
reflected members in the same class.

~~~
pjmlp
Yep that is post C++20.

I am hardly a C++ user nowadays, but such stuff interests me, because the
Windows Development team managed to push C++/WinRT as replacement for C++/CX,
but are declining any improvement to Visual Studio support (at least
comparable to C++/CX) until ISO C++ gets similar capabilities to C++/CX.

So given that some C++ usage is required depending on which APIs you want to
access from .NET, you can imagine there are many WinDevs not very happy with
the downgrade in tooling support.

Back to your point, in what cases might such distinction be relevant?

~~~
preshing
One example is in:
[https://github.com/arc80/plywood/blob/master/repos/plywood/s...](https://github.com/arc80/plywood/blob/master/repos/plywood/src/web/cook-
docs/ply-web-cook-docs/WebCookerIndex.h#L56)

Here, only one data member is meant to be serialized. The others members are
there to accelerate lookups into the first data member. (Full disclosure: that
structure isn't actually serialized yet, but the Arc80 Engine which uses
Plywood has similar examples.)

~~~
BruceEel
Interesting! Could sufficiently enhanced compile-time reflection (say we do
get supercharged CT reflection in C++2b*) be used to implement fully
transparent&automatic versioning in serialization frameworks? I know very
little on this subject but I think boost serialization, though capable of
handling multiple versions of a given class, requires manually 'tagging'
source files as being say, version 1,2,etc.

------
FlyingSnake
Will it replace the now defunct Djinni framework from Dropbox?

~~~
wtracy
Plywood is C++ only, so no.

------
andi999
It is not just open source, it is under MIT license... so now I am interested

~~~
andi999
Ok, I am curious about the downvotes What is wrong with my comment. Open
source can mean a lot (e.g. gpl) some of which cannot be used for production
(in my and some other ppls environment). This one can, which is great. Reading
on mobile it took 2 minutes to find out. So I thought i spare other ppl the
hassle to find out themselves. And yes I believe licensing matter, and open
source is too general a term.

~~~
jonnypotty
You seemed to be suggesting the open source might have some not good things
about it. You can't do that ;)

