Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is a project i have slowly been working on. There is yet very little progress, i haven't even started the tilemapper. One reason why i have not yet started the tilemapper is because i need a third 79KB buffer for partial redraw. My current plan is too use free ram (the location were programs are stored) as the third graphics buffer.

The main menu works and is 100% complete, key detection, drawing functions, and other stuff like that are working fine.

Really REALLY bad pic: (will try to get a better one this afternoon):

I also have a custom font renderer done Wink
This is for the CE?

I was wondering if you could explain your proposed buffer setup?

Minecraft on calc would be very nice!
Ok, i got every thing buffer related sorted out. Vram is ofc vRam. Vram+320*240 is the second buffer, this is used to double buffer the screen so that there are no sync errors and stuff; and lastly there is a third buffer in user ram (between (FPS) and (OPS)). The third buffer stores a rendition of part of the tilemap. It is used in partial redraw so i sont have to redraw the whole screen each fram.


Side note: progress on the tilemapper Smile
Why do you need another copy of the tilemap, rather than just storing a pointer to the tilemap's original data in your program or in an Archived appvar, wherever it happens to be?
Partial redraw Wink I dont redraw the whole tilemap each frame, only the left/right/upper/lower border. This makes the tilemapper a lot faster.
c4ooo wrote:
Partial redraw Wink I dont redraw the whole tilemap each frame, the left/right/upper/lower border. This makes it alot faster.
Wouldn't you just be shifting an existing half of the buffer and then drawing new tiles in, though? It's still not clear to me what that third buffer is for.
Well, the Vram+320*240 (graphBuff) buffer contains more than just the tilemap. It contains also the GUI, entities and more. Every time graphBuff is finished rendering, it is copied to vRam. This is to prevent the LCD from rendering an unfinished frame. TileMapBuffer only contains the tilemap. Every frame i copy TileMapBuffer to graphBuff, render the GUI and other things to graphBuff, and then copy graphBuff to vRam. Hope this explains stuff o/

Also, source code shall be uplouded here: https://github.com/c4ooo/Minecraft-Ti-84-Plus-CE/tree/master
I need some help with the tilemap engine. It sort of renders but there are visual bugs and stuff.
This code should load (tempVar4) with tileMap+(playerTileY)*1024+(playerTileX), right?

Code:

ld a,(playerTileY)
   ld hl,0
   ld h,a
   add hl,hl
   add hl,hl
   ld de,(playerTileX)
   add hl,de
   ld de,tilemap ;-10-(mapWidth*7)
   add hl,de
   ;ld hl,tilemap
   ld (tempVar4),hl

Next, this code should load (tempVar5) with (tileMapBuffer) + (playerOfsetY)*320 + (playerOfsetX)

Code:

   ld a,(playerOfsetY)
   ld hl,$00A000
   ld l,a
   mlt hl
   add hl,hl
   ex de,hl
   ld hl,(tileMapBuffer)
   or a
   sbc hl,de
   ld a,(playerOfsetX)
   ld de,0
   ld e,a
   or a
   sbc hl,de ;hl=(tileMapBuffer)-(playerOfsetX)-((playerOfsetY)*320)
   ld (tempVar5),hl

And this is the loop to render everything:

Code:

   ld b,15
drawWholeMapYLoop:
   push bc
   ld b,20
drawWholeMapXLoop:
      push bc
      ld hl,(tempVar4)
      ld de,0
      ld d,(hl)
      ld hl,tileset
      add hl,de
      ld de,(tempVar5)
      call render16x16 ;hl=sprite de=ptr to buffer
      
      ld de,(tempVar5)
      ld hl,16
      add hl,de
      ld (tempVar5),hl
      
      ld hl,(tempVar4)
      inc hl
      ld (tempVar4),hl
      pop bc
   djnz drawWholeMapXLoop
skipWholeMapXLoop:
   
   ld de,(tempVar5)
   ld hl,320*16-320
   add hl,de
   ld (tempVar5),hl
   
   ld hl,(tempVar4)
   ld de,mapWidth-20
   add hl,de
   ld (tempVar4),hl
   pop bc
   djnz drawWholeMapYLoop
   ret

Can someone see what is wrong? My tilemapper should rnder '0' tiles every were except the first row, which should be '1' tiles. It is doing that, but sometimes a '1' tile shows up on the left and right side of the screen in the second row. Next, when the (playerofsetX) is not 0 then the last column is rendered 1 pixel higher, but everything else is ok.
BTW, the above problem has been solved...

In my y-sprite cliping code, i need to jump to tooSmall if de<(tilemapbuffer) and goto tooBig if de>(tilemapbuffer)+320*(240-16)


Code:

    push hl
    ld a,16
    ld hl,(tileMapBuffer)
    ex de,hl
    or a
    sbc hl,de
    bit 7,h
    push hl ;yea this is bad
    add hl,hl
    pop hl
    jp nz,tooSmall
   
    ld de,320*(240-16)
    or a
    sbc hl,de
    push hl
    add hl,hl
    pop hl ;this too
    jp z,tooBig
    pop hl
You should change your indenting to match your stack depth!


Code:
    push hl
        ld a,16
        ld hl,(tileMapBuffer)
        ex de,hl
        or a
        sbc hl,de
        jr c,tooSmall ; de was greater than hl; that is, (tilemapbuffer) > de
   
        ld de,320*(240-16)
        or a
        sbc hl,de
        jr nc,tooBig
      pop hl
So first of all, there's no point in testing bit 7 of hl (also, you want to know about bit 7 of HLU, anyway, or even the carry bit. The code above first subtracts (tilemapbuffer) from de; if it (under)overflows, then it rolled through 0. Otherwise, the difference is still greater than zero, and it subtracts 320*(240-16) . If it doesn't roll through 0 now, then it was too large; otherwise, it was okay. Also, be aware that your brokenish code and my correct (hopefully) code both destroy de.
Thanks Kerm! Thanks to everyone's contributions I have finnaly put together a tilemapper: Very Happy
http://imgur.com/0EME5RW.gif (big file size)
Now i must work on speeding up the tilemapper, and creating a 2D world generator. I am interested in any advice you guys can give on world generation Smile
Nice, nice. Vaugely reminiscent of Minecrft but nicer looking; keep up the good work!
I dont know if i will keep working on it, but i restructured the entire project and rewrote the tilemapper. The source code is still here: https://github.com/c4ooo/Minecraft-Ti-84-Plus-CE/
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement