Jump to content

  • Log In with Google      Sign In   
  • Create Account


Barrett

Member Since 11 May 2013
Offline Last Active Sep 19 2014 05:17 AM

Posts I've Made

In Topic: ASCII-graphic: using Console vs. API

16 September 2014 - 09:55 PM

Nypyren, thank yiu very much for this example!

 

I will try to use it!


In Topic: ASCII-graphic: using Console vs. API

16 September 2014 - 06:01 AM

The Windows console has always had only a 16-colors palette, and true console games have always worked with that.

 

If you don't really want to write  a console game, but just a game that uses ASCII characters, then you can do this even in HTML and JavaScript, where you can specify any color for characters.

 

If you still want to do it in C# (though I don't see the point), you'll have to draw your own "console", which is basically just a grid of characters (a 2D C# array, where each array element holds a character and a color). As for drawing this grid onto the screen, IMHO XNA is overkill. You could just use the System.Drawing class. If you're looking for reasons to learn XNA, you should find better ideas.

 

And what problems are you having with encoding console characters, exactly?

 

I'm trying to print some special characters (triangles, arrows and etc.). And on different computers I get different results - characters are printed, another characters printed or symbols "?" printed. 

 

I guess it is problem with encoding and fonts.

I changed the font to Consolas, then to Lucida Console, but nothing changed (also, I changed Console.OutputEncoding to UTF8, then to unicode) and combine all of this settings.

 

The way using System.Drawning is usefull, but very simple for me - I want to use a Console....

The main problem is incorrect char printing.


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.


PARTNERS