• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Creating a raster: Struggle assigning data to raster point

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello,

the couple last days I worked on creating a map raster that divides the whole map into raster points with assigned data.
To specify, not every point on the map is a raster point, but only every point of an interval of 128, so terrain tiles are considered.

-> One terrain tile = one raster point

Now, I only worked on a very small area, 10x10 tiles, to test how it works.
Up to now, it works fine, but now I have a problem:

Every raster point ( remember, it is = one terrain tile) has assigned data, majorly integer values. For now I used a hashtable, though I think indexed variables will work fine, as we will see later.

-> Every raster point has assigned data, like terrain type, many integers, Booleans and a dummy unit.

Now the problem, every point has around 20 different data entries that has to be saved somehow. For a 10x10 tile test area it is not a greater problem, but as I said, I would like it to be pseudo-map-wide.

That means, a map of the size 64x64 would have (6400:128)² = 2500 raster points.
Even if I increased the tile size to an optimal size of 256, I would still have 625 raster points, with 20 entries per point,
so I would have to save 12500 entries manually.
I don't want to go in detail, but I have to save them manually, as its values are not generated, overall, but at least 625 entries have to be added manually, the rest can be added with conditions resulting from the first entry.

So, to visualize it more, here is an example for one point, only looking at integers:

k = number of entries per raster point
ManualInteger is an integer you have to set manually in the initialization
---
Set ManualInteger[1] = 1
Set ManualInteger[2] = 6
(...)
Set ManualInteger[k] = a

Set TempPoint = (0,0)

Loop b from 1 to 64x64 ( the raster size)

Set Point = Tempoint + interval + Conditions to check the current position row and such

Loop i from 1 to k

Set Integer = ManualInteger
Save Integer as IntegerValue of HashInteger in Hashtable

Set IntegerValue = IntegerValue +1

---
It adds the same integers for every point, of course, it will add different ones for every point.
It is a very rough example, but as you can see, I would have to set every Integer ManualInteger myself, which would be a lot of, speaking of hundreds, thousands.

Now, finally, my question.

I saw that the BonusMod on Hive uses something like
  • Item( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
to add values to an item.

I would like to use this method to at least reduce the count of information I have to add manually to the count of points.

How can I do this ? ( Using GUI/GUIJASS or add a JASS I did not write myself)

  • Point( Integer1, Integer2, Integer3, (...))
and get a certain value out of the column:

Save Integer1 as (...) of
Save Integer2 as (...) of
Save Integer3 as (...) of

I would be glad to receive an answer to this complex question/issue.
 

Ardenian

A

Ardenian

As you might notice, I already use hashtables, but the incredible amount of data that has to be saved manually, I search a way to reduce it.

I think the link/ posts there does not help me with this issue, does it ?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Must every node have data assigned to it? Or is it only some nodes (sparse data)?

Arrays will run out of indexes (they max at 8192).
Hashtables will perform very slowly (too many collisions so start to fall towards O(n) complexity).

A lot of the values could probably be initialized automatically or by specifying an area. The area could be in the form of a rect and the functions transform all nodes in the area.

You could also write some scripts or programs which convert image form of the data into an insert-able block of JASS. Where each pixel translates into appropriate set instructions or calls.
 

Ardenian

A

Ardenian

At the moment IcemanBo was so kind to explain me functions that allow me to add data to a tile. Even if it is still a hell to write, it is better than nothing, I guess.

Thank you, these information help me!
 
Status
Not open for further replies.
Top