To map or not to map...

OurJud
Played a couple of games on here recently that use the real-time tracking map, and somewhat worryingly I've been struck by how much it adds to my enjoyment of playing. Doubtless this is because it makes retracing one's steps simplicity itself, and eliminates the 'hopelessly lost' factor that can plague so many open-ended games.

However, being as I'm so anal about the way things look, I couldn't bring myself to go with the default styling, and was wondering if something like the attached image is feasible?

I already have my game looking as you see here (without the map, of course) so I would just need to know if the map's appearance and positioning is achievable.

gamemap.jpg

XanMag
I have no idea if the attached image is feasible or not, but personally, I don't like auto generation of maps. So, the player can find a map of the entire compound that they can view. This question is a great one for Jay. He's done some good stuff with maps. Too bad he's MIA. :cry:

OurJud
XanMag wrote:So, the player can find a map of the entire compound that they can view.

No, the map is drawn in real-time, as the player moves about, meaning they can only see where they've been, not where they're going.

Marzipan
I don't like the auto created maps because they're ugly.

The mock up you have there is less ugly so I'd be okay with it.
Answering your actual question's a little over my head so, that's all the input I'm able to give on this one. You're welcome. :)

OurJud
Marzipan wrote:I don't like the auto created maps because they're ugly.

Precisely my thoughts, which is why I'd never use one unless I could achieve something like the mock-up.

Cyllya
I can't figure out a way to make it look exactly like that. It will get pretty close if you set each room to have a length of 1, width of 1, fill color gray, border color gray, and no label. Then make the exits all have a size of 2.

BUT the main problem is that it doesn't seem to have an option to set the color of the exits (lines between rooms), and they are set to be black, which makes them completely invisible against your black background. It's also positioned above the play area (instead of to the side) and the player is always represented by a yellow circle.

I notice the map check box on the Features page says "functions for custom drawing," so maybe there is a way to program the map in differently, just no with the obvious/easy ways.

OurJud
Cyllya wrote:I can't figure out a way to make it look exactly like that. It will get pretty close if you set each room to have a length of 1, width of 1, fill color gray, border color gray, and no label. Then make the exits all have a size of 2.

BUT the main problem is that it doesn't seem to have an option to set the color of the exits (lines between rooms), and they are set to be black, which makes them completely invisible against your black background. It's also positioned above the play area (instead of to the side) and the player is always represented by a yellow circle.

I notice the map check box on the Features page says "functions for custom drawing," so maybe there is a way to program the map in differently, just no with the obvious/easy ways.

Thanks, Cyllya. To be perfectly honest, I've never even looked at the map options, so don't even know what my starting point would be. I didn't even realise it was a default feature, and presumed it was some kind of hack that someone had built.

I'll take a look.

[EDIT] So using a map is as simple as selecting it in the features tab... never knew that.

However, a couple of things. When I tried enabling it on a test game of mine, the map didn't work. It loads with this list:

Error running script: Error compiling expression '(room.parent.grid_width - room.grid_width) /2.0': ArithmeticElement: Operation 'Subtract' is not defined for types 'Object' and 'Int32'
Error running script: Error compiling expression '(room.parent.grid_width - room.grid_width) /2.0': ArithmeticElement: Operation 'Subtract' is not defined for types 'Object' and 'Int32'
Error running script: Error compiling expression 'room.grid_render': RootExpressionElement: Cannot convert type 'Object' to expression result of 'Boolean'

And then when I move it doesn't track the player.

If using a map means you have to do everything 'by the book' in terms of scripts, etc, then I don't think I'll bother.

OurJud
Okay, forget all the above.

I just tried the map on my latest game and it worked fine.

One thing, though, I can't find the map custom options. The only reference is for grid size on the 'display tab'.

Cyllya
Each room has its own "Map" tab. The length, width, color, and border color of each room can be set there.

The "size" of each exit (length of the line between rooms) is set on the Map tab of the exit.

OurJud
Cyllya wrote:Each room has its own "Map" tab. The length, width, color, and border color of each room can be set there.

The "size" of each exit (length of the line between rooms) is set on the Map tab of the exit.

Right. Thanks muchly.

jaynabonne
Here's an example of how to do the map styling (attached and inline below). There are a few things to note:

1) The InitUserInterface function sets the background color for the grid/map canvas to black.
2) I imported the base "defaultobject" type into the game, so that I could set the default grid variables. That saves having to set them for every room.
3) I imported the Grid_DrawLine and Grid_DrawPlayerInRoom functions into the game, so that I could override the hard-coded colors they use. (#202020 for grid fill, #101010 for grid border, and #7f7f7f for the player circle - based on the colors I could "pick" in the image you posted. The player circle is also expanded to 8 instead of 2, to fill the room box a bit more.)
4) The rest of the game is just rooms.

With that in place, you should be able to just create rooms as normal. (Perhaps this should be moved into a library and allow the colors to be customized!)

<!--Saved by Quest 5.6.5783.24153-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<function name="InitUserInterface">
JS.eval ("$('#gridCanvas').css('background-color','black');")
</function>
<game name="mapstyle">
<gameid>085affcd-6ccb-4898-a594-7b77670699e0</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<gridmap />

</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<exit alias="west" to="w1">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="e1">
<inherit name="eastdirection" />
</exit>
<exit alias="north" to="n1">
<inherit name="northdirection" />
</exit>
<exit alias="south" to="s1">
<inherit name="southdirection" />
</exit>
</object>
<object name="e1">
<inherit name="editor_room" />
<exit alias="west" to="room">
<inherit name="westdirection" />
</exit>
</object>
<object name="n1">
<inherit name="editor_room" />
<exit alias="south" to="room">
<inherit name="southdirection" />
</exit>
<exit alias="north" to="n2">
<inherit name="northdirection" />
</exit>
</object>
<object name="w1">
<inherit name="editor_room" />
<exit alias="east" to="room">
<inherit name="eastdirection" />
</exit>
<exit alias="south" to="s2">
<inherit name="southdirection" />
</exit>
</object>
<object name="s1">
<inherit name="editor_room" />
<exit alias="north" to="room">
<inherit name="northdirection" />
</exit>
</object>
<object name="n2">
<inherit name="editor_room" />
<exit alias="south" to="n1">
<inherit name="southdirection" />
</exit>
<exit alias="east" to="e2">
<inherit name="eastdirection" />
</exit>
</object>
<object name="e2">
<inherit name="editor_room" />
<exit alias="west" to="n2">
<inherit name="westdirection" />
</exit>
</object>
<object name="s2">
<inherit name="editor_room" />
<exit alias="north" to="w1">
<inherit name="northdirection" />
</exit>
</object>
<type name="defaultobject">
<visible />
<displayverbs type="stringlist">
<value>Look at</value>
<value>Take</value>
</displayverbs>
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
<value>Drop</value>
</inventoryverbs>
<take type="boolean">false</take>
<use type="boolean">false</use>
<givesingle type="boolean">false</givesingle>
<drop />
<gender>it</gender>
<article>it</article>
<isopen type="boolean">false</isopen>
<open type="boolean">false</open>
<close type="boolean">false</close>
<container type="boolean">false</container>
<descprefix>You are in</descprefix>
<objectslistprefix>You can see</objectslistprefix>
<exitslistprefix>You can go</exitslistprefix>
<contentsprefix>containing</contentsprefix>
<description type="string"></description>
<scenery type="boolean">false</scenery>
<hidechildren type="boolean">false</hidechildren>
<listchildren type="boolean">false</listchildren>
<usedefaultprefix />
<volume type="int">0</volume>
<dark type="boolean">false</dark>
<lightstrength type="string"></lightstrength>
<darklevel type="boolean">false</darklevel>
<attr name="grid_width" type="int">1</attr>
<attr name="grid_length" type="int">1</attr>
<attr name="grid_fill">#202020</attr>
<attr name="grid_border">#101010</attr>
<attr name="grid_bordersides" type="int">15</attr>
<attr name="grid_render" type="boolean">false</attr>
<attr name="grid_label" type="string"></attr>
<grid_parent_offset_auto />
<attr name="grid_parent_offset_x" type="int">0</attr>
<attr name="grid_parent_offset_y" type="int">0</attr>
<attr name="pov_alias">me</attr>
<pov_alt type="stringlist">
<value>myself</value>
<value>self</value>
</pov_alt>
<attr name="pov_look">Looking good.</attr>
<attr name="pov_gender">you</attr>
<attr name="pov_article">yourself</attr>
<attr name="feature_usegive" type="boolean">false</attr>
<attr name="feature_container" type="boolean">false</attr>
<attr name="feature_switchable" type="boolean">false</attr>
<attr name="feature_edible" type="boolean">false</attr>
<attr name="feature_player" type="boolean">false</attr>
<attr name="feature_lightdark" type="boolean">false</attr>
<changedparent type="script">
if (game.pov = this) {
if (IsDefined("oldvalue")) {
OnEnterRoom (oldvalue)
}
else {
OnEnterRoom (null)
}
if (game.gridmap) {
MergePOVCoordinates
}
}
</changedparent>
<changedisopen type="script">
if (this.isopen and HasScript(this, "onopen")) {
do (this, "onopen")
}
if (not this.isopen and HasScript(this, "onclose")) {
do (this, "onclose")
}
</changedisopen>
<changedlocked type="script">
if (this.locked and HasScript(this, "onlock")) {
do (this, "onlock")
}
if (not this.locked and HasScript(this, "onunlock")) {
do (this, "onunlock")
}
</changedlocked>
<changedswitchedon type="script">
if (this.switchedon and HasScript(this, "onswitchon")) {
do (this, "onswitchon")
}
if (not this.switchedon and HasScript(this, "onswitchoff")) {
do (this, "onswitchoff")
}
</changedswitchedon>
</type>
<function name="Grid_DrawLine" parameters="x1, y1, x2, y2, border, borderWidth">
JS.Grid_DrawLine (x1, y1, x2, y2, "#4f4f4f", 3)
</function>
<function name="Grid_DrawPlayerInRoom" parameters="room">
if (room.grid_render) {
Grid_DrawRoom (room, false, game.pov)

player_x = Grid_GetGridCoordinateForPlayer(game.pov, room, "x") + room.grid_width/2.0
player_y = Grid_GetGridCoordinateForPlayer(game.pov, room, "y") + room.grid_length/2.0
player_z = Grid_GetGridCoordinateForPlayer(game.pov, room, "z")

// Grid_DrawPlayer(x, y, z, radius, border, borderWidth, fill)
JS.Grid_DrawPlayer(player_x, player_y, player_z, 8, "black", 2, "#7f7f7f")
}
</function>
</asl>

OurJud
No idea what I'm doing. I downloaded the file, went to libraries, clicked add, found the file, did the save / reload thing, but when I try to open the game I get an error telling me the mapstyle is not a library and that my game already contains the file?

And now I have a problem, in that I can't open the game for editing because of this error?

jaynabonne
The file I attached was a standalone game file as an example. It's not a library!

If your game won't open, you should be able to edit it with a text editor and remove the include at the top for mapstyle.

OurJud
Yes, thank you. Done this now.

I'm afriad, however, that I don't know what to do with the code you've supplied. I know I need to incorporate it into my own game code, but which parts and where, I'm lost.

Pykrete
From the looks of it, it's all in the Functions - Jay's made replacements for InitUserInterface, Grid_DrawLine and Grid_DrawPlayerInRoom.

However, if I try to make these functions myself, the application tells me off for trying to make Functions with existing names. How'd you manage that, then? Was it by inserting them in the Code View?

jaynabonne
You can either insert them in Code View (which is easiest for me), or you can click the Filter button in the bottom left (under the object pane) and select "Show Library Elements". Then search in the Functions section for the desired functions you wish to modify, select the function name and then click the "Copy" button at the top right of the screen. That will make an editable copy in your game.

jaynabonne
OurJud wrote:Yes, thank you. Done this now.

I'm afriad, however, that I don't know what to do with the code you've supplied. I know I need to incorporate it into my own game code, but which parts and where, I'm lost.


If (when you're back up and running) you still need help with this, let me know!

OurJud
Well I am up and running again, but there's no mad rush. My game's nowhere near finished and I'm not alltogether sure I'll end up using one anyway.

I was just interested (and still am) in seeing if my imaginings were doable.

Pykrete
Cheers for the response, Jay. Had no idea that filter button even existed; probably going to save me a lot of headache from now on!

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums