Closed matthewjwhite closed 3 years ago
A grid-based platform seems too simplistic, ie. a square grid representing the entire world where each region/map is a square within that grid.
One possibility I have been toying with is:
For example, consider the WesternDungeon
region/map:
500
units wide, 300
units tall.(20, 20)
there could be a rare item, and at (70, 30)
an NPC to purchase spellbooks.(500, 20)
to (500, 50)
there could be a connecting point to another region, and at (70, 60)
a teleportation point to another world.With the above example, some regions could even be tunnels to other regions, as opposed to primary regions themselves.
As a side note, it seems too restrictive to place monsters at specific points in regions. I feel that this should be a randomly generated aspect of the game.
To maintain the user's current position, all that would need to be restored is the current region and relative position in that region.
Example configuration file format:
---
# westernDungeon.yaml
name: westernDungeon
width: 500
height: 300
keyPoints:
- type: npc
x: 70
y: 30
- type: item
x: 20
y: 20
exitRanges:
- dest: easternDungeon # Eastern edge of Western Dungeon.
xLow: 500
xHigh: 500
yLow: 20
yHigh: 50
- dest: anotherWorld # Teleportation point.
xLow: 70
xHigh: 70
yLow: 60
yHigh: 60
monsters:
- hellHounds
- massiveBugs
TL;DR:
The configuration file approach lends to the maximum configurability of this game. In other words, a server administrator should be able to tweak the game as they wish by simply adjusting configuration files.
After giving it further thought, I think the idea of only having regions aware of their neighboring exit points/maps, as opposed to having a single, main grid that controls everything, is too complex.
Some of the major pitfalls:
Overall, having a single controller map is going to make things easier.
The new proposal is:
It's important to note that the idea of a controller map only matters when you're moving, to determine if you're entering a neighboring region and where you end up in that neighboring region. So, when moving, we need to invoke a relative -> absolute converter, to determine if we're: 1) breaching a boundary, and 2) where in the new map we are.
I think there are basically 3 pieces to implement here:
I think it would be something like this;
WestDungeon
, (5, 5)
(relative point).X
or Y
coordinates equal to the height or width of the current map? If not, no need to involve the controller map, simply advance within the relative dimensions of the current map. if so, continue.200
(relative X
range of 0
to 199
), height 50
(relative Y
range of 0
to 49
), xMin
0
, yMin
0
. Traveling east, next relative point is (200, 40)
. The relative height is equal to the max height, so breach. There is a neighboring map with xMin
200
, yMin
20
, with a width of 300
and height
of 200
.xMin
(from controller) and xNext
, same for Y
. Ex. xMin
0
+ 200
= 200
, yMin
0
+ 40
= (200, 40)
.xMin
and yMin
less than or equal to the controller location.xMin
to the next relative X
and subtract the new map's xMin
, ex. 0
+ 200
- 200
= 0
. Same for Y
, ex. 0
+ 40
- 20
= 20
.name: westernDungeon
width: 500
height: 300
keyPoints:
- type: npc
x: 70
y: 30
- type: item
x: 20
y: 20
monsters:
- hellHounds
- massiveBugs
name: easternDungeon
width: 200
height: 200
monsters:
- hellHounds
- map: westernDungeon
xMin: 0
yMin: 0
- map: easternDungeon
xMin: 500
yMin: 30
Notice no xMax
or yMax
- these can be inferred from the respective maps' dimensions; unfortunately, this requires careful coordination between the map definitions and controller, to ensure the width
and height
match up with the xMin
and yMin
of neighboring maps. Another option would be to not store any dimensions in the respective map definitions, and store the height
and width
in the controller, so it's all in one place.
A few things to note in beginning implementation:
nextX
/Y
against 0
, in addition to the height and width of the map in case you're going back or down instead of up or forward.Other interesting things being added/caught:
Config
objects (thus resulting in a reload of the same data - changes mid-execution aren't supported) when referencing from multiple code files.User
references a Map
for its location - rather than the User
object holding a map_name
, just point to the Map
parsed from the config (obviously we're not dealing with actual pointers directly, but Python won't recreate the object if we assign object to a User
instance variable, it'll just assign the address).Went with a way simpler approach of finding the map you're moving into by checking for the map that has that point in its space (see Dim::contains
). The other way was too complex and seemed to be fraught with unknown boundary cases.
What?
Exploration in this case refers to the navigation of land masses in the overall world,
A way to represent these land masses (cities, towns, dungeons, etc.) is required.
The goal here is to implement (at least) the initial exploration design/map system.
To Close