0 Members and 2 Guests are viewing this topic.
Also with a lot of NPCs that would most likely slow the game down quite a bit. It's also a lot of work to implement all the NPC patterns and stuff.
Quote from: DJ_O on November 10, 2012, 03:37:59 pmAlso with a lot of NPCs that would most likely slow the game down quite a bit. It's also a lot of work to implement all the NPC patterns and stuff.If you only handle NPCs that are on screen it wouldn't be so bad, especially since squidgetx's maps are divided into submaps. The real issue here is that the screen isn't updated every frame, so not only would every NPC require a mask, you'd also have to save what was drawn below before drawing the NPC on top and then refill it before redrawing the NPC in its new position. And if you move while an NPC is moving, you'd either have to freeze the NPC and wait until you stop moving to continue its movement or use a different method to shift the screen. With only one or two NPCs on screen it probably wouldn't noticeably slow the game down, any more though and you'd likely start feeling the effects. It's really just a pain to code and would probably be easier just to rewrite the whole thing to use a slower but more flexible mapper that redraws the screen every frame
How could chickendude not know about chickens?
I'm not sure how TinyCraft's mapper works, but the fact that it uses 8x8 tiles gives it a huge advantage over anything that I can come up with right now. 8x8 tiles are fast and flexible, making it easy to build a grayscale redraw-every-frame mapper that could easily support moving chickens. On the other hand, if you don't update every frame, it's still not too difficult to save the screen, draw the chickens, and recall the image (which is what I could theoretically do...only it would cause a very very noticeable speed drop, plus I have to change/write an unaligned 12x16 mask routine, which I don't want to do just for the sake of having moving npcs.
Quote from: squidgetx on November 12, 2012, 12:50:21 pmHow could chickendude not know about chickens?Lol, didn't think about that one Quote from: squidgetx on November 12, 2012, 12:50:21 pmI'm not sure how TinyCraft's mapper works, but the fact that it uses 8x8 tiles gives it a huge advantage over anything that I can come up with right now. 8x8 tiles are fast and flexible, making it easy to build a grayscale redraw-every-frame mapper that could easily support moving chickens. On the other hand, if you don't update every frame, it's still not too difficult to save the screen, draw the chickens, and recall the image (which is what I could theoretically do...only it would cause a very very noticeable speed drop, plus I have to change/write an unaligned 12x16 mask routine, which I don't want to do just for the sake of having moving npcs.I don't redraw the screen at every frame (that would be too slow) and can't save the entire screen either, that would be too slow and wouldn't work with the greyscale interrupt.But now that I think again about how they work, they have a drawback that will be very annoying for 16x16 sprites: they can't be drawn if they are too close from the border of the screen. Ideally, a border of 2 pixels would be needed (but since I code bad, I put a bigger limit ).So if there will be enemies in your game, not seeing them coming would be a huge issue
Quote from: Hayleia on November 12, 2012, 01:00:53 pmQuote from: squidgetx on November 12, 2012, 12:50:21 pmHow could chickendude not know about chickens?Lol, didn't think about that one Quote from: squidgetx on November 12, 2012, 12:50:21 pmI'm not sure how TinyCraft's mapper works, but the fact that it uses 8x8 tiles gives it a huge advantage over anything that I can come up with right now. 8x8 tiles are fast and flexible, making it easy to build a grayscale redraw-every-frame mapper that could easily support moving chickens. On the other hand, if you don't update every frame, it's still not too difficult to save the screen, draw the chickens, and recall the image (which is what I could theoretically do...only it would cause a very very noticeable speed drop, plus I have to change/write an unaligned 12x16 mask routine, which I don't want to do just for the sake of having moving npcs.I don't redraw the screen at every frame (that would be too slow) and can't save the entire screen either, that would be too slow and wouldn't work with the greyscale interrupt.But now that I think again about how they work, they have a drawback that will be very annoying for 16x16 sprites: they can't be drawn if they are too close from the border of the screen. Ideally, a border of 2 pixels would be needed (but since I code bad, I put a bigger limit ).So if there will be enemies in your game, not seeing them coming would be a huge issue Encountering enemies is gonna be Pokémon style, I don't see any problem about that.
-Draw the map using the bitmap routine because I don't have a clipped 12x12 tile routineWhile 1 ;main loop if key=left left() end if key=right right() end etc...display()endlbl rightreturn if check tilemapreturn if check npcscopy tiles to be shifted in (column 4 tiles to right of player) into spritebank (L1)shift those tiles over 1 nibble (remember tiles are 12x12 but stored as 12 rows of 2 bytes with a 0 in the 4th nibble)for 12 (run for 1 tile)...this part in assembly, see screenshift.asmfor all 64 rows on the screen;for those unfamiliar with asm, the rr (hl) command shifts hl right 1 bit (1 pixel), the bit shifted in comes from the carry flag, ;and the bit shifted out goes into the carry flagrr 2 bytes of the sprite bankrr the whole screen row;this shifts the whole screen like axe horizontal, only instead of shifting in blank pixels, it shifts in the rightmost column of pixels from the spritebank...end asmdisplay()endplayerX++if playerX is off the edge of the mapmapX++loadmapenddecide if an npc was scrolled in, if so draw it using nibble-aligned mask routinecheck if you're standing on a door, if so, warp to where it leadsreturnlbl leftlooks like right, only uses rl instead of rr and doesn't need to shift the tiles by 1 nibblelbl up/downsame as right, only asm routine is a little different for shifting verticallylbl displayis the map location box on? if so...decrease map location box time counterback up area of screen where map box is drawndraw map boxback up area of screen where character is drawndraw character using mask routinedispgraph^rwas there a map box? restore that area of the screenrestore the area of the screen where the character is drawnlbl loadmaptakes mapX, mapY as arguments (there is a large tilemap, a tilemap of tilemaps or metamap/overworld)decompress 9 16x16 tilemap chunks from archive into a 48x48 RAM tilemap in a 3x3 square where the middle one is the map with coords (mapX,mapY) (if there is no 16x16 chunk to load or if its value is zero, fill will black tiles)
Hayleia, I'm curious as to how you do your chickens then, if you don't save the screen nor redraw every frame.