MUL-ling around

Forum where anything UOX3-related goes - including, but not limited to: newbie-support, ideas, general questions, comments, etc and-so-forth.
Post Reply
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

MUL-ling around

Post by Mindless Automaton »

I have an old 768x512 MUL I started messing around with.

UOX3 doesn't load the file, CEDServer & UOFiddler load the file.

There is a program called radmapcopy that will enlarge the file to 896x512 and then UOX3 loads the file, CEDServer & UOFiddler doesn't load the file.

Any thoughts on making everything happy with the same file?

Thanks!
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Try specifying the correct map size in DFNDATA\MAPS\maps.dfn! Correct size for your map would be X=6144 (768x8) and Y=4096 (512x8).
Alternatively, in the same folder, rename the file named maps.4xclients.old to maps.dfn (backup the original one), as that already has these sizes pre-defined.
-= Ho Eyo He Hum =-
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Mindless Automaton »

Xuri wrote:Try specifying the correct map size in DFNDATA\MAPS\maps.dfn! Correct size for your map would be X=6144 (768x8) and Y=4096 (512x8).
Alternatively, in the same folder, rename the file named maps.4xclients.old to maps.dfn (backup the original one), as that already has these sizes pre-defined.
Ok thanks, changing the size allowed the map to be used.

Do you know of any tools that would resize the MUL or do I need to export to BMP, resize, then MUL it again?

Might have to fire up the old WinXP laptop or something for some of these older tools. :o

Thanks!
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

You could try your luck with one of punt's old tools, hosted here at Ryandor's site:
http://www.ryandor.com/files/punt/3%20-%20Other%20Files%20&%20Utilities/ML%20Map%20Extender/
-= Ho Eyo He Hum =-
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Mindless Automaton »

Xuri wrote:You could try your luck with one of punt's old tools, hosted here at Ryandor's site:
http://www.ryandor.com/files/punt/3%20-%20Other%20Files%20&%20Utilities/ML%20Map%20Extender/
Ok, I added that stuff to my collection of tools. I will report back when I get motivated enough to try it.
Just been making a lot of swampland in CentrED, vacation without getting COVID, etc.
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Mindless Automaton »

Mindless Automaton wrote:
Xuri wrote:You could try your luck with one of punt's old tools, hosted here at Ryandor's site:
http://www.ryandor.com/files/punt/3%20-%20Other%20Files%20&%20Utilities/ML%20Map%20Extender/
Ok, I added that stuff to my collection of tools. I will report back when I get motivated enough to try it.
Just been making a lot of swampland in CentrED, vacation without getting COVID, etc.
MLExtender says the map is not the correct size to extend.

Anyways, what would be the best way to build houses and stuff nowadays? I think I may be done with terrain editing for now.
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

You could also check the "RadStar Edition" of WorldForge for the map increase part: https://uo.wzk.cz/worldforge/

From its changelog:
Enlarge map to ML (in EXTRA menu) - Create new map0.mul with
Mondain's Legacy size and copy other map into this
-= Ho Eyo He Hum =-
punt
VIP
Posts: 244
Joined: Wed Mar 24, 2004 7:46 pm
Has thanked: 0
Been thanked: 9 times

Post by punt »

If you need something to change your map/staidx to a different size, I can offer you a command line program to do that.

basically it would need to know the original block size, and the new desired block size. It would need to know the map.mul file, and the staidx.mul file.
it would also need to know the land tile id and altitude to use for any new blocks it creates

so basically the command line would look like (assuming mapsize is the name of the program):

mapsize oldxblock oldyblock newxblock newyblock mappath stapath tileid alt.

Is that of interest ?
punt
VIP
Posts: 244
Joined: Wed Mar 24, 2004 7:46 pm
Has thanked: 0
Been thanked: 9 times

Post by punt »

This would be the program for what I described. Xuri could probably make you a windows exe If needed. Xuri is debugging, so if there is a problem, I will update this code with the fixed version.
This makes two files with the extension ".resized". It does not write to the two files you supply, so it won't corrupt.
//
//  main.cpp
//  mapsize
//
//  Created by Charles Kerr on 9/20/20.
//

#include <iostream>
#include <filesystem>
#include <fstream>
#include <cstring>
#include <string>
#include <exception>

// Forward declares
void fillMapBlock(std::ofstream& output, unsigned short tileid, char alt, int header);

int main(int argc, const char * argv[]) {
   
    if (argc < 9) {
        std::cerr <<"Insufficient arguments" << std::endl;
        std::cerr <<"Calling sequence is:"<<std::endl;
        std::cerr <<"'mapsize oldXblksize oldYblksize newXblksize newYblksize mapmulpath staidxpath tileid altitude'"<<std::endl;
        return 1;
    }
    int oldX = 0 ;
    int oldY = 0 ;
    int newX = 0 ;
    int newY = 0 ;
    std::string mapfile ;
    std::string stafile ;
    unsigned short tileid = 0  ;
    char alt = 0 ;
    try {
        oldX = std::stoi(std::string(argv[1]),0,0) ;
        oldY = std::stoi(std::string(argv[2]),0,0) ;
        newX = std::stoi(std::string(argv[3]),0,0) ;
        newY = std::stoi(std::string(argv[4]),0,0) ;
        mapfile = std::string(argv[5]) ;
        stafile = std::string(argv[6]) ;
        tileid = static_cast<unsigned short>(std::stoi(std::string(argv[7]),0,0));
        alt = static_cast<char>(std::stoi(std::string(argv[8]),0,0));
       
       
    }
    catch (const std::exception& e) {
        std::cerr <<"Error converting arguments: " << e.what() << std::endl;
        return 1 ;
    }
   
    auto nmapfile = mapfile + ".resized" ;
    auto nstafile = stafile + ".resized" ;
    auto mapsize = std::filesystem::file_size(std::filesystem::path(mapfile));
    if (mapsize < (oldX*oldY * 196)) {
        std::cerr << "Specified old x/y blocksize is larger then mapfile size"<< std::endl;
        return 1 ;
    }
    // We know the file size is at least big enough, so we can read it now
    std::ifstream mapinput(mapfile,std::ifstream::in | std::ifstream::binary) ;
    if (!mapinput.is_open()) {
        std::cerr <<"Unable to open file: "<< mapfile <<std::endl;
        return 1;
    }
    std::ifstream stainput(stafile,std::fstream::in | std::ifstream::binary);
   
    if (!stainput.is_open()){
        std::cerr <<"Unable to open file: "<< mapfile <<std::endl;
        return 1;
       
    }
   
    // Both files are open,now open the new ones
    std::ofstream mapoutput(nmapfile,std::ofstream::out|std::ofstream::binary) ;
    if (!mapoutput.is_open()){
        std::cerr <<"Unable to create file: "<< nmapfile <<std::endl;
        return 1;
       
    }
    std::ofstream staoutput(nstafile,std::ofstream::out|std::ofstream::binary) ;
    if (!staoutput.is_open()){
        std::cerr <<"Unable to create file: "<< nstafile <<std::endl;
        mapoutput.close();
        std::filesystem::remove(std::filesystem::path(nmapfile));
        return 1;
       
    }
   
    // Now we have all files opened!
    char mapblock[196];
    char idxblock[12];
    int invalid = -1;
    int zero = 0 ;
   
    for ( auto x = 0 ; x < oldX ; x++){
        if (x >= newX) {
            // we are DONE!
            break;
        }
        for (auto y = 0 ; y < oldY; y++) {
            mapinput.read(mapblock,196);
            stainput.read(idxblock,12);
            if (y < newY) {
                mapoutput.write(mapblock, 196);
                staoutput.write(idxblock,12);
            }
        }
        // Do we have any blank y blocks we need to add?
        auto addblock = newY - oldY ;
        if (addblock > 0) {
            for (auto y=0 ; y< addblock; y++) {
                fillMapBlock(mapoutput, tileid, alt, zero);
                staoutput.write(reinterpret_cast<char*>(&invalid),4);
                staoutput.write(reinterpret_cast<char*>(&zero),4);
                staoutput.write(reinterpret_cast<char*>(&zero),4);
               
            }
        }
       
       
    }
    auto addblock = newX - oldX ;
    for (auto x = 0 ; x<addblock;x++) {
        for (auto y = 0 ; y < newY; y++) {
            fillMapBlock(mapoutput, tileid, alt, zero);
            staoutput.write(reinterpret_cast<char*>(&invalid),4);
            staoutput.write(reinterpret_cast<char*>(&zero),4);
            staoutput.write(reinterpret_cast<char*>(&zero),4);
        }
    }
   
    staoutput.close();
    mapoutput.close();
    mapinput.close();
    stainput.close();
   
   
    return 0;
}

void fillMapBlock(std::ofstream& output, unsigned short tileid, char alt, int header) {
    output.write(reinterpret_cast<char*>(&header),4);
    for (auto i=0 ; i < 64; i++){
        output.write(reinterpret_cast<char*>(&tileid),2);
        output.write(&alt,1);
    }
   
}
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

I compiled a version for 64bit Windows users, but not sure if it works with Windows 7... it also includes the source punt posted above, as well as some instructions on how to use it, with explanation of parameters and a couple of working examples. See attached file!
mapsize_x64_with_source.zip
mapsize - a map resizer for Ultima Online (by punt)
(23.51 KiB) Downloaded 262 times
-= Ho Eyo He Hum =-
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Another tool by punt - Freeze:
A command line tool that can freeze items (and multis) with TYPE=255 from UOX3's 0.99.x .wsc worldfiles into staidx#/statics#.mul files based on the worldnumber of the items in question. At the same time, it will remove affected items from the wsc files. Updated files are saved with .frozen file extension, and original files are not modified.
freeze_x64_with_source.zip
Freeze - a tool to freeze items into statics (by punt)
(75.15 KiB) Downloaded 262 times
-= Ho Eyo He Hum =-
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Mindless Automaton »

Xuri wrote: Sun Sep 20, 2020 4:33 pm I compiled a version for 64bit Windows users, but not sure if it works with Windows 7... it also includes the source punt posted above, as well as some instructions on how to use it, with explanation of parameters and a couple of working examples. See attached file!
mapsize_x64_with_source.zip
ok, resized, worked with all programs, thanks!

Next will be freeze, then convert to UOP to use with latest client i guess.
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Mindless Automaton »

Mindless Automaton wrote: Sat Sep 26, 2020 5:16 am ok, resized, worked with all programs, thanks!

Next will be freeze, then convert to UOP to use with latest client i guess.
Ok, i skipped freeze for now but I was able to use UOFiddler to convert MULs to UOP, drop them in UOX3 and Classic Client and then log in and run around the map a bit.

However CentrEd doesn't like the UOP for some reason. Not a big deal though, would just have to finalize everything as MUL and then convert.
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Does CentrEd usually work directly with uop files?
-= Ho Eyo He Hum =-
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Mindless Automaton »

Xuri wrote: Sat Sep 26, 2020 7:39 pm Does CentrEd usually work directly with uop files?
http://dev.uoquint.ru/projects/centred/ ... rver_setup

They have format/prefix numbers for it. I thought I got it working once, but I can't seem to get it going again. :(
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
Post Reply