[Freeciv-Dev] Re: (PR#2957) is ocean as a function with oceanness read f
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, Feb 09, 2003 at 08:27:35AM -0500, Jason Short wrote:
> It looks to me like with this code, and suitable
> mapgen/savegame+ruleset+tileset changes, you could get different-looking
> types of ocean. I would like to see a demo of this, if possible: some
> crude tilesets (iso and non-iso) [1], a changed ruleset, and (at least)
> a savegame to show that the basic infrastructure works. Actual support
> for these features can come later.
I made a hack of a patch that does this. This is not a real solution
since it destroys T_RIVER and replaces it with T_SHELF. I only have it
working with the Trident tileset. But it demonstrates what having
shelf and deep ocean separate can look like.
My code to decide if ocean is deep or not in mapgen is terrible, it
only works with gen1. I really just wanted to see how possible this
was. It shouldn't be hard to fix later.
Note that this does not currently use the ruleset, it's just an idea
of what we could do. I don't expect to be able to provide any
significant progress on this front until at least early April.
The tiles.png file can be found at
<http://www.eng.uwaterloo.ca/~cjmorlan/freeciv/tiles.png>. I also have
a screenshot at
<http://www.eng.uwaterloo.ca/~cjmorlan/freeciv/shelf.png>.
> Later other flags could be added controlling other rules behavior (for
> instance triremes dying in "deep" water, not just when they leave shore).
>
> [1] This is important since the ocean drawing code is very different in
> iso and non-iso mode, and may not generalize well to different types of
> ocean. But the tileset can be _very_ crude; you could just invert the
> current sprites to get the new graphics.
Right.
Is that dithering code in yet? If so, it could provide smoother
transitions between the ocean types.
--
+-----------------------------------------------------------------
| PGP http://www.eng.uwaterloo.ca/student/cjmorlan/public-key.pgp
| Cameron Morland ---- Cameron@xxxxxxxxxx
|
| When hydrogen 'U' played oxygen tech, the game had just begun,
| when hydrogen racked up two fast points, and oxygen still had none.
| Then oxygen scored a single goal, and thus it did remain,
| at hydrogen two and oxygen one: called because of rain.
| --Wiley
+-----------------------------------------------------------------
? client/tilespec.c.shelf
? data/trident/.xvpics
? data/trident/tiles.xcf
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.110
diff -u -3 -p -r1.110 tilespec.c
--- client/tilespec.c 2003/02/05 07:19:43 1.110
+++ client/tilespec.c 2003/02/09 13:54:09
@@ -1964,10 +1964,18 @@ int fill_tile_sprite_array(struct Sprite
abs_x0>=34 && abs_x0<=36 && abs_y0>=den_y && abs_y0<=den_y+1) {
mysprite = sprites.tx.denmark[abs_y0-den_y][abs_x0-34];
} else {
- tileno = INDEX_NSEW(ttype_near[DIR8_NORTH] == ttype,
- ttype_near[DIR8_SOUTH] == ttype,
- ttype_near[DIR8_EAST] == ttype,
- ttype_near[DIR8_WEST] == ttype);
+ tileno = INDEX_NSEW(ttype_near[DIR8_NORTH] == ttype
+ || (is_ocean(ttype_near[DIR8_NORTH]) &&
+ is_ocean(ttype)),
+ ttype_near[DIR8_SOUTH] == ttype
+ || (is_ocean(ttype_near[DIR8_SOUTH]) &&
+ is_ocean(ttype)),
+ ttype_near[DIR8_EAST] == ttype
+ || (is_ocean(ttype_near[DIR8_EAST]) &&
+ is_ocean(ttype)),
+ ttype_near[DIR8_WEST] == ttype
+ || (is_ocean(ttype_near[DIR8_WEST]) &&
+ is_ocean(ttype)));
if(ttype==T_RIVER) {
tileno |= INDEX_NSEW(is_ocean(ttype_near[DIR8_NORTH]),
is_ocean(ttype_near[DIR8_SOUTH]),
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.133
diff -u -3 -p -r1.133 map.c
--- common/map.c 2003/01/09 02:36:37 1.133
+++ common/map.c 2003/02/09 13:54:10
@@ -524,6 +524,7 @@ int is_good_tile(int x, int y)
return (map_get_special(x, y) == S_NO_SPECIAL) ? 2 : 4;
case T_DESERT:
case T_OCEAN:/* must be called with usable seas */
+ case T_SHELF:
return (map_get_special(x, y) == S_NO_SPECIAL) ? 1 : 3;
case T_SWAMP:
case T_JUNGLE:
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.5
diff -u -3 -p -r1.5 terrain.h
--- common/terrain.h 2003/01/09 02:36:37 1.5
+++ common/terrain.h 2003/02/09 13:54:10
@@ -63,9 +63,10 @@ enum tile_special_type {
| S_FORTRESS \
| S_AIRBASE)
+/* I removed T_RIVER and added T_SHELF. This may not be appropriate. CJM */
enum tile_terrain_type {
T_ARCTIC, T_DESERT, T_FOREST, T_GRASSLAND, T_HILLS, T_JUNGLE,
- T_MOUNTAINS, T_OCEAN, T_PLAINS, T_RIVER, T_SWAMP, T_TUNDRA, T_UNKNOWN,
+ T_MOUNTAINS, T_OCEAN, T_PLAINS, T_SHELF, T_SWAMP, T_TUNDRA, T_UNKNOWN,
T_RIVER,
T_LAST
};
#define T_FIRST (T_ARCTIC)
@@ -78,9 +79,9 @@ enum known_type {
/* These gets used very commonly, but we might change the definition of
* ocean at a later date, and then we'll need to change only these
* defines. */
-#define is_ocean(x) ((x) == T_OCEAN)
-#define is_ocean_near_tile(x, y) is_terrain_near_tile(x, y, T_OCEAN)
-#define adjacent_ocean_tiles4(x, y) adjacent_terrain_tiles4(x, y, T_OCEAN)
-#define count_ocean_near_tile(x,y) count_terrain_near_tile(x,y, T_OCEAN)
+#define is_ocean(x) ((x == T_OCEAN) || (x == T_SHELF))
+#define is_ocean_near_tile(x, y) (is_terrain_near_tile(x, y, T_OCEAN) ||
is_terrain_near_tile(x, y, T_SHELF))
+#define adjacent_ocean_tiles4(x, y) (adjacent_terrain_tiles4(x, y, T_OCEAN) +
adjacent_terrain_tiles4(x, y, T_SHELF))
+#define count_ocean_near_tile(x,y) (count_terrain_near_tile(x, y, T_OCEAN) +
count_terrain_near_tile(x, y, T_SHELF))
#endif /* FC__TERRAIN_H */
Index: data/default/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/buildings.ruleset,v
retrieving revision 1.37
diff -u -3 -p -r1.37 buildings.ruleset
--- data/default/buildings.ruleset 2003/02/04 17:07:44 1.37
+++ data/default/buildings.ruleset 2003/02/09 13:54:12
@@ -330,7 +330,7 @@ tech_req = "Metallurgy"
bldg_req = "None"
graphic = "b.coastal_defense"
graphic_alt = "-"
-terr_gate = "Ocean"
+terr_gate = "Ocean", "Ocean Shelf"
;spec_gate =
equiv_range = "City"
;equiv_dupl =
@@ -476,7 +476,7 @@ tech_req = "Seafaring"
bldg_req = "None"
graphic = "b.harbour"
graphic_alt = "-"
-terr_gate = "Ocean"
+terr_gate = "Ocean", "Ocean Shelf"
;spec_gate =
equiv_range = "City"
;equiv_dupl =
@@ -701,7 +701,7 @@ tech_req = "Miniaturization"
bldg_req = "None"
graphic = "b.offshore_platform"
graphic_alt = "-"
-terr_gate = "Ocean"
+terr_gate = "Ocean", "Ocean Shelf"
;spec_gate =
equiv_range = "City"
;equiv_dupl =
@@ -797,7 +797,7 @@ tech_req = "Amphibious Warfare"
bldg_req = "None"
graphic = "b.port_facility"
graphic_alt = "-"
-terr_gate = "Ocean"
+terr_gate = "Ocean", "Ocean Shelf"
;spec_gate =
equiv_range = "City"
;equiv_dupl =
Index: data/default/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/terrain.ruleset,v
retrieving revision 1.17
diff -u -3 -p -r1.17 terrain.ruleset
--- data/default/terrain.ruleset 2002/03/30 02:43:54 1.17
+++ data/default/terrain.ruleset 2003/02/09 13:54:12
@@ -409,18 +409,18 @@ defense_bonus = 10
food = 1
shield = 0
trade = 2
-special_1_name = _("Fish")
-graphic_special_1 = "ts.fish"
+special_1_name = "none"
+graphic_special_1 = "-"
graphic_special_1a = "-"
-food_special_1 = 3
+food_special_1 = 0
shield_special_1 = 0
-trade_special_1 = 2
-special_2_name = _("Whales")
-graphic_special_2 = "ts.whales"
+trade_special_1 = 0
+special_2_name = "none"
+graphic_special_2 = "-"
graphic_special_2a = "-"
-food_special_2 = 2
-shield_special_2 = 2
-trade_special_2 = 3
+food_special_2 = 0
+shield_special_2 = 0
+trade_special_2 = 0
road_trade_incr = 0
road_time = 0
irrigation_result = "no"
@@ -429,8 +429,8 @@ irrigation_time = 0
mining_result = "no"
mining_shield_incr = 0
mining_time = 0
-transform_result = "Swamp"
-transform_time = 36
+transform_result = "Ocean Shelf"
+transform_time = 144
helptext = _("\
Oceans cover much of the world, and only sea units (Triremes and\
other boats) can travel on them.\
@@ -474,37 +474,42 @@ Plains are very broad, sparse regions, w
inconvenient.\
")
-[terrain_unused_0]
-terrain_name = "unused"
-graphic = "-"
+[terrain_shelf]
+terrain_name = _("Ocean Shelf")
+graphic = "t.shelf"
graphic_alt = "-"
-movement_cost = 0
-defense_bonus = 00
-food = 0
+movement_cost = 1
+defense_bonus = 10
+food = 1
shield = 0
-trade = 0
-special_1_name = "none"
-graphic_special_1 = "-"
+trade = 2
+special_1_name = _("Fish")
+graphic_special_1 = "ts.fish"
graphic_special_1a = "-"
-food_special_1 = 0
+food_special_1 = 3
shield_special_1 = 0
-trade_special_1 = 0
-special_2_name = "none"
-graphic_special_2 = "-"
+trade_special_1 = 2
+special_2_name = _("Whales")
+graphic_special_2 = "ts.whales"
graphic_special_2a = "-"
-food_special_2 = 0
-shield_special_2 = 0
-trade_special_2 = 0
+food_special_2 = 2
+shield_special_2 = 2
+trade_special_2 = 3
road_trade_incr = 0
road_time = 0
-irrigation_result = "no"
+irrigation_result = "Ocean"
irrigation_food_incr = 0
-irrigation_time = 0
+irrigation_time = 144
mining_result = "no"
mining_shield_incr = 0
mining_time = 0
-transform_result = "no"
-transform_time = 0
+transform_result = "Swamp"
+transform_time = 36
+helptext = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+other boats) can travel on them. Some oceans are shallow, and\
+this feature is being explored.\
+")
[terrain_swamp]
terrain_name = _("Swamp")
@@ -535,7 +540,7 @@ irrigation_time = 15
mining_result = "Forest"
mining_shield_incr = 0
mining_time = 15
-transform_result = "Ocean"
+transform_result = "Ocean Shelf"
transform_time = 36
helptext = _("\
Swamps suffer from an over-abundance of water, making agriculture\
Index: data/trident/tiles.png
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident/tiles.png,v
retrieving revision 1.1
diff -u -3 -p -r1.1 tiles.png
Binary files /tmp/cvsFAAgmaWdE and tiles.png differ
Index: data/trident/tiles.spec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident/tiles.spec,v
retrieving revision 1.11
diff -u -3 -p -r1.11 tiles.spec
--- data/trident/tiles.spec 2001/01/28 21:21:55 1.11
+++ data/trident/tiles.spec 2003/02/09 13:54:16
@@ -242,6 +242,26 @@ tiles = { "row", "column", "tag"
9, 14, "t.ocean_n1s0e0w0"
9, 15, "t.ocean_n0s0e0w0"
+; Deep ocean, and whether terrain to north, south, east, west
+; is more deep ocean (else shallow ocean)
+
+ 19, 0, "t.shelf_n1s1e1w1"
+ 19, 1, "t.shelf_n0s1e1w1"
+ 19, 2, "t.shelf_n1s1e0w1"
+ 19, 3, "t.shelf_n0s1e0w1"
+ 19, 4, "t.shelf_n1s0e1w1"
+ 19, 5, "t.shelf_n0s0e1w1"
+ 19, 6, "t.shelf_n1s0e0w1"
+ 19, 7, "t.shelf_n0s0e0w1"
+ 19, 8, "t.shelf_n1s1e1w0"
+ 19, 9, "t.shelf_n0s1e1w0"
+ 19, 10, "t.shelf_n1s1e0w0"
+ 19, 11, "t.shelf_n0s1e0w0"
+ 19, 12, "t.shelf_n1s0e1w0"
+ 19, 13, "t.shelf_n0s0e1w0"
+ 19, 14, "t.shelf_n1s0e0w0"
+ 19, 15, "t.shelf_n0s0e0w0"
+
; For hills, forest and mountains don't currently have a full set,
; re-use values but provide for future expansion; current sets
; effectively ignore N/S terrain.
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.106
diff -u -3 -p -r1.106 mapgen.c
--- server/mapgen.c 2003/01/09 02:36:37 1.106
+++ server/mapgen.c 2003/02/09 13:54:17
@@ -782,12 +782,14 @@ static void make_passable(void)
int x;
for (x=0;x<map.xsize;x++) {
- map_set_terrain(x, 2, T_OCEAN);
- if (myrand(100)>50) map_set_terrain(x,1,T_OCEAN);
- if (myrand(100)>50) map_set_terrain(x,3,T_OCEAN);
- map_set_terrain(x, map.ysize-3, T_OCEAN);
- if (myrand(100)>50) map_set_terrain(x,map.ysize-2,T_OCEAN);
- if (myrand(100)>50) map_set_terrain(x,map.ysize-4,T_OCEAN);
+ map_set_terrain(x, 2, myrand(100)>50 ? T_OCEAN : T_SHELF);
+ if (myrand(100)>50) map_set_terrain(x,1, myrand(100)>25 ? T_OCEAN :
T_SHELF);
+ if (myrand(100)>50) map_set_terrain(x,3, myrand(100)>75 ? T_OCEAN :
T_SHELF);
+ map_set_terrain(x, map.ysize-3, myrand(100)>50 ? T_OCEAN : T_SHELF);
+ if (myrand(100)>50) map_set_terrain(x,map.ysize-2,
+ myrand(100)>25 ? T_OCEAN : T_SHELF);
+ if (myrand(100)>50) map_set_terrain(x,map.ysize-4,
+ myrand(100)>75 ? T_OCEAN : T_SHELF);
}
}
@@ -836,7 +838,7 @@ static void make_land(void)
count=0;
whole_map_iterate(x, y) {
if (hmap(x, y) < tres)
- map_set_terrain(x, y, T_OCEAN);
+ map_set_terrain(x, y, hmap(x, y) < tres/2 ? T_OCEAN : T_SHELF);
else {
map_set_terrain(x, y, T_GRASSLAND);
count++;
@@ -886,7 +888,7 @@ static void remove_tiny_islands(void)
{
whole_map_iterate(x, y) {
if (is_tiny_island(x, y)) {
- map_set_terrain(x, y, T_OCEAN);
+ map_set_terrain(x, y, T_SHELF);
map_clear_special(x, y, S_RIVER);
map_set_continent(x, y, NULL, 0);
}
pgpR2KGS4b5BE.pgp
Description: PGP signature
- [Freeciv-Dev] Re: (PR#2957) is ocean as a function with oceanness read from ruleset,
Cameron Morland via RT <=
[Freeciv-Dev] Re: (PR#2957) is ocean as a function with oceanness read from ruleset, kayeats@xxxxxxxxxxxxxxxxxxxxxxxxx via RT, 2003/02/10
|
|