Issue with multiple sprites containing markers

Discussion about Mods for Prison Architect

Moderator: NBJeff

Mavoc
level1
level1
Posts: 10
Joined: Thu Sep 17, 2015 5:34 pm

Issue with multiple sprites containing markers

Postby Mavoc » Sun Sep 27, 2015 2:49 am

I have been having a hell of a time getting 2 objects, each with 1 slot/marker, to behave and display the loaded material in the correct location. I kept getting 1 object that worked correctly and the other having the loaded material noticeably offset from the marker position. After a ton of tinkering I finally managed to get them both to work as long as there was at least 64 pixels between each sprite in my file.

Has anyone else had similar issues with markers not functioning where you specified them?
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Issue with multiple sprites containing markers

Postby Brento666 » Sun Sep 27, 2015 4:48 pm

Hi Mavoc, is it stacks you are displaying?
If so, I think a single "Begin StackSprite ... End" in a materials.txt Object def, automatically implies 3 neighboring stack images; one for low, med, full... and you set the coordinates to the top left of the rightmost ... It can have RotateType 0 or RotateType 4 I think...
-> I would experiment with a portion of the sprite.png full of colored numbered squares, so you can see what sprite gets used when...

...I haven't yet processed or stored any of my stacks on a processor just yet, but plan to try it soon!


I have had my custom object fly offscreen consistently at the moment I set it's Slot0 ids to its own... I was pretty sure that I had seen mods using that to signal the object was unavailable... My static object literally flew away at warp speed!
-So for now I just don't mess with setting the slot ids.

Interested to hear if you fix your stacks or findout why this is bugging!
Mavoc
level1
level1
Posts: 10
Joined: Thu Sep 17, 2015 5:34 pm

Re: Issue with multiple sprites containing markers

Postby Mavoc » Mon Sep 28, 2015 10:52 pm

No, these are in essence 1x1 tables
Mavoc
level1
level1
Posts: 10
Joined: Thu Sep 17, 2015 5:34 pm

Re: Issue with multiple sprites containing markers

Postby Mavoc » Mon Sep 28, 2015 11:55 pm

The red squares are where the loaded object appears.
The alignment grid is set to 16 pixels.
The sprites are defined as follows with only the sprite's x/y changing as I try different placements in the map.

Code: Select all

   BEGIN Sprite         x 0  y 0  w 2  h 3  RotateType 4  TopAligned false
      BEGIN Marker      x 1  y 1  orientation.x 0  orientation.y 0  Index 0  END
   END


Edit: large imgs removed as the gif a few posts down displays it better and smaller
Last edited by Mavoc on Tue Sep 29, 2015 6:01 pm, edited 1 time in total.
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Issue with multiple sprites containing markers

Postby Brento666 » Tue Sep 29, 2015 2:32 pm

Hmmm, only thing I can think of that maybe might help is comment on orientation.x 0 orientation.y 0 not being a clear orientation...maybe 1 or -1 for the orientation.y making it clear north or south heading would help?
Or perhaps BlockedBy, Properties or Workgroup set to "StaticObject" on one of yer materials or objects I dunno!

-Is that consistently going on?
Mavoc
level1
level1
Posts: 10
Joined: Thu Sep 17, 2015 5:34 pm

Re: Issue with multiple sprites containing markers

Postby Mavoc » Tue Sep 29, 2015 5:59 pm

I now have multiple crates working by just using the locations I found to be good regardless of distance between each crate in the map.
Sadly it makes my map bigger then it needs to be due to the dead space.

Red square is where the loaded stack appears for each position. Notice that when the marker is out of place, it is moved to one of 3 specific locations that is near the intended location.
Image
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Issue with multiple sprites containing markers

Postby Brento666 » Tue Sep 29, 2015 8:06 pm

Freaky Freaky!! :roll:

So do you have multiples in your spritepng to compensate? Or do you work some other magic to correct this jitter?!
Trixi
level2
level2
Posts: 245
Joined: Wed Mar 04, 2015 9:22 am
Location: Ulm, Germany
Contact:

Re: Issue with multiple sprites containing markers

Postby Trixi » Tue Sep 29, 2015 8:24 pm

i dont understand your gif :(
Mavoc
level1
level1
Posts: 10
Joined: Thu Sep 17, 2015 5:34 pm

Re: Issue with multiple sprites containing markers

Postby Mavoc » Wed Sep 30, 2015 3:55 am

Brento666 wrote:So do you have multiples in your spritepng to compensate? Or do you work some other magic to correct this jitter?!

These were the first 2 crates my mod was using, but I have since added a few more for other uses. I have 3 along the right side as those spots work, and as I use more I use these images as a guide of where to place them.
My mod is most likely going to have a few sprites without markers when I get closer to completion that will hopefully have no issue going into these problem spots.


Trixi wrote:i dont understand your gif :(

Ignore the first crate and focus on the moving one. Each image has that crate in a different location in my sprites.png. This crate works like a 1 slot table for storing a specific item, in this case tree/saplings, which should get loaded directly on top. The red square shows the location the loaded object appears in game for each location the crate is located in the png.

I am starting to wonder if this is something on my end as I had the same thing happen to me with your workshop mod. The 3 slots of the WoodSaw were all out of place.
These are the 3 locations that the items appear as the job is being performed. And this is with only Trixi's "Improved Workshop (Log patch)" mod active.
Image
Trixi
level2
level2
Posts: 245
Joined: Wed Mar 04, 2015 9:22 am
Location: Ulm, Germany
Contact:

Re: Issue with multiple sprites containing markers

Postby Trixi » Wed Sep 30, 2015 8:41 am

Well i played a bit around with those markers. The sprite themself is easy to understand, but at those slots my brain just crashes.

And yes im just wondering, because on my game the items and workings are nearly at the position i want to have them (yes nearly not exact). Also i get regularly error like "working positions cant be reached.

it would be nice if your image would have the descriptions, what your spritedefinition looks like.to understand how to define those markes if you want to make your object rotatable (that the reason why the wood saw isnt rotatable, as those markers bugs even more out, then they already does)

To the rotatable object, that i also want to understand how to set the markers to it ...

Image
Mavoc
level1
level1
Posts: 10
Joined: Thu Sep 17, 2015 5:34 pm

Re: Issue with multiple sprites containing markers

Postby Mavoc » Wed Sep 30, 2015 10:39 am

The sprite code is in the 4th post and it is type 4 so there is no rotation. The fact that the woodsaw has correct item placement for you but not me really makes me wonder what on my end could be causing the issue.

All the vanilla objects seem to work correctly.
Trixi
level2
level2
Posts: 245
Joined: Wed Mar 04, 2015 9:22 am
Location: Ulm, Germany
Contact:

Re: Issue with multiple sprites containing markers

Postby Trixi » Wed Sep 30, 2015 5:02 pm

i chose rotatetyp 4, because those damn markes bugs out. its really like a big fog.
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Issue with multiple sprites containing markers

Postby aubergine18 » Sun Oct 04, 2015 12:44 pm

I've just implemented markers in my Circuit Isolator Mod (will upload to workshop later today). Here's what I've learnt so far...

Each object has at least 3 default marker positions even if not defined in materials.txt, at least on wide objects (think workshop saw). If you put something in to a Slot, ( this.Slot0 .. this.Slot7 ) then that thing will snap to the position of the marker. This is incredibly useful if you have an object that AttachToWalls as the slot positions will be automagically adjusted when the object snaps to walls. Custom marker positions can be defined in the sprite that's used for the object ( which can be changed with this.SubType ). If your object has multiple sprites, you'll need to define markers in each of the sprites. The marker 'index' is the id of the slot that the marker should relate to (as far as I can tell). You can use Chad's sprite editor to more easily place markers (you have to unhide them on the options tab to see them overlaid on the sprites.png): http://chadsmods.rdkf.net/tools/spriteeditor

For stacks, essentially materials, there's 3 sprites side by side for low, medium and high quantity. A good example to look at is Chad's Drinks Mod, particularly things like his paper cups and oranges. You can do something like create a box (standard game object that's similar to a stack) and then set it's .Contents and .Quantity properties (see scripting guide) to make the relevant sprite appear on the outside of the box - the Contents defines which material is in the box, the Quantity determines which sprite is used of the three sprites for the type of Contents.
Mavoc
level1
level1
Posts: 10
Joined: Thu Sep 17, 2015 5:34 pm

Re: Issue with multiple sprites containing markers

Postby Mavoc » Sun Oct 04, 2015 10:06 pm

I have concluded that there is something wrong with my game that is causing markers to not behave the same for me as with other people running the same mods. So I have put my mod that is marker heavy on hold in the hopes that the 1.0 patch will fix things for me. Seeing as I had been bouncing between 4 different mods this has helped focus me on getting something finished in time for the patch.

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 5 guests