War2.ru Slogan
News: There's a new version of War2Observe that fixes the crash issue,
download from the downloads page today!


Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Welcome to the forums! We're glad to have you here! :) You can register your account here, then feel free to introduce yourself in the Server.War2.ru board & let us know who you are on the server.

Nerd's Corner 6525  144

Sappers Posts: 810 Karma: +57/-0 ******

Lambchops

  • Sappers
  • ******
  • *
  • Posts: 810
    • View Profile
Re: Nerd's Corner
« Reply #135 on: February 17, 2018, 02:47:47 AM »
CALCULATING  TERRAIN TILE VALUES

So I'm up to the terraforming bit of this whole map editor thing, and this is as good a place as any to document it as I go. The wc2 game background is made up of blocks of 8x8 pixel data that are constructed into 32x32 pixel 'tiles'. The tile value for each map location is stored as a 16 bit value in PUD files (MTXM section).

I use 3 letter abbreviations to denote the different terrain types as follows:

Code: [Select]
LTW - light water
DKW - dark water 
LTM - light mud(coast)
DKM - dark mud 
LTG - light grass
DKG - dark grass
TRE - trees
ROC - rocks
HWL - human wall
OWL - orc wall

Each 32x32 tile can be made up of either 1 or 2 terrain types. Tiles with only 1 terrain type I call solid tiles. Tiles with 2 terrain types I call border tiles.

NUMERICAL FORMAT

All tiles are stored as 16bit values, with the information encoded as a sequence of nibbles (4 bits). There are multiple versions of each tile which have slightly different graphics to create a more natural look to the map. For all tiles this pictorial variant is stored in the least significant nibble (bits 0-3) and these 4 bits have no other relevance to the game mechanics.

Code: [Select]
i.e.
0x0050 LTG variant 0
0x0051 LTG variant 1
0x0055 LTG variant 5
etc.

"FILLER" TILES

The light and dark mud and grass tiles have variants depicting objects - rocks plants skulls etc. numbered as follows:

Code: [Select]
LTG/DKG - 0-2 Plain Solid
LTG/DKG - 4-9 Filler Solid
LTM/DKM - 0-3 Plain Solid
LTM/DKM - 4-B Filler Solid
i.e. 0x0057 = LTG 4th filler tile (the one with the big rock)

Unused values for the variant nibble will be mapped as repeats of the other solid tiles.

SOLID TILE VALUES
Code: [Select]
0x001v - LTW
0x002v - DKW
0x003v - LTM
0x004v - DKM
0x005v - LTG
0x006v - DKG
0x007v - TRE
0x008v - ROC
0x009v - OWL (Single)
0x00Av - HWL (Single)
0x00Bv - OWL (central)
0x00Cv - HWL (central)
Where v designates the graphics variant.

SOLID WALL VARIANTS

Code: [Select]
v=0-1 Full
v=2   Damaged
v=3   Full
v=4   Destroyed
v=5-F Full

BORDER TILES

Border tiles are made up of 2 different terrain types. Not all terrain can co-exist on a border tile. Acceptable combinations are:

Code: [Select]
Value    (0) (1)
0x01Lv - LTW/DKW
0x02Lv - LTM/LTW
0x03Lv - LTM/DKM
0x04Lv - LTM/ROC
0x05Lv - LTG/LTM
0x06Lv - LTG/DKG
0x07Lv - LTG/TRE
Where v designates the graphics variant.
Where L designates the layout.

For border tiles the 2nd nibble represents the layout. Each bit in the nibble represents one quater of the tile.

Code: [Select]
  bit0 - bit1
   |      |
  bit2 - bit3

So for a grass/tree border tile like this:

Code: [Select]
TG
TT
(all trees except grass in the top right)
the bit values are

Code: [Select]
10
11

= 1101 binary

as border tile layouts dont represent solid tiles, the first value is 0001 not 0000 - which would be solid, however they are stored starting with 0 so at this point all values must have 1 subtracted from them

= 13 - 1
= 12   ( 0x0C )

so using 0x07Lv - LTG/TRE

this tile would be 0x07C0
or 0x07C1 for the other variant.

*border tiles have 2 variants each for corners and 3 variants for straight edges.

JOINED WALL TILES

Code: [Select]
0x08Lv - HWL Joined
0x09Lv - OWL Joined

The layout of joined wall tiles:

Code: [Select]
BIT  2
   3 # 1
     0

So for a 3-way join between walls left, right and below we need bits 3,1,0... so:
binary 1011 = decimal 11 (0x0B) -1 = decimal 10 (0x0A)

so OWL like this:
Code: [Select]
###
 #
= 0x09A0

*corners/joins have 1 variant straight joined walls (above&below or left&right) have 2 variants.

Death Knight Posts: 2694 Karma: +56/-2 retired, be in music section *********

easycompany

  • Death Knight
  • *********
  • Posts: 2694
  • retired, be in music section
    • View Profile
Re: Nerd's Corner
« Reply #136 on: February 18, 2018, 03:35:19 PM »
opps having to much fun...but i think i have may located units.

found some old dos stuff this is some kinda mod...not played it yet anyone knew these people?

and i believe units are here as i had every icon upgrading to a town hall...which is stats not a grp change.

and yes peons will go to it:P

well i can successfully hop out a foot archer or balista on paladin spot ..and put all units in the game and it has thier prices icon but it will not allow it to be made as some other part is stopping it....

what i think its doing is sending me back to the barracks to call it a orc barracks before a grunt can be made value, idk i hope not it cant be that dam difficult.

keep up with the good work lamby.
Sappers Posts: 810 Karma: +57/-0 ******

Lambchops

  • Sappers
  • ******
  • *
  • Posts: 810
    • View Profile
Re: Nerd's Corner
« Reply #137 on: February 19, 2018, 03:13:46 PM »
Almost ready for an alpha test of the basic editor. Have the terrain / terraforming / unit placement working reasonably well. Everything works at any zoom, so you can even view a large map full screen and still edit it. Can place half terrain tiles - like thin rivers etc.  :fro:

Havn't done a mini-map yet and it really doesn't need one - you just zoom in/out with the mouse wheel at any time. Will probably add one at some point I guess but it's not at the top of the list.

Still have a half-page TO DO list of things to tweak. Hopefully I'll get those done tomorrow then I'll need some testers (@easycompany and @tupac spring to mind :) ).

Still haven't done any unit editing - starting conditions ... etc. etc. although all that + all the tricks can be added once the basic GUI is nice and tight....  At the moment it does pretty much everything my old editor can't do and none of the things that it can lol.

 :critter:






Ogre Mage Posts: 2440 Karma: +77/-1 ********

tupac

  • Ogre Mage
  • ********
  • *
  • Posts: 2440
    • View Profile
Re: Nerd's Corner
« Reply #138 on: February 19, 2018, 10:12:22 PM »
Almost ready for an alpha test of the basic editor. Have the terrain / terraforming / unit placement working reasonably well. Everything works at any zoom, so you can even view a large map full screen and still edit it. Can place half terrain tiles - like thin rivers etc.  :fro:

Havn't done a mini-map yet and it really doesn't need one - you just zoom in/out with the mouse wheel at any time. Will probably add one at some point I guess but it's not at the top of the list.

Still have a half-page TO DO list of things to tweak. Hopefully I'll get those done tomorrow then I'll need some testers (@easycompany and @tupac spring to mind :) ).

Still haven't done any unit editing - starting conditions ... etc. etc. although all that + all the tricks can be added once the basic GUI is nice and tight....  At the moment it does pretty much everything my old editor can't do and none of the things that it can lol.

 :critter:







I'll test the shit out of it. Spawn the beta ;)
Death Knight Posts: 2694 Karma: +56/-2 retired, be in music section *********

easycompany

  • Death Knight
  • *********
  • Posts: 2694
  • retired, be in music section
    • View Profile
Re: Nerd's Corner
« Reply #139 on: February 20, 2018, 02:49:27 AM »
if u didt get that szawg i dont know how else to tell ya
Berserker Posts: 631 Karma: +34/-0 *****

Szwagier

  • Berserker
  • *****
  • Posts: 631
    • View Profile
Re: Nerd's Corner
« Reply #140 on: February 20, 2018, 11:16:44 AM »
if u didt get that szawg i dont know how else to tell ya
Maybe im blind, but where did u change missing objective  build 6 farms not 4??
Death Knight Posts: 2694 Karma: +56/-2 retired, be in music section *********

easycompany

  • Death Knight
  • *********
  • Posts: 2694
  • retired, be in music section
    • View Profile
Re: Nerd's Corner
« Reply #141 on: February 20, 2018, 11:55:26 AM »
naw i deleted dam it ..someday im gonna drink beer...we got a bigger mission...making units....well ill make it my goal,

ask tupac he messed with them at one time maybe in his sticky


---maybe a peon seeting in pud would allow it to build no idea.. just for lookage for now

lots of values if u  want to hex ill put u in the spot, so we can find out what everything is.
Sappers Posts: 810 Karma: +57/-0 ******

Lambchops

  • Sappers
  • ******
  • *
  • Posts: 810
    • View Profile
Re: Nerd's Corner
« Reply #142 on: March 25, 2018, 11:46:24 PM »
ALLIED COLORS ON MINI-MAP


This one was another idea from Nedro, it makes all allies blue and all enemies red on the mini-map.

You can toggle it on/off by pushing F2.



Ogre Mage Posts: 2440 Karma: +77/-1 ********

tupac

  • Ogre Mage
  • ********
  • *
  • Posts: 2440
    • View Profile
Re: Nerd's Corner
« Reply #143 on: March 26, 2018, 07:43:34 AM »
ALLIED COLORS ON MINI-MAP


This one was another idea from Nedro, it makes all allies blue and all enemies red on the mini-map.

You can toggle it on/off by pushing F2.





I like that!!!
Sappers Posts: 810 Karma: +57/-0 ******

Lambchops

  • Sappers
  • ******
  • *
  • Posts: 810
    • View Profile
Re: Nerd's Corner
« Reply #144 on: March 26, 2018, 09:38:32 AM »
I like that!!!

Cool. I assume it worked for you?

There's one case with windows 8 that I know of where it won't work. Probably some stupid windows security thing that is stopping it writing to the wc2 process. It works on XP and 7 so far.