How can I get a map's info and where ?

Discuss the future of Warzone 2100 with us.
Post Reply
User avatar
Terminator
Regular
Regular
Posts: 1077
Joined: 05 Aug 2006, 13:46
Location: Ukraine
Contact:

How can I get a map's info and where ?

Post by Terminator »

I wanted to add a map preview for my warzone Launcher. I dont need textures info just a heights and size of the map. ... and probably starting players coordinates.
I've look at http://developer.wz2100.net/wiki/MapFormat - is it current working format right ? Guide me plz where to look at. so I don't waste muck time in the wrong direction. Or may be point to some source code that parses map file. :geek:
Last edited by Terminator on 12 Jun 2016, 08:39, edited 1 time in total.
Death is the only way out... sh*t Happens !

Russian-speaking Social network Group http://vk.com/warzone2100
User avatar
Berg
Regular
Regular
Posts: 2204
Joined: 02 Sep 2007, 23:25
Location: Australia

Re: How can I get a map's info and where ?

Post by Berg »

there has been some work done already in that area look at jamesNZ's repo https://github.com/JamesWrigley/moodloader
User avatar
Terminator
Regular
Regular
Posts: 1077
Joined: 05 Aug 2006, 13:46
Location: Ukraine
Contact:

Re: How can I get a map's info and where ?

Post by Terminator »

wait... there are an *.ini files in maps ? Some maps does has it, some doesn't. What if no ini files in map's pack, how warzone handles that where is "he looking" at for a info. Seems like that wiki not really up-to-date map format or something.
Death is the only way out... sh*t Happens !

Russian-speaking Social network Group http://vk.com/warzone2100
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: How can I get a map's info and where ?

Post by Per »

Some more recent map editors would produce .ini files. They are no longer used, however. Version 3.2 and onward uses .json files, including a <map name>.json that can include default team setups. There is no documentation for this (yet), but you can get a feel for it by browsing around in the data/mp/multiplayer/maps directory in 3.2.
User avatar
Terminator
Regular
Regular
Posts: 1077
Joined: 05 Aug 2006, 13:46
Location: Ukraine
Contact:

Re: How can I get a map's info and where ?

Post by Terminator »

ok. json and ini - I got its, seems fine. But if I want to support maps from 2.3.x+ I need game.map to parse and *.obj files (json for 3.2) - right ?
So where is in source files the game parses "game.map" so I may look at ? plz.
Death is the only way out... sh*t Happens !

Russian-speaking Social network Group http://vk.com/warzone2100
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: How can I get a map's info and where ?

Post by Per »

The map loader is mapLoad() in src/map.cpp
User avatar
Terminator
Regular
Regular
Posts: 1077
Joined: 05 Aug 2006, 13:46
Location: Ukraine
Contact:

Re: How can I get a map's info and where ?

Post by Terminator »

ok. I've get loaded start-up game.map file, but I have a problem I dont know what is wrong with it. It like a accuracy loss or something

quick look at code http://pastebin.com/bPiLYp7E
Attachments
strtup_issue.jpg
strtup_issue.jpg (33.79 KiB) Viewed 6662 times
Death is the only way out... sh*t Happens !

Russian-speaking Social network Group http://vk.com/warzone2100
User avatar
Terminator
Regular
Regular
Posts: 1077
Joined: 05 Aug 2006, 13:46
Location: Ukraine
Contact:

Re: How can I get a map's info and where ?

Post by Terminator »

Am I right that map heights in range from -128 to 128 ? (or -127 to 127) ? May be the problem in this line with color
color = (dots[counter] + 128) / 2.56f / 100; (java's function requires color from range 0 to 1.0, so that's why I'm making this calculations)
Death is the only way out... sh*t Happens !

Russian-speaking Social network Group http://vk.com/warzone2100
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: How can I get a map's info and where ?

Post by Per »

Map height is stored as an 8 bit unsigned value, so map heights would be 0 ... 255
User avatar
Terminator
Regular
Regular
Posts: 1077
Joined: 05 Aug 2006, 13:46
Location: Ukraine
Contact:

Re: How can I get a map's info and where ?

Post by Terminator »

yea. I was converting byte in a wrong way. Oh this java with unsigned "support".
Death is the only way out... sh*t Happens !

Russian-speaking Social network Group http://vk.com/warzone2100
Post Reply