In-game Map with player location tracking?

I’ve recently had some ideas for some potential mechanics/features I might use for future games.

My current project (The Battle of Hoag’s Object) has a pretty decent framework for an “Open-World” navigation system, and it works well enough for a space-exploration game… but it’d be a little too clunky for something more terrestrial.

So, I think it’d be a neat idea to have an actual map in the stats screen that updates with the player’s/reader’s location, as well as reveals different locations as you discover them.

I’m curious if anyone has taken any stabs at this, I mean it’s not the most original idea for games in general, but it’d be very tricky to pull off in a choice script game.

I have an inkling of how I might make such a system, but getting inspiration from those who’ve already done it or something close would help give me a boost, I think.

Here’s my current plan/thinking behind this:

Player Navigation and Map Updating

So I’m thinking there will be a scene dedicated to moving around/exploring the map.

I want to keep it relatively simple, so I’m thinking I’ll have options to move in your standard Cardinal Directions; North, East, South, or West. Maybe diagonals too but that could get complicated so, baby steps.

To match this, the locations on the map will be on a simple grid pattern. So, you move north, there’s a cave. South, a town. East or west, two other landmarks or something.

I’m thinking there will also be a fast-travel option on top of the cardinal directions, so you can “teleport” to any place you’ve already been instead of having to step-by-step cross a whole continent.

To track the player’s location on the map, I’ll first need a different picture of the map, featuring the player’s blip of sprite or what-have-you on every possible location you can be on.

I’ll need to use *if statements to activate whichever picture shows the player’s current location while hiding all the rest.

I plan on organizing this using a coordinate system. So, there will be two player location variables. One for X and one for Y. If a player moves North, it’ll be:

*set playerloc_y +1

If they move south?

*set playerloc_y - 1

East or West would be playerloc_x + or - 1.

Then, in the stats scene we’ll have this:

*if ((playerloc_y = 0) and (playerloc_x = 1))
 *image maps/Y0X1.JPG
 *comment This will display a map with the player’s blip at Y = 0 X = 1 coordinates (I know the x is supposed to come first but I already typed Y first for this whole thing and I’m too lazy to change it now)

Depending on the map’s size… this could be a very long chunk of the Stats scene… but it gets much, much longer if I attempt the next part:

Map Exploration/Hidden Locations

Here’s where the *if statements start getting out of control. Ideally I would want the locations on the map to be hidden until the player discovers them, because hey, it’s more fun to watch an empty map fill in with unexpected and exciting places instead of starting off with a filled map where you already know what you’ll find at the next location.

At first glance, I just need to do the same thing as with the player location tracking: a bunch of *if statements and corresponding images for every location the player can find, right?

But wait… the player can discover the locations in any order they choose… meaning I would need a new map, not just for every location, but for every possible order of locations the player might traverse, so that the map reveals the places the player has been in the same order.

On top of that (which, is honestly an already terrifying task) I still need to keep the player’s location updating… so now I need a new image of the map to feature every possible order of discovered locations that also accounts for every possible current player location at the same time.

We’re talking about potentially a thousand different images for a comparatively small amount of locations (I haven’t done the actual math on this but, I know for a fact it’ll be a ridiculous amount).

I can’t see any other way to do this in choice script which makes me sad because, it just isn’t practical for one person to attempt. My only hope for hidden/revealable locations on a dynamic map is if someone figured out a better system, which from what I know about choice script, I don’t think exists.

Maybe I could break it up into chunks… a smaller set of maps for separate “biomes” or nation borders or something? That could help keep the possible-discovered-location-order on a more manageable scale, maybe.

Anyways I’m going to try to get a proof-of-concept up eventually with maybe a map of 9 locations on a basic grid. No idea if I’m going to attempt the revealable locations, even with such a small map. If it isn’t feasible for a larger map, there’s not much of a point to doing the work on a smaller scale.

2 Likes

I have made a mini labyrinth inside my game, but it has no graphics. And now that I read this, you made me remember that I was going to be creating a map for the game too, I’d just didn’t put my hands on it yet.

Here is a post of someone that for sure knows how to bring your idea to life. I’ll have to sit down and start trying to see if I can get something like that to work, but I’m not that skilled with programming, yet.

Also, here’s the 3d version of it (I helped with the graphics on that one) Maybe you can learn from the code, that’s where the real magic is.

6 Likes

That is really cool, and pretty similar to what I’m trying to do, it seems.

Looks like they used a custom program to do a lot of the work for them, which would be great if I had any clue how to do that haha. I don’t have any experience with coding languages and programming outside of choicescript. And I’m not sure I have the time to learn one to accomplish the same thing.

It’s definitely a neat thing to see in action, though!

2 Likes

Yes, I didn’t thought it was possible until I saw it done. The problem with it as you said is that there’s extra choicescript code that wouldn’t work if you want to publish your game through HG or CoG.

The labyrinth I made for my game though is only cs code, it’s simple and it has no graphics, but out of the top of my head I guess that it could be added. As for leaving a trail of explored coordinates, I think that it would complicate the things a little bit more than I would like to, still doable but harder to achieve. (I coded that almost at the beginning, a long time ago when I didn’t even knew much, so there’s nothing special about it)

As for the actual image of the map, I guess that it’ll be one for each location the player can move, as you wouldn’t be able to cut it into pieces as those labyrinth work only using cs code. And the rest is a *if list with a set of coordinates.

I’ve also created a game dice within the game that works only with cs code. It’s different, but to determine the winner and ties the code actually resembles a little bit (Actually there’s not much difference cause there aren’t much commands beside of variables and *if, so you have to get creative with only that.)

2 Likes

Exactly. Having either just a player-tracker or a location trail is somewhat doable… though the player tracking is much easier than the latter.

Combining them however, is just impractical within choicescript alone, because you can only use one image at a time, and you’d need many many images to deal with all the possible combinations of player-location AND trail-tracking all at the same time.

It’s not impossible, it’s very much within the limits of choice script, I mean there is a lot of things you can do provided with enough *if statements.

The issue is it’s just SO much you have to manually account for that it becomes insurmountable.

4 Likes

Maybe yes, or maybe you can divide the map into areas and assign that area to a certain part of a number and try to make things in blocks, like a decoder thing or something like that. I don’t know if that would complicate things even further or simplify them as you would resolve the comparisons in smaller blocks.

I guess that the better way would be to start small with a 2x2 or 3x3 and see if it works and scale it up from there. It’s only a matter of being creative with the code and just try it out.

I didn’t even knew if it was possible to make the code I made for my game, I just tried and found an error and resolved it and repeat until it came out.

1 Like

That’s my thinking as well. Dividing the map into smaller segments is one way to keep it more manageable. But we shall see. I’ll be sharing my code on here in any case!

1 Like

Hi there. Your plan is doable, but choicescript makes it very hard (no arrays, to start). I ended up writing many custom tools to help me generate the code. Also, to render the map of the maze, which is a grid of small tiles, I had to hack the page style with some JavaScript (which will prevent you from publishing your game).

I had fun creating the maze with @Loudbeat , it was an interesting experiment, but I would warn you: writing a large engine, and the interface, in choicescript will be very hard. The code to show the map maze (which tracks how far you discovered) is very sophisticated and in part computer-generated.

I’m traveling now, but I’ll be happy to give you more details if you want to pursue this project.

3 Likes

Hi! Your maze project is very cool! I wish I had seen it sooner. The multiplayer element is very clever. I think I’ve seen someone on here trying a similar thing not too long ago; using a third party server to track the actions of two people.

I won’t need to worry about rendering, as my map will be static and won’t involve any random generation (though that would add a bit of replay value, I don’t think it’d be worth it in my case).

But yeah, as you say, without access to arrays it is a pretty daunting thing to achieve through choicescript alone. I may just scrap the trail-tracing part altogether. It wouldn’t be a devastating loss. But I’m going to try for it on a small scale first, at least.

1 Like

I thought you wanted to show an image with your position, the area that was explored already etc.
I experimented with precomputed images, but the number of cases grows exponentially with the features you want in the map. What did you have in mind exactly?

If you use GitHub, I can share some code examples.

My intention is to do it the “hard” way. I don’t plan on using software to generate a map and locations for me: I’m doing it myself.

The hard way will be very hard! Good luck!

2 Likes

Definitely doable I think with the variables you’re suggesting. If there are a lot of locations though this is going to be tedious to set up so I guess it depends how worth it you think it’ll be to have the visual representation. (I have a series of images to represent the placement of some items in a circle chosen by the player on the stats page in Raishall which could have quite a few combinations and it got pretty long just to set this up. Part of the text for this (there’s a lot more!) which is a similar concept to what you’re wanting to do I think.)

Just be careful with your image size if you’re going to have a lot. Make them small or leave a note on the store page about its seize if it causes the game size to increase a lot from normal. People tend to assume these games will be quite small and one of the games did get grumpy reviews due to its size. (They didn’t compress the images down causing it.)

2 Likes

its a shame you can use only one picture in the stats (from what i gathered from the discussion), it woulve been so easy to turn maps into tiles and just change whatever one you need🤔

im writing further as a player so maybe it wont make sence. depending on where map comes from in the game there are ways around too many images by implementing journals imo, if its something that player finds/downloads then we can have “notes” about locations and use map as a general idea where we should go. if the character is one writing maps then maybe create certain conditions where you can update it
or place only locations important for the story ?
i dont know how exactly you want to use maps in the gameplay so maybe these ideas are trash, well i tried to help anw🙆‍♀️

1 Like

I believe you can have as many images as you want in your stats: the stats page is simply a scene with a specific filename. So, yes, I believe you could create a map out of multiple tiles in the stats page.

2 Likes

ah so then we can have checks for tile “if player is on the tile or visited then x else y”
if we want to trace routes then maybe we can have x-axis and y-axis lines and apply them based on the last movement, which creates the problems with corners and possible overrides and too much lines tho, no?

This is so cool. I’d love to implement something like this for the moments in my game where players are traveling. Thanks for posting the code threads!

1 Like

@usr_554 the code gets complicated, but it’s possible. See again here:

https://dashingdon.com/play/sciscidiego/randomized-maze/mygame/

The game tracks what you visited and can show it. Note that all code is CS (except some *script for the graphics) but it’s in part generated with some custom tools - the code in the scenes can be hard to read due to this.