Author Topic: A collaborative PUD editor.  (Read 29316 times)

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #60 on: February 25, 2017, 02:58:53 AM »
Good morning ladies,

Having noticed the somewhat deafening silence following the initial enthusiasm to this project, I have added another module. It does the starting resources for each player. For this I have also added some support routines for a few things including converting decimal strings to integers and vice-versa, which anyone considering doing something here would probably have been looking for.

I did post the last update right before Christmas, so anyone with and actual life may have missed it, so....
                                                 *BUMP*

  ... have a go and even if you havn't got a working module, if you post your initial code here, I will help.  :)
its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #61 on: February 26, 2017, 04:40:22 AM »
lol we all scattered

Hehe ... from what i could decipher of that post, ima upgrade "scattered" to "fully baked" - lol good for you. wp ;) But thanks for replying, EC, you're a trooper.

is it gonna be able to draw a pud and with added grime cut copy etc.....i mean this can be a master pud maker.

Well it can be whatever we want it to be... its only a matter of time and effort. No part of any PUD editing app - from the Blizz editor right the way through the list - is particularly complicated or technically challenging, its just a matter of making it happen.

I don't really want to devote big hours to sitting around coding the architypal PUD editor on my own, but I'm happy to contribute if others are willing to do so also. If a few people got enthusiastic about it, there's no reason why we couldn't produce a really slick PUD editor that does everything that we want to do with PUD files... i.e. all the things we can do with all the various tools all in one editor.

Then as it will be and open source colloboration, any time anyone comes up with a new idea (like say the "unbreakable wall" thing I did a while back) they can write a module to do it and add it into the editor.

At some stage I am planing to have it render the maps with the correct background terrain and unit graphics, as the Blizzard editor does. Not so much because this is really necessary for editing PUDs, just because it looks Uber Kewl 8) AND because I could then use that code as the basis for a new hi-res front end for the client.

I will do the graphics bit, when time allows, but as for most of the functions - like adjusting the unit properties or whatnot - these can be done as individual "modules" like I have done with the first couple of simple demo modules I made: For editing the Description string, and the starting resources.

ok on the makeit.bat ,system cannot find file??? i take this this is how you compile to it?

Yes. If you unpack the zip file into a single folder, you should just be able to double-click makeit.bat to compile the source. If it can't find a file this is probably because you don't have MASM32 installed on the computer. It's not a big download, and it's quite unobtrusive - dosn't mess with your OS and install everything AND the kitchen sink. I think its about 12MB download IIRC. Anyway, the make file expects it to be installed to "C:\MASM32" if you install it on a different drive, just use notepad to do a find/replace on "C:\" to "D:\" of whatever drive its on. (.BAT 'batch' files are just text files - right click and select 'edit').

... and of course there is a compiled .exe included in the zip file if you just want to have a look. Its just the source that's there compiled using that .bat file on my puter yesterday.

Have a look at the "modules" menu and then look at the corresponding PUDxxxx.inc source file..... and look at the PUDtemplate.inc file for instructions on how to go about making a module.

80 (00) value =01 bnet 00= custom map<--- very important this is set for custom maps

This could be a simple module: just have a single combobox with the 2 titles in it ... or maybe just use 'radio buttons' - whatever you like - to select "bnet" or "custom". Then have the code set the appropriate byte to 0x00 or 0x01, depending on what the selection is. Probably this would be included in a "Map Properties" module that would also set the map size, forest or winter... etc., but there's no reason why it can't be a module on its own either.


« Last Edit: February 26, 2017, 05:48:24 AM by Lambchops »
its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #62 on: February 26, 2017, 05:31:12 AM »
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.
its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #63 on: February 26, 2017, 05:41:47 AM »
great i'll look at it....and see if i can change your shit around so i can use my stuff :P

The project - simple as it is - can already load and save a PUD file and we can create modules to do anything we want to it. So if you have a 'trick' etc. that you can only do with a hex editor, I can help you make a module so you can use the editor easily to do it for you...
its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #64 on: February 26, 2017, 05:43:20 AM »
yea but its e0 (06) i was just bringing a example...i wouldnt use it at all....totally useless :P

Yeah, sweet. NP. I get it :)
its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #65 on: February 26, 2017, 06:55:04 AM »
Oh Hey, here ya go, found the section definitions. I downloaded this from somewhere in like 2002 or something   :D

PUD Format
Spoiler
Nope lol sorry was too big... so I attached it instead ;)

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 Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #66 on: February 26, 2017, 11:03:30 AM »
Simon Pelsser (Scorpions)....i got this dudes editor its good...
Oh good one. Havn't seen this before. Has a nice feel to the interface - big and easy to look at. I like that the player properties / starting conditions are all on the one dialog.

Although I have to say that my old editor does everything that this one does plus a whole lot more ;) Mind you, I did have all of Mr.Pelsser's research which he so kindly published to work with so big credit to him for that  8)

i can compile now!!! but the site had a big ass warning to new people loool i'm just mainly reading your code..and may steal :D im a terrible code pirate.

Oh cool Masm is a good thing. The DASM.bat batch file is handy too, just drop an .exe file on it and you get an instant disassembly in a text file.

No need to worry about big-ass warnings compiling this project. The only thing you could possibly mess up with it is a PUD file, and I'm sure you know how to make a backup copy of a PUD. Also you have all of the source code, and the guy who wrote it is happy to explain what every bit of it does ... until you get bored listening to him and head for the music thread lol :)

... and yes I'd be really happy if you reach the point where you can pirate bits of code from this project and use it for your own purposes ... go for it! After all the whole point is to to get people understanding ASM.  :fro:
 
its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #67 on: February 26, 2017, 01:31:08 PM »
i'm just mainly reading your code..


and you will probably want to have a look at the intro to ASM .pdf I posted a while back, if you haven't already, this will help you understand what's happening in the source.

Remember: You don't need to understand it all first off. You wont. That's normal. Just mess around with it and ask questions... the pieces will fall into place as you go.
its gooder to hax hard and NEVER get caught!

Offline shesycompany

  • Death Knight
  • *********
  • Posts: 3587
  • retired, be in music section
    • View Profile
Re: A collaborative PUD editor.
« Reply #68 on: February 27, 2017, 07:09:54 PM »
kk man still studying it,lots of pushing and pulling!
« Last Edit: February 27, 2017, 07:16:31 PM by easycompany »

Offline Delete mine too

  • Death Knight
  • *********
  • Posts: 2652
  • http://meatspin.com
    • View Profile
    • http://meatspin.com
Re: A collaborative PUD editor.
« Reply #69 on: February 27, 2017, 07:37:42 PM »
I'm going to try this out. Just been so busy with my new career. I never would of thought being a developer in a bussiness world would take all my free time and kill my motivation to finish programming old projects I started years ago. I even purchased a $1,200 alienware desktop and when I get home I don't even use it. So hopefully when I find the desire to return you will still be here.

Offline shesycompany

  • Death Knight
  • *********
  • Posts: 3587
  • retired, be in music section
    • View Profile
Re: A collaborative PUD editor.
« Reply #70 on: February 27, 2017, 09:28:56 PM »
yeah keeping  u exhausted..well break on fellers not like we in a rush,someone got there half gal of fruit juice, gone back to listen to some music.


i think i found some more people to play sc1 tupac
« Last Edit: February 27, 2017, 10:26:08 PM by easycompany »

Offline Igognito

  • Axe Thrower
  • ****
  • Posts: 406
    • View Profile
Re: A collaborative PUD editor.
« Reply #71 on: April 03, 2017, 09:07:29 AM »
Lambchops, accept my sincere apologies. I took a 2-3month brake from war2 and forum for real life issues.
I'm returning now, so I will start re-reading the post when I find some time (as this is long!).

I hope I will be able to help out with it :-)

Cheerios

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: A collaborative PUD editor.
« Reply #72 on: April 06, 2017, 04:50:59 AM »
Hi peeps  :)

I'm not much help right now as I only have my phone - no puter  :'(  Hopefully I will get that sorted out before too long.
If you're interested I'd recommend reading the latest README and source comments more than reading this post.

(Edit)
... and the PUD file format i attached a couple of replies back
« Last Edit: April 06, 2017, 04:55:05 AM by Lambchops »
its gooder to hax hard and NEVER get caught!