Latest Posts

Topic: Free Perspective, OpenGL and CastAR

MartenR
Avatar
Topic Opener
Joined: 2013-11-02, 12:13
Posts: 12
Ranking
Pry about Widelands
Posted at: 2013-11-06, 07:49

@Tino Thanks for the clarification.

SirVer wrote:

That sounds like a good plan. Try to reuse code as much as possible and feel free to propose the branch for merging whenever you want some feedback. Ok I will do this, but it will probably take some time until I will propose it for merging. First I have to sort out the compiler stuff... and then it has to work reliable. But I will try to setup it like Tino suggested, so that you will be able to view my coding attempts in an branch on launchpad, so that changes can be discussed early. Please keep the technical discussion in the forum and/or the bug tracker so that everybody can participate. Of course I will do this, but I will stick to this thread.

If noone mind, I will also try to get rid of all OpenGL calls, which are not compatible with OpenGL ES, to prepare for embedded device compatibility.

This sounds like a GREAT idea. We need to move to SDL 2.0 before moving to android, but that is a firm plan of mine. Compatibilty might be an issue, but we can sort this out.

Really excited that you want to work on the rendering engine. That part always needs love. :) Good, that you like the idea, I will probably touch these parts any way, and I have some experience with open gl es. I do not know if I will target android maybe raspberry pi but we will see....

@adamant I do not get your point either. OpenGL ES is a subset of OpenGL and widelands should work fine with mobile hardware.

The engine of widelands only uses OpenGL function, which are very basic and can be easily handled by OpenGL ES. It only means instead of supplying a vertex one by one using vertex buffers. The second thing is that quads are not supported. But converting them to triangle strip etc. is not a big deal, your driver will do it anyway for normal OpenGL. Not using opengl es will be bad for mobile devices, since the cpu is normally not as powerful as the gpu.

Marten


Top Quote
MartenR
Avatar
Topic Opener
Joined: 2013-11-02, 12:13
Posts: 12
Ranking
Pry about Widelands
Posted at: 2013-11-11, 07:32

Just an update, I got widelands compiled over the weekend for windows (especially recompiling boost was horror).. So I start next weekend with the actual coding.


Top Quote
fawi
Avatar
Joined: 2013-11-22, 10:28
Posts: 5
Ranking
Just found this site
Posted at: 2013-11-22, 17:36

WTF!

What has a bunch of - yet to be released - 3d / VR glasses to do, with going full 3d of widelands???
The software for the glasses won't even be free (as free in speech) software nor dual licensed.


Despite this total irritating reasoning ... Why would one spend so much time (someone mentioned ~3 man months coding, which can easily translate to half a calendar year or prob. even more) on such a massive code rewrite and end up with your very own thing?

Think of the bus factor guys! Even if MartenR successfully finishes this job and dumps the code in your git. He can change his mind (i.e. choose another hobby / project) anytime, which ofc he has the right to do. However this would left the widelands community with no one of understanding the deeper insides of the code. Even worse there would be no one else in the whole world, because MartenR wrote it all by himself.


As you see I think this is a very bad idea. ... however I also have a solution to this: :-)

Port Widelands to an open source game engine already used by other projects!

This is IMHO also more along the free software spirit: share code and knowledge and everyone profits! (Widelands code is open source, but since it is not used by other projects there is currently no sharing at all.)


Some suggestions on game engines I just researched:
If you want to stay with 2d / pseudo 3d, but enable zoom, lighting and other fancy stuff:
Flexible Isometric Free Engine (FIFE): http://fifengine.net/ (my favorite)
it is already used by Unknown Horizons and upcoming "Projekt-Zero", seems also to have strong german user base.

Full 3d:
Pyrogenesis used by 0.A.D and developed by Wildcard Games: http://en.wikipedia.org/wiki/0_A.D._%28video_game%29#Pyrogenesis

Or choose one on your own: http://en.wikipedia.org/wiki/List_of_game_engines#Free_and_open_source

... but please don't continue with very own development (when there is a major rewrite).


Top Quote
MartenR
Avatar
Topic Opener
Joined: 2013-11-02, 12:13
Posts: 12
Ranking
Pry about Widelands
Posted at: 2013-11-23, 08:40

fawi wrote:

WTF!

What has a bunch of - yet to be released - 3d / VR glasses to do, with going full 3d of widelands??? The software for the glasses won't even be free (as free in speech) software nor dual licensed.

Well, I want to play an old style building game, where you can play multiplayer like an playing a cardboard game with your opponent just in front of you. Together with little workers walking over the table... Therefore I searched for an open source game, which I like and with an engine, which is capable to have this view added with not too much work. The software for the glasses will be just a bunch of low level apis and drivers. This is normally considered to be part of the os with respect to GPL.

fawi wrote:

Despite this total irritating reasoning ... Why would one spend so much time (someone mentioned ~3 man months coding, which can easily translate to half a calendar year or prob. even more) on such a [b]massive[/b] code rewrite and end up with your very own thing?

This will not be a massive rewrite. I have just to move the projection code to 2D from the top of the drawing calls down to the interface calls to opengl. The different perspective is just a different matrix.

fawi wrote:

Think of the bus factor guys! Even if MartenR successfully finishes this job and dumps the code in your git. He can change his mind (i.e. choose another hobby / project) anytime, which ofc he has the right to do. However this would left the widelands community with [b][i]no one[/i][/b] of understanding the deeper insides of the code. [b][i]Even worse there would be no one else in the whole world[/i][/b], because MartenR wrote it all by himself.

I think the developers here will be wise enough to inspect my changes and ask for changing it in a way, that it is easy to maintain. Also the changes will be very gentle and I am trying to stick to the coding spirit of widelands.

fawi wrote:

As you see I think this is a very bad idea. ... however I also have a solution to this: face-smile.png

[b][u]Port Widelands to an open source game engine already used by other projects![/u][/b]

This is IMHO also more along the free software spirit: share code and knowledge and everyone profits! (Widelands code is open source, but since it is not used by other projects there is currently no sharing at all.)

Some suggestions on game engines I just researched: If you want to stay with 2d / pseudo 3d, but enable zoom, lighting and other fancy stuff: Flexible Isometric Free Engine (FIFE): http://fifengine.net/ (my favorite) it is already used by Unknown Horizons and upcoming "Projekt-Zero", seems also to have strong german user base.

Full 3d: Pyrogenesis used by 0.A.D and developed by Wildcard Games: http://en.wikipedia.org/wiki/0_A.D._%28video_game%29#Pyrogenesis

Or choose one on your own: http://en.wikipedia.org/wiki/List_of_game_engines#Free_and_open_source

... but please don't continue with very own development (when there is a major rewrite).

I am sorry, but your suggestions is a complete rewrite, orders of magnitude more than that what I am doing.

Anyway last weekend I already converted the rendering of the objects to 3D coordinates. It is in the moment buggy (no objects visible, probably a sign error), but if everything works out I try to push it a branch into launchpad this weekend, so that the widelands devs can see what I am doing.

Marten

Edited: 2013-11-23, 08:45

Top Quote
MartenR
Avatar
Topic Opener
Joined: 2013-11-02, 12:13
Posts: 12
Ranking
Pry about Widelands
Posted at: 2013-11-23, 18:04

Ok, I have posted it now to launchpad: lp:~marten-r/widelands/feature-3d-rendering-open-gl-es-compat

So far I introduced a 3D point and I have converted the object rendering so far to 3D coordinates. One thing I have stumbled across, if the coordinates in a point are negative, the blit function has a problem, caused by signed and unsigned mismatch of w and h of rect (unsigned) and point coordinates (signed). A simple typecast helped, I could drop some of the clipping stuff since opengl does it now. I am wondering, if you can also remove the manual clipping, in the 2D rendering if the unsigned signed mismatch is fixed or is it required with SDL? Anyway a rect with signed w and h would cause less trouble in the drawing routines. Should I change it?

Point3D and draw3D is not the perfect way in the moment. I will probably change the interface in the future.

Marten


Top Quote
SirVer

Joined: 2009-02-19, 14:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2013-11-25, 05:25

@fawi: I agree with MartenR here - his suggestions is a lot of work, but yours is even more. Yours would require moving to true 3d models (for one example) which would be a lot more work.

MartenR, if you propose your branch for merging, a diff will be generated. Also, I added you to the widelands-dev team. Please do not push to trunk, but instead push your changes to lp:~widelands-dev/widelands/feature-3d-rendering-open-gl-es-compat - it allows other devs to fix nits immediately and leave todos as code comments for you that are easy to grep for.


Top Quote
MartenR
Avatar
Topic Opener
Joined: 2013-11-02, 12:13
Posts: 12
Ranking
Pry about Widelands
Posted at: 2013-11-25, 07:30

@SirVer I have pushed it to lp:~widelands-dev/widelands/feature-3d-rendering-open-gl-es-compat as you proposed. But I will not propose it for merging now, since the changed interfaces and coordinate systems are still a bit oscillating and the graphics output is slightly buggy.

(The problem is to generate for the meantime a meaning full z-coordinate for animations. In the moment I am using the difference of image height and hotspot position for the z correction. But this causes some problems with the drawing order, anyway this is fixable...) I wait until this is stable.

Anyway, my plan is after temporally fixing the glitches to introduce an abstract camera interface with cameras for isometric, perspective projection etc. . Where should I place this? In graphics folder or in wui?

Marten


Top Quote
SirVer

Joined: 2009-02-19, 14:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2013-11-26, 09:48

I think you can argue for both design choices. I personally feel that it should live in graphics/ instead of wui/, because in my mind the viewport rendering is part of the engine while the wui is just extensions to the user interface classes - that is not reflected in all design choices done so far though. Put it into graphics/ for now.

Let me know when you feel that the code is ready for a first look. I'd rather not look over it when it is still changing a lot, because I'll do a lot of unnecessary reviewing then.

Edited: 2013-11-26, 09:49

Top Quote