1
0
Fork 0

map: Added star system names and restored fog of war

This commit is contained in:
Michaël Lemaire 2017-05-10 18:49:08 +02:00
parent 658960743b
commit 22c9112b80
7 changed files with 214 additions and 22 deletions

4
TODO
View file

@ -7,6 +7,7 @@
* Character sheet: effective skill is sometimes not updated when upgrading base skill
* Menu: end appear animation when a button is clicked
* Menu: allow to delete cloud saves
* Menu: fix background stars aggregating at right side when the game is not focused
* Add permanent effects to ship models to ease balancing
* Find incentives to move from starting position
* Fix targetting not resetting when using action shortcuts
@ -40,11 +41,8 @@
* AI: allow to play several moves in the same turn (with pauses)
* AI: add combination of random small move and actual maneuver, as producer
* AI: evaluate based on simulated list of effects
* Map: restore fog of war
* Map: add information on current star/location + information on hovered location
* Map: remove jump links that cross the radius of other systems
* Map: disable interaction (zoom, selection) while moving/jumping
* Menu: fix background stars aggregating at right side when the game is not focused
* Add ship personality (with icons to identify ?)
* Tutorial
* Missions/quests system

View file

@ -330,6 +330,138 @@
result="composite2"
id="feComposite7227" />
</filter>
<filter
inkscape:label="Button"
inkscape:menu="Bevels"
inkscape:menu-tooltip="Soft bevel, slightly depressed middle"
style="color-interpolation-filters:sRGB"
id="filter4574-6">
<feGaussianBlur
stdDeviation="2.3"
in="SourceAlpha"
result="result0"
id="feGaussianBlur4548-0" />
<feMorphology
in="SourceAlpha"
radius="6.6"
result="result1"
id="feMorphology4550-6" />
<feGaussianBlur
stdDeviation="26.109999999999999"
in="result1"
id="feGaussianBlur4552-2" />
<feColorMatrix
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.3 0"
result="result91"
id="feColorMatrix4554-6" />
<feComposite
in="result0"
operator="out"
result="result2"
in2="result91"
id="feComposite4556-1" />
<feGaussianBlur
stdDeviation="1.7"
result="result4"
id="feGaussianBlur4558-8" />
<feDiffuseLighting
surfaceScale="10"
id="feDiffuseLighting4562-7">
<feDistantLight
azimuth="179.568345323741"
elevation="45"
id="feDistantLight4560-9" />
</feDiffuseLighting>
<feBlend
in2="SourceGraphic"
mode="multiply"
id="feBlend4564-2" />
<feComposite
in2="SourceAlpha"
operator="in"
result="result3"
id="feComposite4566-0" />
<feSpecularLighting
in="result4"
surfaceScale="5"
specularExponent="17.89999962"
id="feSpecularLighting4570-2">
<feDistantLight
azimuth="180"
elevation="45"
id="feDistantLight4568-3" />
</feSpecularLighting>
<feComposite
in2="result3"
operator="atop"
id="feComposite4572-7" />
</filter>
<filter
id="filter5176"
style="color-interpolation-filters:sRGB"
inkscape:menu-tooltip="Soft bevel, slightly depressed middle"
inkscape:menu="Bevels"
inkscape:label="Button">
<feGaussianBlur
id="feGaussianBlur5150"
result="result0"
in="SourceAlpha"
stdDeviation="2.3" />
<feMorphology
id="feMorphology5152"
result="result1"
radius="6.6"
in="SourceAlpha" />
<feGaussianBlur
id="feGaussianBlur5154"
in="result1"
stdDeviation="26.109999999999999" />
<feColorMatrix
id="feColorMatrix5156"
result="result91"
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.3 0" />
<feComposite
id="feComposite5158"
in2="result91"
result="result2"
operator="out"
in="result0" />
<feGaussianBlur
id="feGaussianBlur5160"
result="result4"
stdDeviation="1.7" />
<feDiffuseLighting
id="feDiffuseLighting5164"
surfaceScale="10">
<feDistantLight
id="feDistantLight5162"
elevation="45"
azimuth="155" />
</feDiffuseLighting>
<feBlend
id="feBlend5166"
mode="multiply"
in2="SourceGraphic" />
<feComposite
id="feComposite5168"
result="result3"
operator="in"
in2="SourceAlpha" />
<feSpecularLighting
id="feSpecularLighting5172"
specularExponent="17.89999962"
surfaceScale="5"
in="result4">
<feDistantLight
id="feDistantLight5170"
elevation="45"
azimuth="155.39568345323741" />
</feSpecularLighting>
<feComposite
id="feComposite5174"
operator="atop"
in2="result3" />
</filter>
</defs>
<sodipodi:namedview
id="base"
@ -338,11 +470,11 @@
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="992.35147"
inkscape:cy="383.97616"
inkscape:zoom="0.70710678"
inkscape:cx="1297.4673"
inkscape:cy="526.92436"
inkscape:document-units="mm"
inkscape:current-layer="layer5"
inkscape:current-layer="layer2"
showgrid="false"
units="px"
inkscape:snap-bbox="false"
@ -700,9 +832,9 @@
id="text4555"
y="25.424089"
x="63.311016"
style="font-style:normal;font-weight:normal;font-size:12.69999981px;line-height:6.61458349px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#1951ae;fill-opacity:1;stroke:none;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
style="font-style:normal;font-weight:normal;font-size:12.69999981px;line-height:6.61458349px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#1951ae;fill-opacity:1;stroke:none;stroke-width:0.26458335px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.69999981px;line-height:7.61000013px;font-family:'DejaVu Serif';-inkscape-font-specification:'DejaVu Serif';fill:#1951ae;fill-opacity:1;stroke-width:0.26458335px;"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.69999981px;line-height:7.61000013px;font-family:'DejaVu Serif';-inkscape-font-specification:'DejaVu Serif';fill:#1951ae;fill-opacity:1;stroke-width:0.26458335px"
y="25.424089"
x="63.311016"
id="tspan4553"
@ -740,13 +872,14 @@
<path
transform="scale(0.26458333)"
id="path4522"
d="M 1832.7266 26.476562 C 1807.4792 26.476559 1787.0117 46.944102 1787.0117 72.191406 L 1787.0117 126.38086 C 1787.0117 151.62816 1807.4792 172.09375 1832.7266 172.09375 C 1857.9739 172.09375 1878.4414 151.62816 1878.4414 126.38086 L 1878.4414 72.191406 C 1878.4414 46.944102 1857.9739 26.476559 1832.7266 26.476562 z "
style="opacity:1;fill:#438f98;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:10.39999962;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4574)" />
d="m 1832.7266,26.476562 c -25.2474,-3e-6 -45.7149,20.46754 -45.7149,45.714844 v 54.189454 c 0,25.2473 20.4675,45.71289 45.7149,45.71289 25.2473,0 45.7148,-20.46559 45.7148,-45.71289 V 72.191406 c 0,-25.247304 -20.4675,-45.714847 -45.7148,-45.714844 z"
style="opacity:1;fill:#438f98;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:10.39999962;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4574)"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="rect4512"
d="m 483.02481,30.166658 v 5.469432 h -5.46843 v 3.767212 h 5.46843 v 5.4684 h 3.76718 v -5.4684 h 5.46942 V 35.63609 h -5.46942 v -5.469432 z"
style="opacity:1;fill:#e2e3b8;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4588)"
style="opacity:1;fill:#e2e3b8;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.40000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4588)"
transform="translate(0,-11.249983)" />
</g>
<g
@ -770,5 +903,26 @@
id="path4531"
transform="translate(0,-11.249983)" />
</g>
<path
inkscape:connector-curvature="0"
id="path4522-5"
d="m 54.85787,-395.43829 c -25.2474,0 -45.7148999,20.46754 -45.7148999,45.71485 v 464.18946 c 0,25.2473 20.4674999,45.71289 45.7148999,45.71289 25.2473,0 45.7148,-20.46559 45.7148,-45.71289 v -464.18946 c 0,-25.24731 -20.4675,-45.71485 -45.7148,-45.71485 z"
style="opacity:1;fill:#30595e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:10.39999962;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4574-6)"
transform="matrix(0,0.26458333,-0.26458333,0,260.7097,257.48498)"
sodipodi:nodetypes="sssssss"
inkscape:export-filename="/home/michael/workspace/perso/spacetac/out/assets/images/map/name.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:12.69999981px;line-height:6.61458302px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#e2e3b8;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="241.3054"
y="275.50311"
id="text5120"><tspan
sodipodi:role="line"
id="tspan5118"
x="241.3054"
y="275.50311"
style="font-size:12.69999981px;fill:#e2e3b8;fill-opacity:1;stroke-width:0.26458332px;">Tartan's Twilight</tspan></text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -100,7 +100,9 @@ module TS.SpaceTac {
// Generate the contents of this star system
generate(random = RandomGenerator.global): void {
var location_count = random.randInt(2, 10);
this.name = random.choice(Star.NAMES_POOL);
if (this.name.length == 0) {
this.name = random.choice(Star.NAMES_POOL);
}
this.generateLocations(location_count, random);
}

View file

@ -88,6 +88,7 @@ module TS.SpaceTac.UI {
this.loadImage("map/current-location.png");
this.loadImage("map/zoom-in.png");
this.loadImage("map/zoom-out.png");
this.loadImage("map/name.png");
this.loadImage("map/button-jump.png");
this.loadImage("map/location-star.png");
this.loadImage("map/location-planet.png");

View file

@ -1,12 +1,13 @@
module TS.SpaceTac.UI {
// Group to display a star system
export class StarSystemDisplay extends Phaser.Image {
view: UniverseMapView;
circles: Phaser.Group;
starsystem: Star;
player: Player;
fleet_display: FleetDisplay;
locations: [StarLocation, Phaser.Image, Phaser.Image][] = [];
view: UniverseMapView
circles: Phaser.Group
starsystem: Star
player: Player
fleet_display: FleetDisplay
locations: [StarLocation, Phaser.Image, Phaser.Image][] = []
label: Phaser.Image
constructor(parent: UniverseMapView, starsystem: Star) {
super(parent.game, starsystem.x, starsystem.y, "map-starsystem-background");
@ -70,6 +71,14 @@ module TS.SpaceTac.UI {
this.locations.push([location, location_sprite, status_badge]);
}
});
// Show name
this.label = new Phaser.Image(this.game, 0, 460, "map-name");
this.label.anchor.set(0.5, 0.5);
let label_content = new Phaser.Text(this.game, 0, 0, this.starsystem.name, { align: "center", font: `32pt Arial`, fill: "#e2e3b8" })
label_content.anchor.set(0.5, 0.5);
this.label.addChild(label_content);
this.addChild(this.label);
}
addImage(x: number, y: number, key: string, onclick: Function | null = null): Phaser.Image {
@ -116,7 +125,22 @@ module TS.SpaceTac.UI {
// LOD
let detailed = focus && level == 2;
this.children.forEach(child => this.view.animations.setVisible(child, detailed, 300));
this.children.filter(child => child !== this.label).forEach(child => this.view.animations.setVisible(child, detailed, 300));
this.updateLabel(level);
}
/**
* Update label position and scaling
*/
updateLabel(zoom: number) {
this.label.visible = this.player.hasVisitedSystem(this.starsystem);
let factor = (zoom == 2) ? 1 : (zoom == 1 ? 5 : 15);
this.view.tweens.create(this.label.scale).to({ x: factor, y: factor }, 500, Phaser.Easing.Cubic.InOut).start();
let position = (zoom == 2) ? { x: -460, y: 460 } : { x: 0, y: 100 * factor };
this.view.tweens.create(this.label.position).to(position, 500, Phaser.Easing.Cubic.InOut).start();
}
}
}

View file

@ -63,6 +63,7 @@ module TS.SpaceTac.UI {
result.moveTo(starlink.first.x - 0.5 + loc1.x, starlink.first.y - 0.5 + loc1.y);
result.lineTo(starlink.second.x - 0.5 + loc2.x, starlink.second.y - 0.5 + loc2.y);
}
result.data.link = starlink;
return result;
});
this.starlinks.forEach(starlink => this.layer_universe.add(starlink));
@ -100,7 +101,7 @@ module TS.SpaceTac.UI {
this.gameui.audio.startMusic("walking-along");
// Inputs
this.inputs.bindCheat("r", "Reveal whole map", this.revealAll);
this.inputs.bindCheat("r", "Reveal whole map", () => this.revealAll());
this.setZoom(2);
@ -118,12 +119,24 @@ module TS.SpaceTac.UI {
super.shutdown();
}
/**
* Refresh the view
*/
refresh() {
this.setZoom(this.zoom);
}
/**
* Update info on all star systems (fog of war, available data...)
*/
updateInfo(current_star: Star | null) {
this.current_location.setZoom(this.zoom);
this.starlinks.forEach(linkgraphics => {
let link = <StarLink>linkgraphics.data.link;
linkgraphics.visible = this.player.hasVisitedSystem(link.first) || this.player.hasVisitedSystem(link.second);
})
this.starsystems.forEach(system => system.updateInfo(this.zoom, system.starsystem == current_star));
let location = this.player.fleet.location;
@ -146,7 +159,7 @@ module TS.SpaceTac.UI {
this.player.setVisited(location);
});
});
// TODO Redraw
this.refresh();
}
/**