Author Topic: map with complex numbers  (Read 15288 times)

tuturto

  • Rogueliker
  • ***
  • Posts: 259
  • Karma: +0/-0
    • View Profile
    • pyherc
map with complex numbers
« on: November 24, 2015, 11:02:08 AM »
I was playing with ideas and started thinking of having a world where coordinates wouldn't be integers "(x, y)", but complex numbers "(x+ai, y+bi)" . Technically this should be pretty easy thing to do, but design-wise I'm in a loss. What would that kind of world even look like and how would moving and such handled? Easiest probably would be if actions would mostly be on the real part and in some special circumstances imaginary component would come into play. There could be creatures that can move in imaginary part and sometimes come through to real world. Or there could be warp rifts here and there that would allow moving in imaginary direction. With correct tools or potions, player could have access to imaginary world, or could at least sense what is happening near him in that direction. Or maybe that imaginary space could represent alternate worlds, that would be close to real one, but different in some aspect. The further you are from the real world, the more different the world would be.

But like I said, this is currently just an idea and a very vague one even. Feel free to throw me even the craziest ideas regarding to this, maybe it will push me over to actually take this in use.
Everyone you will ever meet knows something you don't.
 - Bill Nye

Cfyz

  • Rogueliker
  • ***
  • Posts: 194
  • Karma: +0/-0
    • View Profile
    • Email
Re: map with complex numbers
« Reply #1 on: November 24, 2015, 12:08:20 PM »
This sounds more like a multidimensional world rather than complex-numbered space. A complex number is basically one dimension above real, so it is just going from two dimensions (real x, real y) to four (real x, imaginary x, real y, imaginary y). I think a whole four dimensions would be a bit too much.

Funny (and somewhat ironic) thing there is already extra dimension, represented by altitude. Some creatures can move there and some can not. With correct tools or potions player can have access to this dimension and rifts in floor let you travel this dimension without any warp. It is ironic because a lot of people (me too) regularily entertain the idea of an additional dimension while willingly discarding the most intuitive variant.

tuturto

  • Rogueliker
  • ***
  • Posts: 259
  • Karma: +0/-0
    • View Profile
    • pyherc
Re: map with complex numbers
« Reply #2 on: November 25, 2015, 07:59:24 AM »
Fair point with the altitude. Altitude is something that is visible all the time though, and I was thinking more of a hidden realm, with strange items and creatures. 4 dimensions would be a bit much to move in, true. It would probably be quite disorienting and cumbersome. Moving on a 2d-plane is easy with cursor keys or mouse, moving in 4-dimensional space not so much I guess.) But it sure would be grand to come across a deep chasm and actually see it continue deep down in the bowels of earth.

(Big reason for not having real altitude is that I'm terrible with graphics and thus using premade tiles that are top down. Having real altitude would be pain with those, forcing player to cycle from z-level to another. Isometric or even 3d-graphics would help with this, but I think it's beyond me at the time being.)
Everyone you will ever meet knows something you don't.
 - Bill Nye

mekaerwin

  • Newcomer
  • Posts: 15
  • Karma: +1/-0
    • View Profile
    • Email
Re: map with complex numbers
« Reply #3 on: November 30, 2015, 06:23:06 PM »
The problem (I think) with imaginary space (assuming it's like 4d) is that each spot in real space (x, y, z) would have a whole set of separate coordinates you could travel through in the 4th dimension. On a linear scale, each x has one location, on a grid each x has y locations, in 3d each x has y*z locations. In 4d each x has y*z*? locations. This could really increase your map size and storage (as well as generation) requirements (pathfinding would be doable, but abstract to think about). Not sure if what I'm talking about is exactly what you were suggesting.

One way I would implement another dimension would be to keep it separate from the current, but related in an unusual way.

Perhaps rotate it. When the player moves between, take the angle from the center of map and distance, rotate it a set amount and round for the nearest grid location.

You could instead have the world offset from the original by a set x and/or y amount and wrap the edges.

Mirror the coordinates (the whole world on the other side of the flat world we live in).

Another option is to have the scale be different. 1 grid in real world equals 2 (or .5) in the other (pretty sure Minecraft did this). This opens the option of changing dimensions to speed up travel. It also allow enemies that if you stay in your dimension can catch up to you in their's then switch over to yours to attack. If you jump into their dimension you could then outrun them.

You could potentially adjust the way the world interfaces over time or when certain events occur. Change the angle of the offset in the first example or the amount of x and y offset in the second (essentially making the world scroll. Not sure you would want to change the scale since that seems complicated to keep there from being places that don't map anymore. If you change the way it interfaces over time then you make it where a short trip and return into the other dimension keeps you in relatively the same area but longer trips make it more and more uncertain what trouble you could land in when you return.

For npc pathfinding you would simply transpose the coordinates of the destination in the other dimension into their dimension and they would path towards it in their dimension. IE the same way you would move the player from one to another, just not actually moving anything.

Finally you could combine some or all of these to create something that would really seem to connect the worlds in a mysterious (confusing) but related way. I guess the goal of what I'm getting at is that they would appear related in a way that could be utilized by the player and/or npcs (if not using many it is more useful to player) or mysteriously connected but hard (impossible) to predict (if using many of the above, more useful to npc).

Another slightly different idea would be to treat them like a z dimension where each dimension must be reached through a previous dimension but each relates to the other in different ways, and/or with progressive differences like you mentioned (more and more strange things in them). Or just skip to any dimension you like.

All of these are just ideas that could be mixed and matched. May not work well all together. Some may be bad. Maybe what you were looking for. Maybe completely misunderstanding you. Hope to hear what you think.
« Last Edit: November 30, 2015, 06:56:13 PM by mekaerwin »

Cfyz

  • Rogueliker
  • ***
  • Posts: 194
  • Karma: +0/-0
    • View Profile
    • Email
Re: map with complex numbers
« Reply #4 on: November 30, 2015, 06:50:09 PM »
In my opinion, complex (pun intended) world geometry will only confuse the player, unless it is the core aspect of the game.

I think of extra 'dimensions' as of a continuous attribute of game mechanics. For example, 'presence' that can be tuned down and up, adjusting amount of attention from other inhabitants and the world itself. Less presence will mean you are harder to notice up to actually passing through walls but at the same time in-game odds (loot, hidden objects, combat chances) will be significantly less in your favor. Kind of probability axis you can travel. Though these dimensionified game aspects must always be balanced hard with pros and cons or else they will become another potion/spell-like mechanic.

mekaerwin

  • Newcomer
  • Posts: 15
  • Karma: +1/-0
    • View Profile
    • Email
Re: map with complex numbers
« Reply #5 on: November 30, 2015, 07:11:13 PM »
@Cfyz Hmm, never thought of that way of representing it. My description is certainly more of a physical representation of a nonphysical idea. I think yours probably captures the idea of a different dimension (ie not physical) while still existing in the physical much better. Possibly putting fuzzy transitions between different ai routines and stats for all the in game actors depending on how far into the other dimension you travel.
« Last Edit: November 30, 2015, 07:15:08 PM by mekaerwin »

Xecutor

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 263
  • Karma: +0/-0
    • View Profile
Re: map with complex numbers
« Reply #6 on: December 01, 2015, 02:05:13 PM »
I see this as two separate planes. One - real world, where physical part of the character is moving and interacting with the world, and imaginary part, where his soul/phantom/etc can be moved, and depending on position in the imaginary world, physical part can be affected in one way or another...

p.s. Damn. New keyboard. I'm constantly missing right keys :)

tuturto

  • Rogueliker
  • ***
  • Posts: 259
  • Karma: +0/-0
    • View Profile
    • pyherc
Re: map with complex numbers
« Reply #7 on: December 01, 2015, 07:08:09 PM »
Lots and lots of good stuff in replies. It's true that 4 dimensions would probably be too much for players to handle, especially if they could freely move to all directions. From the computer point of view though, it shouldn't be more complex than 2 or 3 dimensions. Path finding works in the same way for example, just with one added dimension. Sure, it would take more memory to represent the world, but I suspect the difference wouldn't be too much for modern computers to handle. I'm using sparse representation of the map (dictionary, with coordinates as key), so only the locations that contain anything or can be visited take memory.

I like the idea of world slowly morphing to something different the further you travel in the imaginary domain. Creatures would slowly become something different, as would the loot. That could be pretty neat risk/reward mechanism for players. And I totally love the idea how traveling would work differently. Whole geometry could be different, allowing quick travel and shortcuts for characters who know what they're doing. Others would get lost and in harm's way of course.

Everyone you will ever meet knows something you don't.
 - Bill Nye

Quendus

  • Rogueliker
  • ***
  • Posts: 447
  • Karma: +0/-0
  • $@ \in \{1,W\} \times \{1,H\}$
    • View Profile
    • Klein Roguelikes
Re: map with complex numbers
« Reply #8 on: December 01, 2015, 09:17:11 PM »
Complex numbers only have a special meaning (beyond doubling the number of dimensions) when multiplication is involved. In most roguelikes, the only operation applied to an object's coordinates is to add a directional offset.
Complex multiplication of coordinates would allow an object's position to be rotated and scaled relative to the origin of the game's coordinate system. To avoid things being placed outside of the map, this would require an unbounded or continuous-space map. Also, the same operations (and more) could be achieved using linear transformations of real coordinates.

Skullcoder

  • Newcomer
  • Posts: 23
  • Karma: +0/-0
    • View Profile
    • Skullcode
    • Email
Re: map with complex numbers
« Reply #9 on: April 01, 2016, 04:05:03 PM »
Perhaps not in the domain of "complex" numbers, but one method of visualizing various attributes is through layering of multiple dimensions.

For example, a scent, heat, or luck dimension can be extracted from and/or applied to the entities within a given spacial region.

Additionally, an entity may exist within a complex dimension whereby its X,Y,Z coordinates are only the visible representation and, as Xecutor mentions, additional dimensions of spirit, health, skill, elemental affinities, etc. are frequently present though rarely visualized as contiguous dimensions.

For example: the player's favor may exist as a point in the complex plane of a god's will, which is a field encompassing the combination of dimensions said god presides over, such as luck, vitality, vengence (critical strikeness), etc.  Some sort of collapsed visualization of the complex plane may assist in informing the player of their current status even if it may be unclear to them how their actions multiply, translate and rotate them through the god's complex plane of consciousness.  Perhaps a chaotic god could modulate their perceptual domain via the Julia set to demonstrate a deterministic graph of their fickle nature.

Derivations of the players path within the complex plain of possible player statuses could be useful for automatic leveling of related stats.  As for physically navigating in N+ dimensional space (keeping in mind that time is the unstated 0th dimension where "2D" and "3D" games are concerned)...  I have not yet demonstrated a sufficiently navigable display in my experiments, but I believe one approachable method may be rendering outward from the local dimensional origin rather than rendering the player's position from the global perspective.  Rendering deviations from the local origin would have the tendency to show the immediate surroundings in the complex plane as more normal, and potentially more warped and strange the further objects are from the player's point of view.  I've yet to implement this, however.
« Last Edit: April 01, 2016, 04:19:15 PM by Skullcoder »