Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Age of Revolution - Need Python help  (Read 863 times)

Cheddarius

  • Bay Watcher
  • Hrm.
    • View Profile
Age of Revolution - Need Python help
« on: March 14, 2010, 01:25:56 pm »

So I'm making a blend of Age of Restoration and Evolution (the games with the hexes) in Python. I need a way to display the hexes, but I don't want to use graphics - that's a huge jump in difficulty. How can I display it in ASCII?

Basically what I have is a list called hexes with 26 lists in it, which have hexes from 0-30 even or 1-31 odd.
Logged

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #1 on: March 14, 2010, 06:18:18 pm »

Draw the hexes in ASCII. This is an incredibly bad solution, however, as you're going to have line-selection problems (if you include mouse support). Basic graphics are probably a better solution.
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

Cheddarius

  • Bay Watcher
  • Hrm.
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #2 on: March 14, 2010, 06:29:11 pm »

It's a text game, there's no mouse. It's very basic because I'm not very good at programming.
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #3 on: March 15, 2010, 08:19:43 am »

Use something like this, where X is a tile:

Code: [Select]

   X X X X X X X X
  X X X X X X X X X
   X X X X X X X X
  X X X X X X X X X
   X X X X X X X X
  X X X X X X X X X
   X X X X X X X X
  X X X X X X X X X
   X X X X X X X X
 
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Tahin

  • Bay Watcher
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #4 on: March 15, 2010, 10:05:07 am »

If you want to get fancy you could do it as

_   _   _
X\_/X\_/X\
_/X\_/X\_/
X\_/X\_/X\
_/X\_/X\_/
X\_/X\_/X\
_/X\_/X\_/


You could even use an underlined character for the bottom part to have a two-character tile.
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #5 on: March 15, 2010, 10:36:51 am »

I don't want to use graphics - that's a huge jump in difficulty.

It's easier, mostly cause python has bindings for every task known to mandwarfkind.

Hexgrid library: http://sourceforge.net/projects/libhex/
Example in python: http://libhex.svn.sourceforge.net/viewvc/libhex/trunk/examples/example.py?view=markup

I think that is what you need, never used it but it looks simple and promising.


Edit: I was wrong, appears that stuff generates SVGs which I don't think will help you?
« Last Edit: March 15, 2010, 10:39:36 am by Shades »
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

Cheddarius

  • Bay Watcher
  • Hrm.
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #6 on: March 15, 2010, 01:12:17 pm »

Hmmm, that example looks great!
Is there some way to have numbers (perhaps colored) in the hexes representing population, up to 10? And additionally color the hexes themselves?
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #7 on: March 15, 2010, 01:54:43 pm »

-delete- misread
« Last Edit: March 15, 2010, 01:56:25 pm by Shades »
Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

Cheddarius

  • Bay Watcher
  • Hrm.
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #8 on: March 16, 2010, 08:01:45 pm »

So, er, is there any way to generate ASCII hexes with (possibly colored) numbers, 1-10, in them? Not stretching out the hexes or whatnot depending on how long the numbers are?
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #9 on: March 17, 2010, 04:18:36 pm »

have it go from 0 to 9 instead of 1 to 10
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Cheddarius

  • Bay Watcher
  • Hrm.
    • View Profile
Re: Age of Revolution - Need Python help
« Reply #10 on: March 17, 2010, 05:52:03 pm »

Hrmm...
That's sort of strange. I want to have 10 population, and I want to have it clearly visible.

I guess I could just make a function that prints "  " if the input is 0, and the input, with color for team, if the population isn't 0.
Does anyone know how to implement colors in Python?
And does Python give the letters all equal spacing, like with the code or tt tags on this forum?
Logged