Post new topic    
Slime Knight
Send private message
Anyone remember my custom Map editor? 
 PostMon Nov 28, 2011 7:36 am
Send private message Reply with quote
Not sure if anybody remembers a map editor I was working on awhile back, about a year ago, maybe less... I haven't worked on it since, but I am thinking of jumping back onto that project, but with a different language. In fact, I hope that re-building it in Python using Pygame will help me learn more about Pygame. So far, I just made it possible to load a palette and an MXS file in Python! It's very basic and awful coding practices, but it works. The only problem I don't like about Python is that it's very large, and not that easy to distribute. However it is very cross-platform.

If anybody here has Python and Pygame installed, here is the code to load an MXS file on the screen with a Palette file:

Code:

from struct import *
import pygame
from pygame.locals import *
import sys

pygame.init()
screen = pygame.display.set_mode((320,200),0,8)
pygame.display.set_caption('MXS Loader')
screen.set_at((100,100),100)

f = open('palettes.bin', 'rb')
hdr = unpack('hh',f.read(4))
pal = []
for i in range(0,256):
   pal.append(unpack('BBB',f.read(3)))
f.close()
screen.set_palette(pal)

peek = Struct('B')
f = open('splash.mxs','rb')
for j in range(0,4):
   for y in range(0,200):
      for x in range(j,320,4):
         screen.set_at((x,y), peek.unpack(f.read(1))[0])
f.close()

while 1:
   for event in pygame.event.get():
      if event.type in (QUIT, KEYDOWN):
         sys.exit()
      pygame.display.update()
      pygame.time.delay(100)


At the moment, this involves extracting the PAL and MXS file from your RPG lump, however you can easily change the file loading locations to your working.tmp file for example.

I hope to port my old map editor over to Python and implement some new features into it, as Python and Pygame can offer more than the other language I was using, and Mac users will also be-able to use it now too.

For those who haven't seen the old map editor, here is the download location:

http://sdlbasic.net/beta/project/ohr-tilemap-editor-windows/



I have a YouTube video somewhere as well showing it in action, but this is an old version now, and I hope to build a new one and better one.
Metal King Slime
Send private message
 
 PostMon Nov 28, 2011 12:16 pm
Send private message Reply with quote
Your Python code is nicely short and simple.

Wow, I have a bad memory. I thought that someone else wrote that map editor.

If you are writing any OHR utilities in Python you should definitely consider building them on top of David Gower's nohrio. In fact I already wrote some code to load MXS (and all other graphics) into pygame surfaces using nohrio (part of colouruse.py, which is in thirdparty/ in the nohrio repository. Also, code for loading fonts is in tools/rpgbatch/analyze.py in the OHR repository).

However, nohrio is still highly unfinished and fairly complex. It's currently quite a nuisance to work out how to use it to do anything. However if you want to work with NPCs, zones, or the near-future new tilemap, tileset, and map data file formats you should use it... however nohrio doesn't actually support any of those yet except for NPCs :P I'm happy to help with nohrio and implement missing functionality, time permitting.
Slime Knight
Send private message
 
 PostMon Nov 28, 2011 2:38 pm
Send private message Reply with quote
TMC wrote:
Your Python code is nicely short and simple.

Thank you, I built my prototypes short and simple and to the point.

TMC wrote:
Wow, I have a bad memory. I thought that someone else wrote that map editor.

Check the original thread at CP.

TMC wrote:

If you are writing any OHR utilities in Python you should definitely consider building them on top of David Gower's nohrio. In fact I already wrote some code to load MXS (and all other graphics) into pygame surfaces using nohrio (part of colouruse.py, which is in thirdparty/ in the nohrio repository. Also, code for loading fonts is in tools/rpgbatch/analyze.py in the OHR repository).

I'll take a look and see if I can help out with that project.

TMC wrote:

However, nohrio is still highly unfinished and fairly complex. It's currently quite a nuisance to work out how to use it to do anything. However if you want to work with NPCs, zones, or the near-future new tilemap, tileset, and map data file formats you should use it... however nohrio doesn't actually support any of those yet except for NPCs :P I'm happy to help with nohrio and implement missing functionality, time permitting.

I just took a look at the code, and it has a lot of stuff in there, I can see some of the confusion. I haven't went through it all, but will over the next few days to see what I can do with it. Thanks.
King Slime
Send private message
 
 PostMon Nov 28, 2011 7:15 pm
Send private message Reply with quote
I tried to download it, the program wouldn't run.
Slime Knight
Send private message
 
 PostMon Dec 05, 2011 6:33 am
Send private message Reply with quote
Master K wrote:
I tried to download it, the program wouldn't run.

I haven't tested it on the latest version of the engine, I know it works in the last. When you run the map editor, you need to have CUSTOM.EXE opened with the game you want to edit. Then launch my custom map editor, it will detect your working.tmp and open the first map for editing.

I did this, as I didn't feel like dealing with the password decryption in the RPG file, and most people who edit a map will have their game open for editing anyways... You will still need CUSTOM.EXE for editing anything other than the tilemap, and for creating new maps. If you create a new map, you will need to re-load the map editor, so that it can see the changes to the GEN file and be-able to load the new map.

Make a back-up of your RPG file before using any third party tool.
Display posts from previous: