Jump to content

  • Log In with Google      Sign In   
  • Create Account


Barrett

Member Since 11 May 2013
Offline Last Active Apr 03 2014 01:25 AM
-----

Posts I've Made

In Topic: Sphere Looped World Map

12 July 2013 - 07:32 AM

Who said anything about rotation? I mentioned how to visualise which parts of the map would be connected to give it a topology similar to that of a sphere (either fold the map along the line of 0 latitude and imagine the edges are joined together, or imagine a cylinder with the caps sewn shut).

 

Here's some pseudo-code for that. Map your coordinates into the range -1 to +1 (-1 on the X axis would be the West edge, +1 on the X axis would be the East edge, +1 on the Y axis would be the North edge, -1 on the Y axis would be the South edge).

 

Wrapping East->West:

 

if(x > 1) x = x - 2; // maps x = +1 to x = -1

 

Wrapping West->East:

 

if(x < -1) x = x + 2; // maps x = -1 to x = +1

 

Wrapping by going North:

 

if(y > 1) x = -x, y = 1 - (y - 1); // reflect x coordinate in y axis (i.e. the line x = 0) and reflect y coordinate around line y = 1

 

1 - (y - 1) simplifies to 1 - y + 1 = 2 - y

 

Wrapping by going South:

 

if(y < -1) x = -x, y = -1 - (y - (-1)); // reflect x coordinate in y axis and reflect y coordinate around line y = -1

 

-1 - (y - (-1)) simplifies to -1 - (y + 1) = -2 - y

 

Example: you move off the south edge of the map and your x, y coordinates would have placed you at (0.6, -1.25). Your new coordinates would be (-0.6, -2 - (-1.25)) = (-0.6, -0.75)

 

EDIT: It is possible to cross both east/west and go off the top or bottom in the same move. Solve this by checking for going off the east or west edge first, adjust the x coordinate, and then check the new position against the top and bottom of the map.

 

Yes, I got it) Thanks!

 

And what should I do with my camera? I've got a 2d game with non-rotation camera (like old FF). This impementation means that when player crossed -1 point at Y axis, camera and player simply moves into new location? It seems not so seamless as I imagine... But there is only one way to do it?

 

Hoping for your help,

Denis

 

P.S. Sorry for my English =)


In Topic: Sphere Looped World Map

10 July 2013 - 01:56 PM

Thanks a lot!

 

Torus is not my variant, I want to model a sphere loop. But I forgot about one thing - I have a 2d graphics like old-style games (FF1, FF2) and I cannot rotate elements at map...

Any Ideas what I can do with this situation?

 

Thanks in advance,

Denis 


In Topic: Managing large worlds

03 July 2013 - 07:58 AM

For animals and other "enemies" and for all non-static objects possible to use a limited queue. For exampl - when one of monster spawn, it adds to the list of updateable entities. if list is full - remove last added monster. also you can add a condition for deleting - the monster should sta out of current viewport.


In Topic: World Map Render And Storage

20 June 2013 - 11:59 AM

yep, it was really fast.

Now I will optimize it)

 

Thanks a lot!


In Topic: World Map Render And Storage

17 June 2013 - 10:57 PM

Thanks a lot!

 

I will try to do it)


PARTNERS