Poll

What do you think of my first Python script?

Pretty good
13 (92.9%)
Pretty bad
1 (7.1%)

Total Members Voted: 14

Author Topic: [Python / Torque] Blockland related Python scripts - Img2Brik  (Read 1359 times)

Terrain Generator
I'm planning on making an interactive GUI that lets you create a height-map, and import already created height-maps, to be exported for blockland to load.
Currently I haven't made any progress in it right now, but plan to start real soon.

Planned Features
  • Importing / Exporting of height-maps
  • Generation based off of noise
  • Sea level and Biomes
  • Auto Tree arrangement



Img2Brik
I was bored one day, and decided to google the Img2Brik script everyone uses on blockland to find out it doesn't work on Linux.
So I decided to make one in python.

How it works
You need to put this in a folder, with an Image.png and colorSet.txt (of the current colorSet).
Both being obvious as to what they are.
Double click the Python, or navigate to it with your terminal, and run it.

And now in-game, you execute the Main.cs, and then do loadImageFile("Output.txt Directory");
I personally keep it all in a img2brik folder in my base directory of blockland.


You will need the Python Imaging Library first.

I'll probably be updating this in the future with supports such as a GUI, selectable list, and a way to preview how the image will look.
Issues
Only one major issue right now, not being able to talk or cancel without leaving the server.
I could easily fix that (in-fact I did, but some reason lost the Main.cs of then), but don't feel like bothering re-writing it again right now.

Planned features
  • Interactive GUI
  • Dithering
  • Auto re-scaling
  • Brick Reduction

Dropbox link containing Main.cs & Main.py
Credits
Pah1023 / ChocoboPah
Maddix for helping me with syntax, and basics of python


Gallery
A picture of my character done in Img2brik
Hitting the brick limit with an image

If you have any issues or suggestions on what I should add / make, please post them below.


As far as I know, this shouldn't break any rules since you can see the source of the python codes.
The only thing wrong might be that this wouldn't go in general modification discussion.


I should also state, all of these scripts are tested in Python 2.7, I'm not sure if there will be any issue in later versions, if there is please tell me.
« Last Edit: August 23, 2014, 06:22:09 PM by Pah1023 »