Overview of reading meta

Post Reply
User avatar
CaptainPoopface
Posts: 714
Joined: Sat Feb 16, 2008 5:47 am

Overview of reading meta

Post by CaptainPoopface »

Could someone please give me an overview of the process of reading meta values from a .map file? How are plugins used to index into a map? Could I see a pseudo-code example of, let's say, changing the number of rounds in the magnum clip?

Where I'm going with this is a program that can script a set of meta changes so that you (more specifically, I) can rapidly apply meta edits to any set of maps, with no need to patch maps one by one and link tags manually. It would also alleviate some SLC problems I have been having.

Phase 2 would be batch injecting tags into a set of maps, but let's see if I can crawl before I try jogging.

I have programmed in C# and Java (mostly Java, for a couple of years). I want to do this in C#.
DarkShallFall
Posts: 710
Joined: Thu Jan 03, 2008 5:29 pm

Re: Overview of reading meta

Post by DarkShallFall »

Use save/inject meta in entity?
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Overview of reading meta

Post by troymac1ure »

For starters, grab HaloMap.DLL and link it into your program. Then loading a map is easy.

Here's a very small program I wrote ages ago that uses a basic loading technique from Entity's code:
http://www.remnantmods.com/files/troy/MapTagCompare.rar

I believe the Meta.ScanMetaItems() function has a bool as to load using plugins or not, but it's been a long time. Start with this and if you have issues, just post and one of us will help out.


I would highly suggest for scripting purposes to use offsets instead of plugin names as names change throughout plugin releases. For example, when adding the Custom plugins to Entity (which would allow selected tags and/or selected values within tags) I would write a list of all offsets into the registry with a boolean value stating if it is displayed/hidden under each tag.

For example, in the SBSP tag, I may wish to access "Detail Objects\Resources\Offset" which works fine until I use a different set of plugins which now lists it as "Detail Objects\Unknown\Unknown" and is now not found. Instead, even if you let the user visually select it by name, store it into the script as the offsets, such as "172\56\12" as these will never change.
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: Overview of reading meta

Post by XZodia »

I think the best approach would be to make a Tag patching system. (I like a map patching system but for tags).
I would also suggest that you consider using my Map Stream libraries which are well suited for small programs like this.

The Tag patcher would compare the modded tag with the original and store the differences (look at the ppf format).
It would then be able to take those changes and apply them to the same tag in a different map.
Attachments
Map Stream.zip
(213.52 KiB) Downloaded 276 times
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
CaptainPoopface
Posts: 714
Joined: Sat Feb 16, 2008 5:47 am

Re: Overview of reading meta

Post by CaptainPoopface »

Thank you both for posting these. Having used the Map Tag Comparer, I know it's a handy program. It helps me figure out what I did on mods long ago! The source code looks straightforward too. Where can I get HaloMap.dll? Google is flooded with crap results for *.dll.

I like the idea of a tag patcher. I guess that is really what I would be making (and what I wish SPPF had been from the beginning). Xzodia, do you have an API or example program for your MapStream.dll?
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Overview of reading meta

Post by troymac1ure »

Halomap.dll is included in the Entity (Main Directory), Map Tag Comparer and numerous other projects. As well, Entity's source contains the source for HaloMap.dll if needed or desired for knowledge.
User avatar
Click16
Posts: 1941
Joined: Mon Dec 31, 2007 4:36 am
Location: United States

Re: Overview of reading meta

Post by Click16 »

Sorry to say this, but it would be best if you don't use a library, and get some help on figuring it out on your own. I can make a meta reader in about an hour from scratch, so contact me on Skype. (I use Skype much more than I use AIM.) My Skype is fatalkiller31.
Image
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Overview of reading meta

Post by troymac1ure »

Click16 wrote:Sorry to say this, but it would be best if you don't use a library, and get some help on figuring it out on your own. I can make a meta reader in about an hour from scratch, so contact me on Skype. (I use Skype much more than I use AIM.) My Skype is fatalkiller31.
True. Why buy flour from the store when you can make your own (http://www.wikihow.com/Make-Flour). Sure it takes a lot longer and you may as well go ahead carve the edges off those four square wooden blocks to make your cart roll smoother as well. It's always fun to spend your time reinventing things that are already done for you. :roll:
User avatar
Click16
Posts: 1941
Joined: Mon Dec 31, 2007 4:36 am
Location: United States

Re: Overview of reading meta

Post by Click16 »

troymac1ure wrote:True. Why buy flour from the store when you can make your own (http://www.wikihow.com/Make-Flour). Sure it takes a lot longer and you may as well go ahead carve the edges off those four square wooden blocks to make your cart roll smoother as well. It's always fun to spend your time reinventing things that are already done for you. :roll:
I'm also trying to push him away from using entity's map library. I'm not sure what you have done to it, but it's not good to learn from.
Image
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: Overview of reading meta

Post by XZodia »

CaptainPoopface wrote:Thank you both for posting these. Having used the Map Tag Comparer, I know it's a handy program. It helps me figure out what I did on mods long ago! The source code looks straightforward too. Where can I get HaloMap.dll? Google is flooded with crap results for *.dll.

I like the idea of a tag patcher. I guess that is really what I would be making (and what I wish SPPF had been from the beginning). Xzodia, do you have an API or example program for your MapStream.dll?
Here's the full library source code and program.
viewtopic.php?f=25&t=860&p=35147

Also, I've just uploaded the source to Mystery which uses the library (The code is unstable atm however):
viewtopic.php?f=10&t=2115&p=35149
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
Post Reply