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-02, 12:33

Hi, I have seen the kickstarter about the castAR augmented really glasses were you can in principle play card games using computer generated graphics. I think it could be a very neat thing to play widelands in this manner. (However this stuff is not available in the moment).

Anyway therefore you have to be able to rotate and translate the gameview in three dimensions, which is an objective, which can also be usefull in other situations. I have looked at the source code and I have thought, how it may be possible to add the free view to widelands.

I think going to the third dimensions using imposters for the various objects is the best option to keep the graphic style intact with not too much work and in a second step using some shader code to use true imposters with the old artwork rerendered at different directions and a z buffer channel. Put all these options will need that the viewer has some distance to the objects.

I might put some time in coding a modified game engine (with fall back to the old code), not immediately but maybe in a few months.

However, before I need some information: 1) Would you like such a feature? 2) If I understood it correctly a lot of the graphics is rendered using blender. I have look at the media repository, do I understand the code correctly, that the scripts for rendering are invoked by pressing a button inside blender? Do you think a more make file style rendering setup can be done? (So that it is possible to automatically rerender the graphics from different perspectives and also to modify the rendering pipeline from an outside skript?

Marten


Top Quote
SirVer

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

Kickstarters for hardware tend to fail. According to CNNMoney > 80% fail to deliver, IIRC. So do not keep your hopes up. About your other questions:

1) no. having the 3d technology would be nice as it would facilitate some things (i.e. zooming). But Widelands aims for the nostalgic 2d look too - going full 3d will kill the game as it is now. Also, changing the graphic and logic engine to work in 3d is a lot of work. I consider ~2-4 man months easy. If you try to convert the current engine to just use 3d, but still look the same is probably less work, but as soon as you replace sprites through models you are in for a ton of work. As mentioned having a 'true' 3d engine would be nice, so I'll support this, but not changing the visuals in any significant ways. If you want to do this you need a lot of time and dedication.

2) the artists do not work like coders. The in-blender button was the preferred solution. A more automated solution would be nice, but hard to make (Blender will not make this trivial). Work here would be welcome :).


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

To 1): May be I go a bit more into details: I do not want to change the look of widelands it all, it should still look classic and I also do want that mode to be optional. The idea is to have a rendering, which would look exactly the same, if you have the same orientation and camera distance. (It should also have the old isometric perspective, if the transformation matrix is set like this). The only difference for the rendering is that terrain will also pass the z- components to the opengl rendering. The immovables and the bobs will also stay as sprites, instead of doing the projection to the perspective (projected or isometric) in the game objects, also full 3D coordinates for the sprites will be used. This is essentially the 3D coordinate of the sprites position touching the map and then the sprites sizes. If looking form the same isometric perspective as before it should look the same.

Now if rotation, zooming and translation is allowed, the objects are supplied not as a picture from one specific direction but from several, just like the bob, when walking in different directions. So depending on the orientation between camera vector and the object, the different pictures are choosen and the object is rendered by a quad pointing more or less towards the camera. Of course, only a limited number of orientation are stored as pictures. The intermediate orientation are generated with a technique called true imposter (http://http.developer.nvidia.com/GPUGems3/gpugems3_ch21.html). This is essential a trick, that shifts some pixels while rendering to give the impression as, if you have all orientations. Anyway, if the old orientation is chosen, it should not look different compared to the old rendering. I am not aiming at using any 3D model. And it does not aim to go to real 3D, it should stick to the old look.

So if you stick to the old orientation, it may just enhance the rendering speed and have the advantages of easy zooming.

The game logic should not go to 3D, I would leave everything as it is.

2) Ok, then it is like I expected. I will look into the blender thing, if it is feasible to do it. Since my whole idea relies of rendering the objects from different perspectives and manual rerendering will be no fun.

Marten

Edited: 2013-11-02, 17:55

Top Quote
SirVer

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

All this sounds interesting - but still a lot of work :).

So if you stick to the old orientation, it may just enhance the rendering speed and have the advantages of easy zooming.

This would be really nice. I do not see that Widelands should support more than one perspective - first: all models would need work, they are only nicely modeled from one side, second: it adds confusion for very unneeded eye candy. I can also quote an example: the settlers 2 remake did allow you to walk your settlement and it was a useless and confusing feature that did not stick with the community.

If you want to make the engine true 3d - go for it. That will be much easier as much of the needed work is already done.


Top Quote
Adamant

Joined: 2012-10-11, 15:21
Posts: 180
Ranking
Widelands-Forum-Junkie
Location: Alemania
Posted at: 2013-11-03, 14:11

Matter remind me on a Proposal I made aiming at ComputingPerformance of200 FPS. With cheap 3D-Gear BT-ShutterGlas 80€ and BT-Stick Game could go respecting Performance 100 FPS stereoscopic View. for abou 100€ new HW. The Idea of Marten was uncalled BackGround-Matter for my proposal to disjoin GameGraphic from GameLogic. SirVer told from about/upto 200 FPS with my Proposal bypassing remaining 2D-Stuff. I called one Aspect "WalkingCancas-Model" you explained here in some Details. 200FPS sound good but Limit is the Monitor resp HDTV. Aiming "safe 200 FPS" in Production means practrical aiming 200 FPS and Gear scoring just 180 FPS goes into Market. IMO are 100 FPS stereoscopic View with cheap Gear a strong Argument for Players to sniff 3D-Flavor with their old Gear. The technical challenging Point is tweaking the HW/FW of Displays to leth these work beyond the Spec these got sold, and facing Problem that HW could get broken by arbitry Problems no Matter whem their Causes concerns. Assume there was a VoltagePeak or any other BOFH-Event. We can stay on safe Side with 50FPS stereoscopic View mains effective real 100 FPS of GPU and 100 Hz of Display which are adjecting to Limit of causing perceptable "Flackern" (somebody may translate that into EN .. perhaps its Flicker). Imo that's no Point to worry while the 3D-Feature promise a Lot of ROI for PlayerExperience.

3D is IMO still a thriving Point for Public but IMO more ROI offers Support for a 2nd Screen. However, I suggest to factor in both into Design what ever Changes/DesignGoals may get targeted and both Aspects have a clear Share of IntereSection but touches other as well.

I don't give aanythingh about classic nostalgic View/Graphic but can go along with. So your Ideas sound fine in my Ears.


Ivan the Terrible is dead .. Genghis Khan is dead .. and I do not feel well, too.

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

Ok, I will in a first step try to change the drawing system in a way, that the gameengine is aware of the z component. The isometric projection is then done by the projection matrix. Therefore I will for most object introduce a new function draw3D. For real 2D object the painting functions like blitting will also get an argument, stating the drawing plane. The rendering algorithm will then be changed, to used the global projection matrix for clipping. The rendering path for the software renderer will be kept intact.

Then a simple zoom function, can be accomplished by changing the projection matrix.

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.

I am new bazar, but I have been working with git. Do I understood it correctly, that I can create a branch on lauchpad for my experiments? Or do I have to ask someone?

Marten


Top Quote
Tino

Joined: 2009-02-20, 16:05
Posts: 252
Ranking
Tribe Member
Location: Somewhere in Germany...
Posted at: 2013-11-05, 07:31

Have a look at: https://wl.widelands.org/wiki/BzrPrimer/ , this should cover most questions. The main trick is to push your development branch later with

$ bzr push lp:~my.user.name/widelands/my-feature-xxx

Because of setting it to a subbranch of widelands it is directly visible at the widelands repository. If you want, you can then change the ownership of this branch to "widelands-dev" (or if you are already in that group push it directly to lp:widelands-dev/widelands/my-feature-xxx ) to allow other developers to push to your branch.


Top Quote
Adamant

Joined: 2012-10-11, 15:21
Posts: 180
Ranking
Widelands-Forum-Junkie
Location: Alemania
Posted at: 2013-11-05, 18:22

I am nopt sure what I think about limited Devices in Combination with OpenGL. I am not worry if they won'T work wwith WideLands due to WideLands is not "It's a small World" and IMO less suited for small Displays vand small RAM. I am aiming at 1024X1024 Maps and play it on 32" HDTV and will change to 40" anytime. If you can make WL runn on C64 I won't argue against but cheer it only from technical Point of View but IMO not in Respect of any useful MileStone for future WideLands. So I am reserved about your Idea to invest your Work and Skills into ES. I did anyway perhaps right now understand your Z-Argument correctly. Know well Vectors and somewhat Matrices. AFAICS You understand da Z-Axis to be parallel to "View-Vector" of Cam. Well, I did anyway sattle the Horse that Way that Space is oriented x,y,z and CAM-Vector/Position changes when movin over the Map and Cam-Vector and Z normal to XY-Plane are just complanar.

IF we let reserved x,y,z for Axis of Map we may consider another Triple like u,v,w analog for Dimensions related to Cam-Vectors. If Z is something like up-up and aways from Ground than is Plane UV as Projection(Plane .. from HyperSpace you can project HyperThingies on Spaces .. Projection not same like Plane) of Matrix and W parallel to the Cam-Vector. In that Context I think you want to factor in .. perspective Matters resp Scaling of .. Canvas,Textures,Rectangles,Images-Thingy. I embrace that Idea totally!

Why do you want to use ES-Calls? Won't it be easier to build any Wrapper to use SubSet of GL-Features as GL-ES via Interface of full-featured GL-Lib? Either WL don't use other Features of those of GL which are Member of GL-ES as well or you have to reimplement Features of higher Level from GL into GL-ES vand all other future resp still don't used Features as well. Brief: the more the WL-3D utlizes Features like those provided in rather plain OpenGL-Lib the more the Features of GL-ES have to get reimplemented to get more like the full-fledged GL. I am not sure what would be easier for first but for sure the more rational Way is to use the GL as Base as the ES and for ES..Sys a simple Wrapper-Lib can utilize the existing GL-ES-Features to build the Higher-Level-Features - if need. For free is none of those both Approaches. Taking more primitive ES remove a less impressive GL-Bulk-Code I don't consider to represent something that is a Must-be but more a well-that-exist. I would make Things totally different to safe BandWidth and much more! (the 200 FPS are not a real Solution but more a Proof-of-Concept to disjunct Game-GFX from Game-LGX but for Things I figured out that these few FPS resp few Quadrices,Trices the GFX have to render that's totally unsufficient for really large Maps and complex Sceneries. 1M Fields in total are not really a large PayLoad to get rendered for a complete OverView. Moderatre actual ATI GPUs run about 1GHz, have 1GB RAM and about 1k Cores work parallel, each with 4 Scalar-Units and a SIMD-Unit which means a Core can eg process a single Vector-Operation parallel or similiar with an RGBA-Color. Assumed a well balanced stream-lined Processing of MAP/Bodies Geometries, Colors, Projection means about 10k CLks ComputationTime per Field and Core while 100 FPS and a singe Core can afaik do effectively up to 8 OPs like MULs/ADs parallel like given from sV1V2 as List of independed WorkLoads - that Example does not make Sense do to you don't win anything when you do parallel sv1 and v1v2 BUT the Complexity resp Amount of WorkLoad is that a single Core can do parallel. Asssume optimistic 36Clks for 32Bit-Integer-MUL resp safe 40Clks means a single Core can do a really Lot work parallel ... if WorkLoad resp Design of Processing is balanced to underlying HW. So a single Core do lesser than a Magnitude of Arithmetic-Work compared with an traditional CPU like 386 with its ALU resp its single Core but it does not appear challenging to do more than double for qudruple of that of 386. ... umm 1k X 1k is even in TotalOverView no really challenging Problem for a PC with a much lesser modern GPU. Point is: I am not sure why SirVer only archived 200FPS but for sure GL is all other than optimal implemented and featured. Point is: 1kX1k is nothing and again is GL no Idol for Performance and Feature. I don't want to push you into any GL/Non-GL-Direction but ask why invest into changing Calls of crappy GL into Calls of crappy GL-ES? What Requirements do you think have to have eg a Mobile have to have to get a playaable Game? CPU,MEM,Display, Keys? Full-fledged with Periphery and other Fetures ... why don't take a real PC instead? I play on 32" HDTV and wouldd like to scale down GFX on Factor 4 - together with Zoom good Match - and like to change to 40". I don't want to think how somebody could play WL on a Mobile .. feel free to find out resp take Proposal to define your personal Idea of Spec what an ES MUST HAVE to get playable .. and how much this differ from a real PC resp how many Super-Mobile-User left to play it on their Gear. Direction ES: OLPC match much more personal Interests and when you look at ES please consider to factor in OLPC (and no other crappy strange Organizations which counter the Idea of OPCL simply by there stupid Existence - did OPCL not supply all Demands of those who need it? Dozen of incompatible/diverse Alternatives results in more expensive OLPC and OLPC-Alternatives. I care little about the OLPC-Alternatives but ask for OLPC directly - no Reason to invest Effort to avoid Support for Alternatives but I wan't do a single Circumstance for them) ... well that all about ES ... like WL for OLPC but that's not what I amn really aiming for.

About GFX-Things we may discuss more via Email if you like. FYI: What do you think is necessary to render same DataStream for one Frame for both stereoscopic Perspectives? Note that all that Stuff needs quasi simply stamped two Times onto two similar Projections - little Reason to feed GPU two Times with same Stuff but the Cam-Spec. However, I found GL as Lib lesser helpful to step in to utilize it that Way. Its Source I did not view but don't expect anything interesting as afaik it simply utlize the FW-specific Libs of GFX-Vendors. I got Stuff to code for ATI-Gear on ASM-Level, in ATI-Vocabulary CTM Close-to-Metal. Something I did not found equivalent from NVidia/Cude which offer any C-Syntax HighLevel-Access to HW. From ASM/C on GPU we know average Advantage for ASM of Factor 3. Due to very special HW resp Topology of GPUs I expect much better Results for GPU-ASM on GPUs and here can NVidia not supply. I don't argue against generic Support but won't figure out how to code NV-ASM to make HW fly. For CTM I found a Lot Docs and some Stuff resp Compiler. That's just a moderate small Part from Path to Solution I figured out but I stop here and let Space for Thoughts.


Ivan the Terrible is dead .. Genghis Khan is dead .. and I do not feel well, too.

Top Quote
SirVer

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

Ok, I will in a first step try to change the drawing system in a way, that the gameengine is aware of the z component. The isometric projection is then done by the projection matrix. Therefore I will for most object introduce a new function draw3D. For real 2D object the painting functions like blitting will also get an argument, stating the drawing plane. The rendering algorithm will then be changed, to used the global projection matrix for clipping. The rendering path for the software renderer will be kept intact.

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.

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. face-smile.png


Top Quote
SirVer

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

Please keep the technical discussion in the forum and/or the bug tracker so that everybody can participate.

@Adamant: You already presented your idea of a rendering engine to the community in great length a few months ago. You never managed to show any code though and you did not rally any support for it either. I cannot stop you from giving your opinion here, of course, but I'd much appreciate if you would not hijack this thread to warm this up again. Also note that I personally value your technical input very little at this point and I stopped reading your posts by now. Among the reasons for this are that you that you have been very rude towards me and members of the team (you managed to estrange the most gentle and friendly person I ever worked with), and that I consider your technical expertise to be questionable, and that your reliability in working together is poor (i.e. you never bothered to reply to the comments I made on your bug https://bugs.launchpad.net/widelands/+bug/1237842, though you sent me 3 private emails about it and pushed me to review it quickly).


Top Quote