Latest Posts

Topic: New roads

kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2439
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2015-01-27, 21:33

GunChleoc wrote:

I'd say we go for normal roads with small buildings and busy roads for the rest and see how it looks.

Yes, i think its really good:

roads

I tried to get a closer look into the code, but as i am about 20 years away from C++ i would request someone else to implement the code for tribe specific roads...

Edited: 2015-01-27, 21:34

Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
SirVer

Joined: 2009-02-19, 14:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2015-01-28, 07:38

I am really eager getting the tribe specific roads into the game. I am pretty busy, so no idea if I can make it this week though...


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2015-01-28, 14:51

I have continued fiddling:

https://code.launchpad.net/~widelands-dev/widelands/busy_roads_for_buildings

I have added the texture filenames to FieldsToDraw::Field for the field owner's tribe. All I need to do now is to correctly assign glBindTexture in RoadProgram::draw, but I don't know how that works.


Busy indexing nil values

Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2439
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2015-01-28, 15:47

GunChleoc wrote:

I have added the texture filenames to FieldsToDraw::Field for the field owner's tribe.

face-grin.png i did nearly the same as you did....

All I need to do now is to correctly assign glBindTexture in RoadProgram::draw, but I don't know how that works.

Now are the roadtypes tribe specific, so, i think, the roadprogram needs to know about, which tribe he should use for drawing the corresponding roads....

But storing only the strings pics/roadt_xy.png isn't enough i believe. How does the roadprogram should know, which path before the string he should use? atlantean/pics/roadt_xy.png or babarian/pics/roadt_xy.png ? Maybe it's better to store some kind of pointer to the roadpics. As i understand it right, this is also the case for buldings. Buildings pics are load into memory and a pointer points to it.... but maybe i am completly wrong face-smile.png

Edited: 2015-01-28, 15:48

Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
dershrimp

Joined: 2012-05-11, 14:43
Posts: 47
Ranking
Pry about Widelands
Posted at: 2015-01-28, 15:49

I just saw the picture above and I love it, really cool idea to change the look of the roads. Nice work. Looking forward to see them in game.


Top Quote
Rayback
Avatar
Joined: 2015-01-21, 20:37
Posts: 7
Ranking
Pry about Widelands
Location: Rio de Janeiro - Brazil
Posted at: 2015-01-28, 16:11

amazing (ignore my signature)

Edited: 2015-01-28, 16:12

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2015-01-28, 16:50

But storing only the strings pics/roadt_xy.png isn't enough i believe. How does the roadprogram should know, which path before the string he should use? atlantean/pics/roadt_xy.png or babarian/pics/roadt_xy.png ? Maybe it's better to store some kind of pointer to the roadpics. As i understand it right, this is also the case for buldings. Buildings pics are load into memory and a pointer points to it.... but maybe i am completly wrong face-smile.png

I managed to give the roadprogram the info, my problem is in how to apply it.

Edited: 2015-01-28, 16:50

Busy indexing nil values

Top Quote
SirVer

Joined: 2009-02-19, 14:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2015-01-28, 17:59

GunChleoc wrote: I managed to give the roadprogram the info, my problem is in how to apply it.

So my approach to this problem would be:

  1. Add a list of road textures (e.g. 3 differend busy and 5 different normal textures) to each tribe.
  2. The tribe only owns the filepaths, not the image data. It should check if the files are there on load. The data is actually loaded and owned by the GameRenderer - it puts all images into one texture atlas (so only one gl texture is needed)) and makes the textures accessible to the RoadProgram.
  3. The FieldsToDraw contains (based on the owning player and the x, y coordinates of the field) which one should be used for rendering.

This allows for more than one road texture for each roadtype and tribe and allows for a lot of variations and is pretty straightforward to implement. Gun, if you can do the first step, I think I can do the rest.


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2439
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2015-01-29, 10:35

If possible, the new code should allow future use of terrain-dependend roads. If so we could make e.g pebbly mountain roads, sandy beach roads, muddy meadow roads and so on.

This will also making roads easier, because one road must not contrasts to all terrains.

Maybe i (we) had thought about such roads earlier instead of making tribe specific roads...


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2015-01-29, 11:32

kaputtnik wrote:

If possible, the new code should allow future use of terrain-dependend roads. If so we could make e.g pebbly mountain roads, sandy beach roads, muddy meadow roads and so on.

This will also making roads easier, because one road must not contrasts to all terrains.

Maybe i (we) had thought about such roads earlier instead of making tribe specific roads...

With the tribe specific roads, we can have both. I am creating a new enum with road texture types, and we could add road types for different terrains there as well. We can then query the terrain type from the field's TerrainDescription in the GameRenderer to pick the correct texture.

For the tribes, I am putting the texture filenames into a map, so we can expand easily.

Edited: 2015-01-29, 11:33

Busy indexing nil values

Top Quote