These are chat archives for pixijs/pixi.js

9th
Jan 2016
Micheal Winger
@mordof
Jan 09 2016 19:50
So i found this: http://jsbin.com/titibisogu/1/edit?html,js,output - i've been wondering about how one would make a height/layering system overtop of an iso tiled map? this method for drawing and mouse tracking just does some math to find out if the x, y of the mouse is within a certain spot - and can safely assume that it hits the correct tile due to it being all on the same plane, and no other objects needing interaction.
anyone have any thoughts, or papers on how to track what the mouse is over if the land could have hills - and players/objects would overlap tiles?
Micheal Winger
@mordof
Jan 09 2016 19:56
i tried to write a 2d iso tilemap system with height (hills/large objects), and the way i tried it at that point was to create a buffer canvas, and render each item a different color. that method was slow and had some issues with color blending that canvas forced on me. i don't think that'd be the case with pixijs though if it came down to being the best method
my old system i tried to make was just 2d canvas
ah - gotta go look at a house, i'll be back in a little bit
Ivan Popelyshev
@ivanpopelyshev
Jan 09 2016 20:46
@mordof did you try my lib? :)
i mean about performance
ah
its about interaction.. hm
Micheal Winger
@mordof
Jan 09 2016 20:53
@ivanpopelyshev i haven't got a chance to really go through how to set things up properly. the full demo that i'd like to actually fiddle with has a lot of code involved. i've saved it and am gonna dig into it soon though
@ivanpopelyshev and yeah - my question is more about technique of how to implement
Ivan Popelyshev
@ivanpopelyshev
Jan 09 2016 21:53
PIXI uses straight-forward approach
you have to override containsPoint(p) function :)
you can do that to: if you implement a method that returns whether the tile has point (p) and its height, then the task is done
Micheal Winger
@mordof
Jan 09 2016 21:57
@ivanpopelyshev that means i'd have to check all objects on the scene though doesn't it?
Ivan Popelyshev
@ivanpopelyshev
Jan 09 2016 21:57
you dont have that much objects
you can check everything
Micheal Winger
@mordof
Jan 09 2016 21:58
the example isn't my code - i have no idea how many objects i'll have in mine
maybe i'm prematurely optimizing though in this case
Ivan Popelyshev
@ivanpopelyshev
Jan 09 2016 21:58
tiles can be grouped in chunks
and its better to render chunks than every single tile
Micheal Winger
@mordof
Jan 09 2016 21:59
you mean by putting a bunch of tiles together into containers?
Ivan Popelyshev
@ivanpopelyshev
Jan 09 2016 21:59
and containsPoint will actually check if point is in boundingbox first, then check all inner tiles
Micheal Winger
@mordof
Jan 09 2016 21:59
hmm