Live data from Hacker News

Show HN: Crown – A flexible game engine written from scratch in C++

github.com

161–170 of 179 posts

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#161
Yet another game engine written in an imperative language, seemingly with the focus on writing something in Orthodox C++ and not necessarily writing something to solve a problem. Just as the discussion on this post shows, the more interesting thing here is Orthodox C++, not yet another game engine which doesn't offer any featues that modern game engines offer.

If you're expecting people to see this as a useful product, please explain why it should be used instead of the existing game engines. Consider listing its features and comparing them, maybe in a table, to popular game engines. Deferred rendering? Multi-threaded rendering? Entity-component system? etc.

Right now, I can see it has a (nice looking) editor, "physics" (nothing's moving, so it's hard to tell), and "animation" (again, nothing's animating in the image). Alas, one needs to learn to use its entirely fresh standard library reimplementation, and likely its strict C++ subset, if one actually wants to be productive with it. Given apparently no active community, no sample (or actual) games written in it, and no paid support, I don't see how that would be feasible.

If you have no interest in actually making a competitive, novel, or useful (to others, compared to existing solutions) game engine, please just say that. In that case, I'd just say this is a neat side project: well done, but try to focus on building something with it to help sell/prove its features.

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#162

Earlier quoted context omitted.

I started with game engines well before I put this project on github in 2012.

Can you recommend any resources/books to learn game engine development? I would love to implement a mini one where I can rapidly prototype AR applications :).

You may just want to start by building your AR applications first. After a few of them, you'll have a better understanding of what common functionality is needed.

See also: https://geometrian.com/programming/tutorials/write-games-not...

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#163

While I find the "sane C++" approach pragmatic and practical all things considered, I'm firmly in the "time to use a better language if possible" camp. The problem with approaches requiring extra discipline is: it's an extra mental burden to bear while programming. Also, you'll always be limited by the fact that you're working in a less pure ecosystem and will likely end up using libraries written in "not very sane C…

Debatably, this exists. With GCC or Clang there are several command line flags that can help.

If you use the flag -Werror all warnings will be errors.

Then add -Wall which enables all unambiguously good warnings, which will stop a whole lot of things that skirt the type system, it will prevent silly rounding bugs and in general reduce the bug surface of your code.

Then if you enable "-pedantic" more errors are found, but not all are clearly improvements. I think most of them are good and I think most would agree that mandating the "override" keyword is good, but not all would agree with every signed to unsigned comparison warning.

Put together this add "-Werror -Wall -pedantic" or a "/w4" MSVC) to the command line, or more likely makefile/CMakeLists.

I personally advocate enabling all these and a similar set from msvc then adding a set of robust warning suppression macros to you code and suppress the warning that really make no sense to fix. This has prevented a ton of bugs in my code, it minimizes the amount of premature optimizations I see in code that tried to cast from one type to another by relying on some unspecified binary compatibility and in general makes writing C++ really enjoyable.

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#164

Earlier quoted context omitted.

Generally speaking many C++ game engines avoid the STL stuff and reimplement their own more predictable containers, often with custom allocation schemes. The engine at the last game company i worked at, for example, had its own containers and memory allocator and allowed you to define the allocation category and pool per allocator and per object class (so, e.g., dynamic strings would be isolated to their own pool to…

> Generally speaking many C++ game engines avoid the STL stuff and reimplement their own more predictable containers This seems a little like cargo cultism. I wonder if any of these shops regularly measure the performance of their custom containers and compare with the standard library on a modern optimizing compiler and make a reasoned judgment that it's still currently worth the trade-offs to stick with their own s…

> I wonder if any of these shops regularly measure the performance of their custom containers

Yes, while it wasn't often, we sometimes did benchmark tests to improve performance when bottlenecks were found, especially towards the game's release when we were focusing on optimizations. IIRC we did some minor changes in the dynamic array container and we rewrote the hashmap and hashset implementations. One of the programmers wrote a performance test comparing several algorithms both with synthetic and real data (from the case that created the bottleneck).

> compare with the standard library on a modern optimizing compiler and make a reasoned judgment that it's still currently worth the trade-offs to stick with their own stuff.

There are other reasons to use a custom container than just the pure performance of the container itself. One is using a different allocation scheme, as the example i gave in the grandparent post, another is to use a friendlier API (see `find` and friends) and add more features. An important one in our engine was support for the custom RTTI that was used for object serialization and the scripting language that also worked and exposed those directly - the container, the RTTI implementation and the scripting runtime had to have intimate knowledge about each other to work transparently (especially when the editor entered the picture, where you could create new entries, often objects but also sometimes structs or other data types, by editing the array directly in a property editor).

Of course not all engines do that and TBH most of the performance and memory related bits are more relevant to consoles than (desktop) PCs (the API friendliness and RTTI stuff are platform agnostic though :-P). At the previous gaming company i worked at, the engine used standard containers. Also AFAIK the engine used by the Two Worlds games also uses standard containers (based on some of their developers' comments).

Personally when i write C++ i implement my own containers not because of performance but simply because i dislike the STL API - for example i want to have "Find", "IndeOf", "Swap", etc methods in the container itself :-P. Sadly it seems that i'll also need to do the same if i decide to start working with D seriously since D's standard library seem to more or less copy the STL API style.

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#165
post #41
post #40

Earlier quoted context omitted.

Probably because exceptions are the biggest source of pain with RAII.

I'd say that exceptions are the biggest source of pain if you don't have RAII. Or, rephrased: RAII is incredibly attractive, especially when exceptions are being used.

RAII is necessary for exceptions. Why the hell would you do that to yourself?

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#166
post #161

Yet another game engine written in an imperative language, seemingly with the focus on writing something in Orthodox C++ and not necessarily writing something to solve a problem. Just as the discussion on this post shows, the more interesting thing here is Orthodox C++, not yet another game engine which doesn't offer any featues that modern game engines offer. If you're expecting people to see this as a useful produc…

It is just a simple general-purpose, data-oriented, data-driven, entity-component based, lua scripted game engine written in sane C++ for my own game development needs.

Nobody's trying to sell anything here.

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#167

New hobbyist engines pop up from time to time and then they fade into memory. Why is this going to be different? Not to be too grumpy but game engines are a weird thing cause they are such complex beasts and usually the people using them have invested a lot of time in learning them. It's fun to make a new engine, but it probably doesn't have the community nor interest to cover the hard 10 to 20% that inevitably come…

Yeah, writing game engines can be a great framework for learning all kinds of useful and interesting concepts (and trying out experimental things!) but an actual, usable engine needs a ton of "boring" stuff regarding tooling and asset pipeline that hobby engines usually miss. When artist creates shiny visuals in it is expected to look somewhat like that in engine and then you find yourself deep in some FBX/whatever S…

While in general you are right about the boring stuff (although some people find writing tools far from boring - e.g. me, i should actually write less tools if ever want to finish some of my own stuff:-P) the shiny visual bits aren't usually "just" imported. In the (commercial, not personal) engines i worked at, the artists used their 3D mesh editor of choice (max and maya) to make the meshes but only bothered with the basic texturing in that 3D mesh editor. The materials were created inside the engine's own editor since 3dsmax/maya's materials both do not make much sense to fully replicate and they lack functionality that the engine's own renderer (and material system) can provide.

In the last (commercial) engine i worked at, the pipeline was to export the mesh from the 3D mesh editor (3dsmax or maya) to a custom easy to parse format and then import it from the editor to a more compact faster and easier to work with format. Then the artists would create the materials and other resources that the engine needed to work with from inside the engine's own tools. The imported resource remembered the original file so that artists could simply export again and ask the editor to reimport stuff (at a later point we made the editor to automatically monitor the directories for changes - both Windows and Linux provide functionality for this - so the artists would simply export from their 3D mesh editor and the engine's editor would reimport the meshes automatically).

In the previous (commercial) engine i worked at, things were simpler in that we only supported 3ds max (although the 3dsmax SDK was far from simple, if it wasn't for SymbianOS it would be one of the worst SDKs i've worked with... but that is another story) and we exported animations and meshes directly to a custom format the engine expected. The exporter also had a "preview" feature to allow the artists preview the exported files in a standalone viewer that used the engine's renderer to make sure that things looked fine (in that case we actually did try to use 3ds max's materials, although in hindsight that was a mistake since even with the viewer the artists often assigned textures incorrectly - we should have relied only as little as necessary on 3ds max instead of making it the primary content editor).

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#168

I partially agree with "Orthodox C++". Templates should be used only when needed and for turn the code simpler(not like the abomination used in most of Boost libraries). But also, i don,t see any sane reason to reinvent the wheel and reimplement basic stuff like thread/mutex classes when the C++ version works well. Or using "NULL" instead "nullptr", or using that pre-processor macro garbage instead templates/constexp…

When I started the project C++11 was not supported well on most compilers. I'm fine with new features when they don't limit my freedom. I'm fine with nullptr, it is going to replace NULL very soon.

You should just replace it and define a nullptr macro for older compiles.

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#169

Earlier quoted context omitted.

Can you recommend any resources/books to learn game engine development? I would love to implement a mini one where I can rapidly prototype AR applications :).

You may just want to start by building your AR applications first. After a few of them, you'll have a better understanding of what common functionality is needed. See also: https://geometrian.com/programming/tutorials/write-games-not...

I love the article! It makes sense that after developing AR application on a game engine, I will identify the common functionality that would fit better for an "engine" that would fit the ideas I want to develop.

I am interested in developing AR applications that are not as much of a game, so I was worried that a game engine would not fit.

With both learning more about graphics and making my own games, it would make future engine development more clear.

Re: Show HN: Crown – A flexible game engine written from scratch in C++

#170

Earlier quoted context omitted.

Older implementations of STL had a lot of issues, EA wrote their own version way back when to address them with a list of whys here: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n227...

Right, but that was a long long time ago, 64 bits long. Even calling it "STL" nowadays kind of dates someone. I wonder how regularly EA currently does bake-offs between their stuff and the standard library. Not that it would matter at this point--they probably have so much legacy code depending on it that it would be painful to switch.

You can clone the repo and run the benchmarks yourself. When I last did it it was quite mixed (compared to libc++ on a MBP) - a lot of things were the same or slightly faster in EASTL, occasionally some things were an order of magnitude faster, some things an order of magnitude slower. Those were in what I would consider "edge cases" rather than general usage, for which the two were fairly similar.

As other comments have said though, the main reason it's used (and the reason I was interested even though I don't do games) is because the allocation story in the stdlib sucks.

Post reply on HN