Shop  •   Avatar  •   FAQ  •   Search  •   Memberlist  •   Usergroups  •   Profile  •   Log in to check private messages  •   Log in  •  Register 

treasure map coding
Post new topic   Reply to topic     Forum Index -> Customization & Modding Goto page 1, 2, 3  Next
View previous topic :: View next topic  
Author Message
parksbanyon
Gunner
Posts: 564



13127 Gold -

PostPosted: Sat Jul 27, 2013 5:44 pm    Post subject: treasure map coding Reply with quote

I am double posting this (jlangsdo seems to spend a lot of time in the mods forum as I do). I'm not prone to use cheats (ok ok I created the interceptor mail runner but it has +'s and -'s to balance it out) but all the "markers" i.e "cutthroat rock" "captains point" etc are there for a reason. Real sailors used these as nav aids! I realize they are spawned at the beginning of each game and are therefore not hardcoded, however there must be a way to display them.
The settlements,missions,pirate havens, indian village, and markers are all randomly generated at the beginning of a game. the settlemetns will appear on your map if you purchase the rutter, the pirate havens when a bar maid/tender tells you about a named pirate, but the missions,indian villages, and markers will only appear AFTER you have sailed by them. I would like to be able to display them (the markers) the same way the missions and villages display once you have sighted them.
I have already done a test save start of game then after traveling a distance. I think I can see in the unpacked savegame where this is, but even if I'm correct where is the code that performs the action for the missions villages etc?
Back to top
View user's profile Send private message
dogcigar
Swabbie
Posts: 82



542 Gold -

PostPosted: Sun Jul 28, 2013 6:57 am    Post subject: Reply with quote

If you use cheat engine you can attach a debugger that will find what accesses or writes to an an address. If you have the starting address your more than 50% there. A list of codes pops up and you can jump in to look at each code area. Note- these types of continually accessed data (like for maps or sailing) can be accessed 10s of times each second which is more problematic as the debugger has a greater chance of crashing the game. I usually use the debugger for something which I figure will just be accessed a few times in a decision structure but I have had some success with these types of codes that are on a loop.

If it was me I`d also try to find out what the game already does. eg continually access viewed mission/village data. Find that code and then see if you could substitute it with an area where the game saves your alternative viewed marker data. Hopefully the game will save the data in the same way. One problem I could see is that the game pulls the text for settlements from a file in assets. There may be no text string to pull except of course the game does display different names for different markers. jlangsdo found that they were on a type of diagonal grid I think. He may know a lot about it. You would probably have to find where these hardcoded text strings are accessed from and how.

Sorry to be longwinded, but logically markers are definately one of the saved elements in the game. Hopefully the information would be compatible with saved data of another kind you could substitute. You may have a chance because some parts of the game were designed in an open way and then removed from the game and you can still see elements there. For example I found favour registers for Pirates, Indians and Jesuits which I use in some mods. I have also tried to make Pirates Indians and Jesuits at war with each other though and had no success.
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sun Jul 28, 2013 1:39 pm    Post subject: Reply with quote

So you want a executable patch that will put icons and text for Pirate Landmarks like "Shark's Hole" onto the world map, and the notation will only appear after you have sailed by that particular marker?

I would estimate that that is impossible, given the magnitude of changes that even dogcigar knows how to make.

Cities/settlements/etc. have names stored in text in the savegame file, and each has bits declaring how much detail about each one is visible in the world map. The world map seen in the game has icons and text of visible towns dynamically added on top of the static world map background bmp files.

Pirate Landmarks are different. The map is on a big grid, and pirate landmarks are created by setting single bits particular integer locations on the grid. Once the landmark exists at a particular location, the name is calculated by a complicated formula from the coordinates. [ I once worked out most of the formula. ]

This means that the mechanism for putting the town information onto the world map could not easily be extended to add landmark information.

On the other hand, the savegame file does include information showing what parts of the map you have seen, so it would be theoretically possible to calculate which Pirate Landmarks should show up on the map.

So one outside of the game method that probably is feasible would be to run a script that would analyze a particular savegame, see which landmarks are visible, calculate their names (at least partially), and then write the names and icons onto the world map background .bmp files (keeping a clean backup, of course). You would have to exit SMP and rerun the script occasionally to update your maps. I think I could write such a script, if you are really interested.
Back to top
View user's profile Send private message
parksbanyon
Gunner
Posts: 564



13127 Gold -

PostPosted: Sun Jul 28, 2013 3:10 pm    Post subject: seems nefarious for them not to be coded originally Reply with quote

I will follow up a bit to see where/how exactly they show up, it should be the feature map correct? I just compared the 2 saves and there are several "landmarks" i.e. arch rock stonehead totem pole showing. I don't remember landing anywhere. I'll do a quick redo, initial arrival 1st save then save as soon as I pass the first "seaside" landmark and see what changes there are.
My first priority is to get your East Indie mod up and running (see that post for my problem) as several other Winblows users are interested in it. Sorry that one really shouldn't be so problematic but my head isn't in script-lingo mode yet.
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sun Jul 28, 2013 3:19 pm    Post subject: Reply with quote

In the pst file they look like this:

FeatureMap_179_169 : F1 : 10 : (Landmark)
Back to top
View user's profile Send private message
parksbanyon
Gunner
Posts: 564



13127 Gold -

PostPosted: Thu Aug 01, 2013 8:05 am    Post subject: on to the next problem Reply with quote

Ok the East_indies mod is now working (see that thread) sorry to have taken liberties with your patch file but I wanted it up and running for windows users. After all that, I still had to redo the mod as I already have a cusotm exe and modded text ini.

Literally, my heart skipped a beat when I first ventured on to uncharted waters.

More than ever the mod to get the landmarks to show would be handy. I had a hard time finding the sister even with all the map. The "..in the vicinity.." of txt can be dicey now as some of the anchored cities are quite far apart.
Back to top
View user's profile Send private message
parksbanyon
Gunner
Posts: 564



13127 Gold -

PostPosted: Thu Aug 01, 2013 8:05 am    Post subject: on to the next problem Reply with quote

Ok the East_indies mod is now working (see that thread) sorry to have taken liberties with your patch file but I wanted it up and running for windows users. After all that, I still had to redo the mod as I already have a cusotm exe and modded text ini.

Literally, my heart skipped a beat when I first ventured on to uncharted waters.

More than ever the mod to get the landmarks to show would be handy. I had a hard time finding the sister even with all the map. The "..in the vicinity.." of txt can be dicey now as some of the anchored cities are quite far apart.
Back to top
View user's profile Send private message
parksbanyon
Gunner
Posts: 564



13127 Gold -

PostPosted: Fri Aug 02, 2013 11:38 pm    Post subject: update Reply with quote

The exe gets the names in 2 parts from the text.ini [TREASURE] and [ROCK].

On a PC exe in the vicinity of 003097A0 is a ref to : @TREASURE @ROCK@MAPLEGEND

In the .savegame it clearly appears only on the sailing map AFTER you pass it (EXAMPLE):
slotsavegame:
SailingMap_295_118 : F1 : 02 : (shipwreck)
SailingMap_282_138 : F1 : 02 : (shipwreck)
SailingMap_269_141 : F1 : 02 : (shipwreck)

Notice it treats them and ID's them identical to the shipwreck formations. On the above example 2 are "named" shipwrecks/treasure rocks and 1 is a standard unnamed generic shipwreck.

BTW on another post you referenced the e section of the savegame. I take it it is an event log of some sort?
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sat Aug 03, 2013 1:05 am    Post subject: Reply with quote

Alas, the names of sections in the pst file are things I made up. (The pst file is a text file that includes all of the information in the pirates_savegame file) I started with letters for each section, then replaced them with more descriptive titles ("Ship", "CityInfo", "Log", "SailingMap", etc.) when I understood what is going on in that section. "e" is one of the last ones that still has just a letter, with only a few bytes decoded.

What do you mean by a "named shipwreck" ? Could you post a screenshot? I've noticed that shipwrecks accumulate where you have sailed; I've wondered if sinking ships actually creates shipwrecks.
Back to top
View user's profile Send private message
parksbanyon
Gunner
Posts: 564



13127 Gold -

PostPosted: Sat Aug 03, 2013 7:23 am    Post subject: screenshot Reply with quote

"Knife Shallows" Devils Reef" and at the extreme far right edge same latitude are the 3 shipwrecks called out in the save game.
slotsavegame:
SailingMap_295_118 : F1 : 02 : (shipwreck)
SailingMap_282_138 : F1 : 02 : (shipwreck)
SailingMap_269_141 : F1 : 02 : (shipwreck)

Changing the values do not change anything, so apparently they are initially "hard" seeded and only appear in the sailing map portion once you pass them. As far as I can tell the info does not appear to be stored elsewhere in the savegame i.e. stored in xxxmap or e or j whathaveyou until "found" then also stored in sailing map.

https://dl.dropboxusercontent.com/u/3742149/Shipwreck.png
Back to top
View user's profile Send private message
parksbanyon
Gunner
Posts: 564



13127 Gold -

PostPosted: Sat Aug 03, 2013 9:03 am    Post subject: map features Reply with quote

Jlangslo, I don't mean to sound critical as I said b4 in the beginning everyone wanted custom maps and it took 8 years b4 you did it for the first time. I have glanced thru your .tga and landscape ini and it is way over my head.

My comment is, I find the extreme hilliness very disorienting. On games I was able to customize maps, I realized that to import true topo's I would have to tone down the real altitudes to give it a more realistic look ingame.

A previous mention on game crashes and seams. I have the ATI X300 vid card which is like 499 on the list of bottom rated 500 cards, and Pirates! usually plays glitch free. With your mod it hangs for a microsecond in certain areas which I think is when i pass over the original coastlines (old: water/land new: water/water) but it is a microsecond. I have done 50 or so savegames (research) and have never had a crash tho.

Just out of curiousity, did you globally raise the water level first, or just change the texture and paint of the land masses to water?
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sat Aug 03, 2013 11:40 am    Post subject: Reply with quote

Argh, you're mixing the threads. Oh, well.

Some of the details about the files and scripts are on this thread:
"Move landscape and change it! (screenshot example here)"
(started in 2005...)

The world in SMP is built up of 58 island groups placed on a deep ocean background. Each island group is scaled and placed on the map in landscape.ini. In the Caribbean, the continental coastline is broken into several island groups, with very smooth seams. [When I was figuring this out, one edit was to adjust the X coordinate of Coastal1 in landscape.ini slightly - this shifted Florida to the east and created a channel I could sail up into the continental US.]

For the East Indies map, I started by downloading a topographical map from NOAA here: http://www.ngdc.noaa.gov/mgg/gdas/gd_designagrid.html

After tweaking the scaling and offset exactly the way I wanted it, I wrote a script to cut the map into a grid of 28 blocks and write out island group files representing the topology in each spot of the grid. I took the largest of the Caribbean island groups, Coastal1, as the base. This way I didn't have to actually look at the map to distinguish the real island groups... but it means that the seams are much more visible. Also, I've never figured out exactly how the different scales for different island groups works.

Since this method derives everything about the land from the one topographical map, it's not as fancy as the Caribbean. The trees and shading are much more regular and boring.

In the East Indies, land and sea depths are scaled differently, but they are both based on the real topography of the East Indies as downloaded from NOAA. I tried to set a balance between "too hilly to be playable" and "so flat it's boring" in the Z scaling without faking it.
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sat Aug 03, 2013 11:51 am    Post subject: Reply with quote

Getting back to the main thread:

Knife Shallows and Devil's Reef look like Pirate Landmarks, not shipwrecks.

In the pst file, you should see lines like this for landmarks:

FeatureMap_199_233 : F1 : 10 : (Landmark)
FeatureMap_200_175 : F1 : 10 : (Landmark)
FeatureMap_202_178 : F1 : 10 : (Landmark)

and like this for shipwrecks:

SailingMap_355_51 : F1 : 02 : (shipwreck)
SailingMap_358_49 : F1 : 02 : (shipwreck)

You can test this by taking your favorite landmark or shipwreck and cloning that line in the pst file to make a line of them with slightly different locations:

FeatureMap_199_233 : F1 : 10 : (Landmark)
FeatureMap_200_175 : F1 : 10 : (Landmark)
FeatureMap_201_175 : F1 : 10 : (Landmark)
FeatureMap_202_175 : F1 : 10 : (Landmark)
FeatureMap_203_175 : F1 : 10 : (Landmark)
FeatureMap_204_175 : F1 : 10 : (Landmark)
FeatureMap_202_178 : F1 : 10 : (Landmark)

and then repacking the file like this:
pirates_savegame_editor.pl -pack slot6

then open that savegame up in SMP. If you sail to that location you will now see a line of Pirate Landmarks (with different names, since the names are generated from the locations).

If you compare a pst file created from an early savegame to one from later in the same game, I expect that you will see the same Landmarks but additional shipwrecks.
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sat Aug 03, 2013 12:10 pm    Post subject: Reply with quote

Also, I think I messed with the topography of Borneo to have some interesting features for the land battles.
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sun Aug 04, 2013 1:53 pm    Post subject: Reply with quote

I started the script. So far, it reads a savegame file and puts white diamonds onto the maximum zoomed in world map where the pirate landmarks are:



Next step is to find a font and write some text next to the diamonds, then wrestle with the exact names of the landmarks, then make only landmarks that you have sailed near become visible.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Customization & Modding All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group