Ryandor.com
https://ryandor.com/forum/

Lava Transition Error
https://ryandor.com/forum/viewtopic.php?f=2&t=2862
Page 1 of 1

Author:  mogmoogle [ Thu May 18, 2006 3:12 pm ]
Post subject:  Lava Transition Error

Ok i have problems in the 3d not the 2d client with this
there are tiles that are lava that are sappose to be transition tiles
the transition tiles are always 2 of the jungle to grass tiles
2 of the mountain to dirt tiles 3 of the dirt to jungle tiles and one of the snow to water tiles. this happens in the regular osi maps aswell. is there anyway to fix this. or do i have to do all the work by hand?

It would be nice if there was a program that you could find and replace tiles by there tile ID.. that would help fix any errors.

Author:  punt1959 [ Thu May 18, 2006 3:39 pm ]
Post subject: 

The problem is for some tiles, OSI 3d client no longer support them.
The only way I know for sure to eliminate that problem, is to restrict to the the terrain ids that are used by OSI. That may be considered limiting, however.

Anyay, I provided stormcrow a list of all the terrain ids used in OSI maps. We will have to wait to see what makes sense to do next.

Author:  mogmoogle [ Thu May 18, 2006 3:45 pm ]
Post subject:  I know

I know what tiles dont work. and i know what tiles work. what im asking. is there anyway to find and replace those tiles, a bit easyer then clicking on each one individually and guessing which ones do what. like i want to replace the bottom left corner peice of jungle to grass with id 0412 which is a transition that works in both clients. but the only way for me to do that. is to do it one by one. i want to know if theres a program that i can type in find tile id 0512 with 0412 and press start. and it does it for me. i cant imagine that it would be that hard to program for the illustrious punt hahahahah :P im playing but i you know what im saying do you have a program like that? or no go am i SOL :P

btw i love you punt hahha

Author:  punt1959 [ Thu May 18, 2006 3:57 pm ]
Post subject: 

Actually at one time WorldMaker had a fine/replace. Not sure why i removed it.

But, regardless, you can fix it on your end, "kinda" easy.

Go to the mapgenerator 2 data/Transition directory. In those subdirectories, are the transistion files (the names are kinda of a give away).

Now, under any
Code:
 <Terrain>
entry, if you see a
Code:
<Tile ID=>
that matches the id of a bad one (the ids are in decimal, unless preceeded by a 0x), either replace the ID with a valid one, or delete it (if there are other
Code:
 <Tile ID=>
that are valid under that SAME
Code:
<Terrain>
entry. Then regenerate your map.

Author:  mogmoogle [ Thu May 18, 2006 4:01 pm ]
Post subject:  here is the problem

the problem is dude.. is that i kinda generated the map like 5 months ago. so now i have all the citys done and everything and im just looking for fix some small map errors. if I regenerate from the BMP ill loose all the roads i put in custom with worldforge later. thats why im looking for a find replace option for tiles. because otherwise im doing it by hand. for ever hahahah do you happen to have and old copy of worldmaker around that i can download that still has the find/replace? help me punt your my only hope :P o and i generated it with dragon. i didnt even know about Punts world tools then. so you see i kinda got stuck with the problem..

Author:  punt1959 [ Thu May 18, 2006 4:03 pm ]
Post subject: 

Can you compile a C++ program?

Author:  mogmoogle [ Thu May 18, 2006 4:06 pm ]
Post subject:  i have

i have microsoft visual C++ i could install. i havent installed it after i formatted again. but i guess you didnt need to know that. ya i could compile it..

Author:  punt1959 [ Thu May 18, 2006 4:09 pm ]
Post subject: 

Ok,so I understand correctly, you didn't make this map with Map Generator 2? I want to understand if the current data we have for that results in this situation.

Author:  mogmoogle [ Thu May 18, 2006 4:15 pm ]
Post subject:  No

I made this map with Dragon mod 11.

I started working on the map and completed alot of it before i realized a few things.

1.) all my jungle was forest. so i just used your map editor to make some jungle tree multi files and did most the jungle with those. easy fix..
2.) the transition tiles the bottom left jungle to grass tile, the top left jungle to grass tile 3 of the jungle to dirt tiles, 2 of the mountain to dirt tiles, and 2 of the snow to water tiles,. you also call them snow to dirt. there like hill transitions. all show up as LAVA. i can fix them because i can get the item ids and replace them. but doing it each tile at a time will take so long ill prob be dead before i finish. so i was looking for a way like i said to find and replace tiles. by tile ID.

Author:  Xuri [ Thu May 18, 2006 5:48 pm ]
Post subject: 

The lava-problem is probably related to the fact that some transitions only work in one client-type (either 2D or 3D), and show up as lava in the other :|

Author:  punt1959 [ Thu May 18, 2006 6:03 pm ]
Post subject: 

Ok, I don't know where I posted this.
but, this program reads a file in that looks like this:

badtileid,goodtileid
badtiledi,goodtileid

it doesn't have any error checking, so I would add spaces, etc. The tileids are in decimal.

Now, the progam is executed like this:

tileswap tilefile mapmulfile
Where tilefile is the file described above, and the mapmulfile is the map#.mul you want to modify. Bot file names need to have their full location specified. You start the program from the command line!!!!

Make a BACKUP before you try this. UNTESTED.


Code:
#include <fstream>
#include <string>
#include <iostream>
#include <cstdlib>
#include <map>

bool convert(std::string &input, unsigned short &key, unsigned short &value)
{
   bool rvalue=false;

   std::size_t index=input.find(",");
   if (index != std::string::npos)
   {
      std::string first = input.substr(0,index);
      std::string second=input.substr(index+1);
      key=std::atoi(first.c_str());
      value=std::atoi(second.c_str());
      rvalue=true;
   }
   return rvalue;
}
int main (int argc, char *argv[])
{
   std::map<unsigned short,unsigned short> swaptable;
   char buffer[1024];
   int status=0;
   std::map<unsigned short, unsigned short>::const_iterator iter ;

   if (argc == 3)
   {
      std::string tilefilename = argv[1];
      std::string mulfile = argv[2];
      std::fstream tile;
      tile.open(tilefilename.c_str(),std::ios_base::in);
      unsigned short key,value;
      if (tile.is_open())
      {
         while (!tile.eof())
         {
            tile.getline(buffer,1024);
            std::string raw=buffer;
            if (!raw.empty())
            {
               if (convert(raw,key,value))
               {
                  swaptable.insert(std::make_pair(key,value));
               }
               else
                  std::cerr <<"Invalid line "   <<raw<<std::endl;
            }

         }
         // We have the swap buffer ready, now time to look at the data;

         tile.close();
         unsigned short tileid;
         char alt;
         int block=0;
         tile.open(mulfile.c_str(),std::ios_base::in | std::ios_base::out | std::ios_base::binary);
         if (tile.is_open())
         {
            std::cout <<"Processing " <<mulfile<<std::endl;
            while (!tile.eof())
            {
               // for every block
               tile.read(reinterpret_cast<char*>(&tileid),2);
               tile.read(reinterpret_cast<char*>(&tileid),2);
               std::size_t index;
               for (int c=0;c<64;++c)
               {
                  index = tile.tellg();
                  tile.read(reinterpret_cast<char*>(&tileid),2);
                  tile.read(&alt,1);
                  iter = swaptable.find(tileid);
                  if (iter != swaptable.end())
                  {
                     tile.seekp(index);
                     unsigned short ntile= iter->second;
                     tile.write(reinterpret_cast<char*>(&ntile),2);
                     std::cout <<"Tile in block " << block<<", cell " <<c<<" was " <<tileid<<" replaced with " << ntile <<std::endl;
                  }
               }
               ++block;

            }
            tile.close();
         }
         else
            std::cerr <<"Unable to open " << mulfile<<std::endl;
      }


   }
   else
   {
      std::cerr<<"Usage: tileswap tilefilename mapmulfile " <<std::endl;
   }
   return(status);
}


Author:  Stormcrow [ Thu May 18, 2006 6:16 pm ]
Post subject: 

And yes, the mapgenerator data is going to produce the same results.

Author:  punt1959 [ Thu May 18, 2006 6:17 pm ]
Post subject: 

If it is, is there a way to avoid using those tileids then?

Author:  Stormcrow [ Thu May 18, 2006 6:28 pm ]
Post subject: 

I doubt it, I think it as Xuri said that they are different for each, because the tiles I use are from the 2d map. I looked at it briefly at 1 point, but I never devoted much time to it; the 3d client is a total piece of shit. If someone were to provide proper tile ids that work in both clients (because the 2d client is what most of us use) then I'd be happy to modify the scripts.

Author:  Dian [ Thu May 18, 2006 8:13 pm ]
Post subject: 

There are some 2D transition tiles that come out as lava in the 3D client. They are the upper hex numbers.. I know snow to grass transitions are almost all lava.. hex#'s 0x5BF - 0x5E2.. not sure if all, or most.. there are also a few forest to desert.. I had this issue long ago too, and had to 'work around' the problem with alternative land tiles that both clients see.

Author:  mogmoogle [ Sat May 20, 2006 10:53 am ]
Post subject:  Yes

Yes the tiles work in the 2D cleint but show up as Lava in the 3D client. i can fix them manually. which ive been doing but it takes a while. thanks punt for the program, ill give it a try. it happened when they changed ultima from 2D to 3D back in the day,. i was running a server during that transition so i remember when it originally occured.

Author:  Stormcrow [ Sat May 20, 2006 11:00 am ]
Post subject: 

Dian wrote:
There are some 2D transition tiles that come out as lava in the 3D client. They are the upper hex numbers.. I know snow to grass transitions are almost all lava.. hex#'s 0x5BF - 0x5E2.. not sure if all, or most.. there are also a few forest to desert.. I had this issue long ago too, and had to 'work around' the problem with alternative land tiles that both clients see.


Well did you write down which tiles and send them to me dumbass? :P

Author:  Dian [ Sat May 20, 2006 1:14 pm ]
Post subject: 

Stormcrow wrote:
Dian wrote:
There are some 2D transition tiles that come out as lava in the 3D client. They are the upper hex numbers.. I know snow to grass transitions are almost all lava.. hex#'s 0x5BF - 0x5E2.. not sure if all, or most.. there are also a few forest to desert.. I had this issue long ago too, and had to 'work around' the problem with alternative land tiles that both clients see.


Well did you write down which tiles and send them to me dumbass? :P


Hell.. It was like, 2-3 years ago when I found this issue out.. and, no. I didnt write them down... I never write anything important down. takes too much time. :?

Author:  punt1959 [ Sat May 20, 2006 5:43 pm ]
Post subject: 

Again, if we use the tiles in the valid tile list I posted, we should be fine for both clients

Author:  Stormcrow [ Sat May 20, 2006 6:28 pm ]
Post subject: 

I'll do a compare.

Author:  Kronos [ Sun May 21, 2006 12:05 am ]
Post subject: 

crazy xuri and your C++

Author:  Xuri [ Sun May 21, 2006 12:31 am ]
Post subject: 

O_o

Page 1 of 1 All times are UTC - 7 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/