Modernizing codebase allowed?

For code related discussions and questions

Modernizing codebase allowed?

Postby Vincent » 06 Aug 2016, 17:35

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.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Modernizing codebase allowed?

Postby Cyp » 06 Aug 2016, 18:08

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).
Cyp
Evitcani
Evitcani
 
Posts: 677
Joined: 17 Jan 2010, 23:35

Re: Modernizing codebase allowed?

Postby Per » 07 Aug 2016, 00:23

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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3549
Joined: 03 Aug 2006, 19:39

Re: Modernizing codebase allowed?

Postby Vincent » 07 Aug 2016, 01:46

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.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Modernizing codebase allowed?

Postby Vincent » 08 Aug 2016, 22:15

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.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Modernizing codebase allowed?

Postby jsnipy » 25 Aug 2016, 01:44

What are feelings about porting it to Unity? :ninja:
jsnipy
New user
 
Posts: 2
Joined: 25 Aug 2016, 01:42

Re: Modernizing codebase allowed?

Postby Vincent » 03 Sep 2016, 23:53

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.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Modernizing codebase allowed?

Postby Per » 04 Sep 2016, 00:23

Note that our codebase cannot be ported to Unity for legal reasons, even if it somehow were a good idea.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3549
Joined: 03 Aug 2006, 19:39

Re: Modernizing codebase allowed?

Postby Vincent » 24 Sep 2016, 22:18

I've added shaders for water and terrain, I think only shadows are the only remaining effect that use fixed function pipeline.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Modernizing codebase allowed?

Postby Jorzi » 25 Sep 2016, 10:47

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)
ImageImage
-insert deep philosophical statement here-
Jorzi
Regular
Regular
 
Posts: 1940
Joined: 11 Apr 2010, 00:14

Re: Modernizing codebase allowed?

Postby Vincent » 25 Sep 2016, 20:46

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.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Modernizing codebase allowed?

Postby Jorzi » 27 Sep 2016, 18:33

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 :)
ImageImage
-insert deep philosophical statement here-
Jorzi
Regular
Regular
 
Posts: 1940
Joined: 11 Apr 2010, 00:14

Re: Modernizing codebase allowed?

Postby jsnipy » 27 Dec 2016, 00:04

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?
jsnipy
New user
 
Posts: 2
Joined: 25 Aug 2016, 01:42


Return to Coding