• Sprites and scrolling and BINs

    From Kirkman@VERT/GUARDIAN to All on Fri Jan 9 15:00:36 2015
    So I've been doing more experiments with sprites and scrolling and stuff.ããI've made some progress, but I've also run into some issues.ããFirst, echicken or MCMLXXIX or whoever, I have written a little function whichãcan be added to frame.js, called scrollCircular(x,y). All it does is eitherãpop or shift the frame data the create a constantly-looping scroll effect. Iãcan post the code before too long if you're interested.ããBut I keep running into trouble with BINs. Using techniques we talked about aãfew months ago, I make sprites and then mask their background to becomeãtransparent, so they can walk in front of things. This works. ããBut I still don't understand the color values stored by frame.data[x][y].attr.ãIn my case, I'm using green as the mask. What I have found is that if I loadãan ANSI image into the frame, the .attr for green characters is usually "2".ãBut if I load the same image in BIN format, suddenly the green characters areã"514." Why should these numbers be different? I don't get it.ããI also am not having much luck with my .BIN files. This is a multi-tieredãproblem, because I'm using a Mac. The newest versions of PabloDraw (which haveãMac and Linux versions) have issues with loading/saving BINs. So I run theãclassic version of PabloDraw in WINE, and use it to convert ANS files to BIN.ããI find that no matter how hard I try, the BBS simply will not display the BINãproperly. On the latest sprite I've been working on, the problem seems to comeãin the black characters. Not sure why. I posted some examples and some filesãon the Synchronet Facebook page if you're interested in looking:ããhttps://www.facebook.com/groups/448979361874853/636759266430194/ããI really want to get BINs to work because I want to use the sprite library.ãBut for now I've had to make do simulating that library and just using framesãwith ANS data loaded.ããHere's an example of what I'm trying to do:ããhttps://vimeo.com/116376889ãã////--------------------------------------------------ãBiC -=- http://breakintochat.com -=- bbs wiki and blogãã---ã þ Synchronetã
  • From MCMLXXIX@VERT/MDJ to Kirkman on Fri Jan 9 16:31:10 2015
    Re: Sprites and scrolling and BINsã By: Kirkman to All on Fri Jan 09 2015 15:00:36ãã > I find that no matter how hard I try, the BBS simply will not display the BIã > properly. On the latest sprite I've been working on, the problem seems to coã > in the black characters. Not sure why. I posted some examples and some filesã > on the Synchronet Facebook page if you're interested in looking:ã > ã > https://www.facebook.com/groups/448979361874853/636759266430194/ã > ã > I really want to get BINs to work because I want to use the sprite library.ã > But for now I've had to make do simulating that library and just using frameã > with ANS data loaded.ããWhen you create the Frame() in which you are loading the BIN file, either useãno attributes or set it to BG_BLACK. The problem is that if you give a frameãdefault attributes, anywhere there is no data (no character or attribute for aãparticular sector) it will fill it in with the defaults, I'm assuming from yourãscreenshots that the attributes for the frame youre using are set to DARKGRAY,ãwhich would cause that anomaly.ããLet me know if this helps.ãã---ã þ Synchronet þ The BRoKEN BuBBLE (bbs.thebrokenbubble.com)ã
  • From echicken@VERT/ECBBS to Kirkman on Fri Jan 9 17:55:06 2015
    Re: Sprites and scrolling and BINsã By: Kirkman to All on Fri Jan 09 2015 15:00:36ãã Ki> But I still don't understand the color values stored byã Ki> frame.data[x][y].attr. In my case, I'm using green as the mask. What Iã Ki> have found is that if I load an ANSI image into the frame, the .attr forã Ki> green characters is usually "2". But if I load the same image in BINã Ki> format, suddenly the green characters are "514." Why should these numbersã Ki> be different? I don't get it.ããI see that MCMLXXIX has already responded, but just thought I'd add a note:ããIf you look in sbbsdefs.js where the attributes are defined, you'll see, amongãothers:ããGREEN = 2;ãBG_BLACK = 0x200;ããIf you OR the values of GREEN and BG_BLACK:ããvar attr = 0x200|2;ããYou will find that attr == 514.ããWhen you load a .ans into a frame, it likely contains sequences intended toãchange the terminal's current colour attributes. When Frame is parsing a .ans,ãit keeps track of what the current attributes are, so they carry over from oneãcell to the next.ããHowever in a .bin file, each character is paired with an attribute, and Frameãshould (arguably) be setting the attribute of each cell to the value read fromãthe file. Evidently it doesn't do this, and the default attribute for theãframe is being applied (as MCMLXXIX explained.) This may be by design, perhapsãit's necessary for transparency or helpful in some other situation.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.com - 416-273-7230ã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
  • From Kirkman@VERT/GUARDIAN to MCMLXXIX on Fri Jan 9 22:02:01 2015
    When you create the Frame() in which you are loading the BIN file, eitherã > use no attributes or set it to BG_BLACK. The problem is that if you give aã > frame default attributes, anywhere there is no data (no character orã > attribute for a particular sector) it will fill it in with the defaults,ã > I'm assuming from your screenshots that the attributes for the frame youreã > using are set to DARKGRAY, which would cause that anomaly.ããYes, this makes the difference. If I initialize the frame with BG_BLACK, theãBIN appears correctly. Thanks!ããHowever, I can't set this value when I make a sprite. ããI tried replacing "0" with BG_BLACK in the frame init routines on lines 874ãand 1384 of sprite.js:ããthis.frame = new Frame(x, y, this.ini.width, this.ini.height, BG_BLACK,ãparentFrame);ããThis worked. The sprite rendered properly and I was able to mask it, noãproblems.ãã--Joshããã////--------------------------------------------------ãBiC -=- http://breakintochat.com -=- bbs wiki and blogãã---ã þ Synchronetã
  • From MCMLXXIX@VERT/MDJ to echicken on Sat Jan 10 13:14:33 2015
    Re: Sprites and scrolling and BINsã By: echicken to Kirkman on Fri Jan 09 2015 17:55:06ãã > However in a .bin file, each character is paired with an attribute, and Framã > should (arguably) be setting the attribute of each cell to the value read frã > the file. Evidently it doesn't do this, and the default attribute for theã > frame is being applied (as MCMLXXIX explained.) This may be by design, perhã > it's necessary for transparency or helpful in some other situation.ããBIN files store a null bit in every spot where there is no character orãattribute. If you use pablodraw to make a BIN, it doesn't fill every space withãdata, so these spots show up in the frame with no character or attributes.ããIt might make more sense to load BIN files into a frame that has no defaultãattributes at all (just omit the parameter for attr).. this is how transparencyãworks in frame.js.. ãããã---ã þ Synchronet þ The BRoKEN BuBBLE (bbs.thebrokenbubble.com)ã
  • From MCMLXXIX@VERT/MDJ to Kirkman on Sat Jan 10 13:17:05 2015
    Re: Re: Sprites and scrolling and BINsã By: Kirkman to MCMLXXIX on Fri Jan 09 2015 22:02:01ãã > Yes, this makes the difference. If I initialize the frame with BG_BLACK, theã > BIN appears correctly. Thanks!ã > ã > However, I can't set this value when I make a sprite.ã > ã > I tried replacing "0" with BG_BLACK in the frame init routines on lines 874ã > and 1384 of sprite.js:ã > ã > this.frame = new Frame(x, y, this.ini.width, this.ini.height, BG_BLACK,ã > parentFrame);ããif you pass "undefined" instead of "BG_BLACK" (without quotes) it will let youãuse transparency on the sprite. It's probably worth noting that if you reallyãwant that black outline around your sprite, you should explicitly draw it inãthe BIN file (instead of just leaving those spots empty) so that if you do useãtransparency that black outline wont be masked.ãã---ã þ Synchronet þ The BRoKEN BuBBLE (bbs.thebrokenbubble.com)ã
  • From Kirkman@VERT/GUARDIAN to MCMLXXIX on Sat Jan 10 14:07:11 2015
    Re: Re: Sprites and scrolling and BINsã By: MCMLXXIX to Kirkman on Sat Jan 10 2015 01:17 pmãã MC> if you pass "undefined" instead of "BG_BLACK" (without quotes) it will letã MC> you use transparency on the sprite. It's probably worth noting that if youã MC> really want that black outline around your sprite, you should explicitlyã MC> draw it in the BIN file (instead of just leaving those spots empty) soã MC> that if you do use transparency that black outline wont be masked.ããI actually did that, in fact. I was careful to make the black outline usingãthe solid rectangle character (as opposed to a space) with black FG and blackãBG. But just because I drew it that way doesn't mean PabloDraw output it thatãway. I know there are other issues with the way PD outputs BIN files, and I'veãfiled a bug report on those:ããhttp://picoe.ca/forums/topic/bin-handling/ãã--Joshãã////--------------------------------------------------ãBiC -=- http://breakintochat.com -=- bbs wiki and blogãã---ã þ Synchronetã