Page 1 of 1

Modernizing codebase allowed?

Posted: 06 Aug 2016, 17:35
by Vincent
I'd like to improve the gfx code of wz2100. However gfx callbacks are spread throughout the whole source code.
Thus I'd like to modernize codebase to ease future improvement. Using namespace and adding directory is a first step but I intend to use c++14 where applicable and replace some structure (vector affine) with glm counterpart.
Is it OK for wz project? It will likely break compatibility with older compiler but I'm expecting better maintainability by using modern dev practice and standard structure.

Re: Modernizing codebase allowed?

Posted: 06 Aug 2016, 18:08
by Cyp
We're already using at least C++11 (not sure whether that was decided, or whether it just happened).

Think someone might have tried doing something like this before, not sure whether it got finished: https://github.com/Safety0ff/warzone210 ... csfixredux

If trying to merge it, there's only 187 merge conflicts, which isn't as bad as I expected, especially since I think there have been some complete reformatting of the code since then (with astyle).

Re: Modernizing codebase allowed?

Posted: 07 Aug 2016, 00:23
by Per
Modernization would be very welcome, in general.

There are some limitations, compiler-wise, as we need to be able to cross-compile to Windows, and compile on MacOSX. I don't know what those limits are, currently, though. What are the c++14 features that you would like to use?

The codebase is very convoluted, with lots of static globals everywhere. Turning them into classes would be a good idea. We try to incrementally clean up and improve this up as we go, and patches to assist in this would be welcome. Probably a good idea to discuss ideas before coding them, if they involve larger reorganizations.

Re: Modernizing codebase allowed?

Posted: 07 Aug 2016, 01:46
by Vincent
I'd rather use c++14 feature supported by MSVC since it slightly lag behind other compiler in C++14 support (afaik clang and gcc do support c++14 completly).
For instance std::make_unique is not available in c++11 but is in C++14 and constexpr behavior was slightly modified wrt const method.

A first step would be to move everything in a namespace ; I think "maths" "ui" "render" "sound" "network" "ai" namespaces would be a good starting point.
I'm also thinking of removing vector/Affine and custom matrix in favor of the one in glm.

Re: Modernizing codebase allowed?

Posted: 08 Aug 2016, 22:15
by Vincent
Is it OK to use directwrite on Windows? Quesoglc has a lot of dependencies and is strongly tied to opengl fixed function. On the other hand directwrite is gfx api agnostic which would make possible to use opengl 3+ and vulkan api while retaining support for right to left layout.

Pangs is also another option for Linux but I have no experience with it.

Re: Modernizing codebase allowed?

Posted: 25 Aug 2016, 01:44
by jsnipy
What are feelings about porting it to Unity? :ninja:

Re: Modernizing codebase allowed?

Posted: 03 Sep 2016, 23:53
by Vincent
Why porting wz to another engine instead of improving the existing one ? It would take likely more time to improve current engine than porting to another one.

Re: Modernizing codebase allowed?

Posted: 04 Sep 2016, 00:23
by Per
Note that our codebase cannot be ported to Unity for legal reasons, even if it somehow were a good idea.

Re: Modernizing codebase allowed?

Posted: 24 Sep 2016, 22:18
by Vincent
I've added shaders for water and terrain, I think only shadows are the only remaining effect that use fixed function pipeline.

Re: Modernizing codebase allowed?

Posted: 25 Sep 2016, 10:47
by Jorzi
Hi
This sounds really interesting. How hard would it be to render a reflection map for the water (essentially mirror the camera along the water surface and render to an off-screen buffer)

Re: Modernizing codebase allowed?

Posted: 25 Sep 2016, 20:46
by Vincent
Not trivial. The codebase is quite convoluted, some object are stored in a list that could be parsed twice but it will require some works.

Re: Modernizing codebase allowed?

Posted: 27 Sep 2016, 18:33
by Jorzi
I see. Of course, not everything would need to be reflected. Just the terrain and skybox would already be quite convincing.
Either way, I appreciate what you're doing :)

Re: Modernizing codebase allowed?

Posted: 27 Dec 2016, 00:04
by jsnipy
Vincent wrote:Why porting wz to another engine instead of improving the existing one ? It would take likely more time to improve current engine than porting to another one.
There are/will be limitation when it comes to testing and maybe extending the number of platforms. Current is not awful just would be good to keep it living well into the future.
Per wrote:Note that our codebase cannot be ported to Unity for legal reasons, even if it somehow were a good idea.
I had a hunch there would be something but am law nub. What aspect of unity's legal make this an issue?