Author Topic: Nerd's Corner  (Read 109387 times)

Offline shesycompany

  • Death Knight
  • *********
  • Posts: 3587
  • retired, be in music section
    • View Profile
Re: Nerd's Corner
« Reply #105 on: April 02, 2017, 10:37:17 AM »
thought of a good use for this ..if u got a good printer..a war2 map art gallery in your house :P

excellent work lamb!

Offline Incos

  • Axe Thrower
  • ****
  • Posts: 253
    • View Profile
Re: Nerd's Corner
« Reply #106 on: April 03, 2017, 10:29:59 PM »




... and for those who are into such things, I've just done a big update to my

                Palette Editor (v1.0.2).

Nice edit to the tutorial. It's almost a sprite editors  if you could load up a bmp with say 60 frames or scroll on it. Really good





[/quote]
https://www.twitch.tv/incoswc - my twitch. Streaming 9:30pm - 11pm est most days!!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #107 on: April 06, 2017, 04:39:56 AM »
Nice edit to the tutorial. It's almost a sprite editors  if you could load up a bmp with say 60 frames or scroll on it. Really good

Yeah I'd like to do a GRP editor, but that will have to wait for now. Living in my car - nowhere to plug in my computer.... :(

its gooder to hax hard and NEVER get caught!

Offline shesycompany

  • Death Knight
  • *********
  • Posts: 3587
  • retired, be in music section
    • View Profile
Re: Nerd's Corner
« Reply #108 on: April 06, 2017, 01:05:21 PM »
 :'(  dam wish i could help lamb.
« Last Edit: April 06, 2017, 01:19:02 PM by easycompany »

Offline shesycompany

  • Death Knight
  • *********
  • Posts: 3587
  • retired, be in music section
    • View Profile
Re: Nerd's Corner
« Reply #109 on: April 29, 2017, 09:43:57 PM »
tupac put lamb stuff somewhere^ there as lamb stuff etc

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #110 on: January 30, 2018, 02:36:46 AM »
PUD File Format Stuff


Quote from: easycompany on 2017-02-26, 03:50:18

    hex(h)
    80 (00) value =01 bnet 00= custom map<--- very important this is


Ok. Not really sure, but I'm assuming the "80" at the start of this line is a file offset, i.e. the position in the PUD file where this value should be set ya??

Not sure, but i should give a quick description of how PUD files are formatted - perhaps you already know this IDK.

PUD FILE FORMAT

The PUD file format is like a simplified RIFF format (which, incidentally is what an AVI file is). It consists of sections. each section is formatted like this:

Code: [Select]

DWORD        4CC
DWORD        Size
(Size bytes)  Data


A '4CC' is a "four character code". It's just used like a name for the section, but it always contains exactly 4 characters ('DIVX' is a 4CC). 4CCs are kind of cool because they are easily readable by a human, and usually kind of describe what they denote, but also because they are exactly 4 bytes, and 4 bytes is a DWORD (32bit value) they can be handled by the processor as a single number and don't need to be processed as a string.... anyway, its a name that has 4 characters (letters).

i.e. the section that contains the starting gold for each player is called 'SGLD', and the section that contains the list of all the units on the map is called 'UNIT', while the section that contains the unit data (specs for each unit type... HP damage etc.) is called 'UDTA'

Most of the sections appear in all PUDs, some don't. i.e. the restriction section that allows a player to train certian units/upgrades but not others is called 'ALOW'. A 'normal' PUD that does not have any restrictions (you can have all the unit types) does not have an 'ALOW' section at all, however if this section is present WC2 will look at it and only allow the specified units/upgrades as per this section.

If you run my GrimEdit editor, and select Edit->Clipboard from the menu, you will see a list of common PUD sections. You can select the 4CC for each and it will display a (very) short description of what it is. You can then go to Modules->Player Properties, select a player, click one of the the "Units Allowed" etc. buttons and deselect a few things then click [Ok]. If you then go back to the "clipboard" you will see that an 'ALOW' section has been created and added to the PUD.

Many of the common sections that can appear towards the start of a PUD have a fixed length (i.e. 'SGLD' is always 32 bytes) which can make it appear that certain values occur at certain file offsets, because the sections are commonly written in the same order, however this is an illusion as the sections can be written in a different order or entirely new sections inserted into a PUD. ( this is how it is possible to create a file that is both a playable .PUD file and an executable .EXE file).

Also there are certianly sections whose length will vary from PUD to PUD... i.e. the size of 'UNIT' will depend on how many units are placed on the map.

It is by changing the sections that a PUD file is edited. If you look at the map description module in the ASM source you will see it loads/saves the 'DESC' section, while the Starting Resources module edits 'SGLD', 'SLBR' and 'SOIL'. There are (or used to be) descriptions of the common PUD sections floating around on the web.




                                      == :critter:== :peon:== :critter:== :peon:== :critter:== :peon:== :critter:==



Oh Hey, here ya go, found the section definitions. I downloaded this from somewhere in like 2002 or something   :D

PUD Format (Download)


So your offset 0x80 is the very start of the data for the 'UDTA' section.
You can see it here - random cusom PUD is Mini BGH (SS of my trusty Hex Editor - I wrote that golden oldie in '97 - been using it ever since  :P).



So the red box shows the section 4CC 'UDTA' the blue box contains the dword length of the data for that section - in this case 0x1640 bytes (5696 in ape numbers), and following that inthe green box is the value you are setting, which is actually a 2-byte 'WORD' value, but as it is either 0 or 1, the high byte (which comes second) is always 0, so only the first byte is modified.

As you can see from the included file:

------------------------------------------------------------
6: Section 'UDTA', Unit Data

        word            use default data (0 no, 1 yes)
        110 words       overlap frames
        508 words       obselete data (ignore it) was .....
-------------------------------------------------------------

... it's that first WORD value "use default data"

and just to illustrate the issue with using file offsets for this type of file, here's the same information from an earlier description of PUD internals, which is entitled "PUD Maximum File Format"
-------------------------------------------------------------------------
00:006A-00:006B   W Era number
        0=Forest,1=Icelands,2=Wastelands,3=Swamps
        *4-255=forest
00:006C-00:006F   $ Header description "ERAX"
00:0070-00:0073   L Expansion era data length ( 2 B)
00:0074-00:0075   W Expansion Era number
        0=Forest,1=Icelands,2=Wastelands,3=Swamps
        *4-255=forest
00:0076-00:0079   $ Header description "DIM "
00:007A-00:007D   L Dimensions data length ( 4 B)
00:007E-00:0081   W Map X and Y dimensions (0 ?? .. 128max)
        *Map is always loaded only by Y size
        *i.e. Y*Y map size
00:0082-00:0085   $ Header description "UDTA"
00:0086-00:0089   L Unit data length ( 5950 B )
00:008A-00:008B   W Set if Should be used default data
        0=no,1=yes

00:008C-00:0167   W Overlap frames for each unit (0..109)
        * group to belong number
        * see "UNIT" section for units order
00:0168-00:0265   W Obsolete General grafix frames
-------------------------------------------------------------------

However as you can see here the value is denoted as being at offset 0x8A because the PUD file being described also contains the optional 'ERAX' section.

The only thing that can be guaranteed is that it is the first WORD in the data for the 'UDTA' section.


The data lengths in each section header construct the file i.e. as the 'UDTA' section in the Mini BGH PUD here is 0x1640 bytes long and starts at 0x80 then the next section header will be at 0x1640 + 0x0080 = 0x16C0, and indeed if you go to offset 0x16C0 in this PUD you will find 'UGRD' the "Upgrades" section 4CC followed by the DWORD 0x0000030E because the data for this section is 0x30E bytes long...
its gooder to hax hard and NEVER get caught!

Offline Szwagier

  • Ogre Mage
  • ********
  • Posts: 1707
    • View Profile
Re: Nerd's Corner
« Reply #111 on: February 02, 2018, 03:31:54 PM »
If u want make map with "blizzard icon" you need add at end"..SIGN......"
If u want make map with "ladder icon" you need replace  TYPE...WAR2 MAP..˙",ć "VER ....DESC ...   into "D˝’Ş" 
« Last Edit: February 02, 2018, 03:40:29 PM by Szwagier »
http://www.youtube.com/user/SzwagierR


Equinox - the dumbest person in this game, do not argue with an idiot, because he will bring you to his level and overcome with experience

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #112 on: February 08, 2018, 12:30:46 PM »
If u want make map with "blizzard icon" you need add at end"..SIGN......"
If u want make map with "ladder icon" you need replace  TYPE...WAR2 MAP..˙",ć "VER ....DESC ...   into "D˝’Ş" 


Ok cool. Thanks for the info @Szwagier 

Im actually playing with making a new map editor at the moment. IDK if I'll end up having time to finish it, but it's an interesting project.



its gooder to hax hard and NEVER get caught!

Offline Delete mine too

  • Death Knight
  • *********
  • Posts: 2652
  • http://meatspin.com
    • View Profile
    • http://meatspin.com
Re: Nerd's Corner
« Reply #113 on: February 08, 2018, 05:02:25 PM »
If u want make map with "blizzard icon" you need add at end"..SIGN......"
If u want make map with "ladder icon" you need replace  TYPE...WAR2 MAP..˙",ć "VER ....DESC ...   into "D˝’Ş" 


Ok cool. Thanks for the info @Szwagier 

Im actually playing with making a new map editor at the moment. IDK if I'll end up having time to finish it, but it's an interesting project.






It's so beautiful!! 😢😢

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #114 on: February 09, 2018, 05:12:47 AM »
It's so beautiful!! 😢😢


Yeah it's pretty. Doesn't do very much yet though but I think I've got the bulk of the tricky bits out of the way.

Got the other 3 tilesets and unit colors working yesterday :)  It's interesting to watch a particular view switch from forest to winter to swamp and compare... never noticed before but AFAIK there's actually no existing way to do this.


its gooder to hax hard and NEVER get caught!

Offline shesycompany

  • Death Knight
  • *********
  • Posts: 3587
  • retired, be in music section
    • View Profile
Re: Nerd's Corner
« Reply #115 on: February 09, 2018, 08:35:04 AM »
 :o :o :o :o  :o  :o  :o  awesome .....how about a "tile part" in the pud a little mem editor can load peoples custom tiles???

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #116 on: February 09, 2018, 09:18:20 AM »
:o :o :o :o  :o  :o  :o  awesome .....how about a "tile part" in the pud a little mem editor can load peoples custom tiles???

There are no graphics in PUD files, that's all in EXE or MPQ.
its gooder to hax hard and NEVER get caught!

Offline Szwagier

  • Ogre Mage
  • ********
  • Posts: 1707
    • View Profile
Re: Nerd's Corner
« Reply #117 on: February 09, 2018, 09:24:18 AM »
http://www.youtube.com/user/SzwagierR


Equinox - the dumbest person in this game, do not argue with an idiot, because he will bring you to his level and overcome with experience

Offline Delete mine too

  • Death Knight
  • *********
  • Posts: 2652
  • http://meatspin.com
    • View Profile
    • http://meatspin.com
Re: Nerd's Corner
« Reply #118 on: February 09, 2018, 11:05:26 AM »
It's so beautiful!! 😢😢


Yeah it's pretty. Doesn't do very much yet though but I think I've got the bulk of the tricky bits out of the way.

Got the other 3 tilesets and unit colors working yesterday :)  It's interesting to watch a particular view switch from forest to winter to swamp and compare... never noticed before but AFAIK there's actually no existing way to do this.




What amazes me the most is how you can read the .pud and display the tiles correctly, units, and buildings. I can do unit data, stats, etc... just nothing with graphics....  I think you should add your offset editor to this map editor for more power ofcourse!! :) good job man keep it comming!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #119 on: February 10, 2018, 06:56:40 AM »
What amazes me the most is how you can read the .pud and display the tiles correctly, units, and buildings. I can do unit data, stats, etc... just nothing with graphics....  I think you should add your offset editor to this map editor for more power ofcourse!! :) good job man keep it comming!

well for background graphics I just cheated (of course ;)) and did this:

- wrote a program to go throught every map I have (all of them) and make a list of every tile value used
  ( I only found 515 and im pretty sure a lot of those were from test PUDs I have made)

- wrote those 515 tile values to a PUD then loaded it in SP mode, did "on screen" and used my full SS
  grabber to snap a BMP of them.

- wrote a prog to extract each 32x32 section of the SS then index them to the list of 515 tile values,
  ensuring that each tile was only saved once, and multiple tile values that ended up with the same
  graphics just produced multiple indexes to the same tile.

- repeated for forest, winter, wasteland, swamp then put 4x (the list, the index, the graphics) and some
  procs to access/display them in a dll and linked it to the editor.

This way I can just pass it an MTXM value and it will supply the graphics. :fro: It was actually pretty simple to impliment once I worked out the method.

The unit graphics is just displaying GRPs, which I have documented and written routines for already, so no big deal. There's GRP stuff I probably won't bother implimenting, like the different critter graphics or the swampy buildings, because they're not really very relevant to map making.




its gooder to hax hard and NEVER get caught!