Join us on Discord!
You can help CodeWalrus stay online by donating here.

[ti-84+ce]Age of CEmpires I

Started by PT_, January 03, 2017, 08:22:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

E37

Sounds neat! Can you rotate the camera angle?

What are you working on next?
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Dream of Omnimaga

Great to see progress. I am curious about how much faster the new algorithm is :3=
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

PT_

It's not going super bad, as I expected. The blue rectangle was my test 'screen', and I need to change checking the Y coordinate..


Dream of Omnimaga

Do you mean on a real calc you only displayed whatever was in the rectangle?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

p2

The poblem he's talking about is which parts of the map to load // render.
especiallly on a calculator the time necesary for each step (loading, inputs, renddering, whatever) is extremely crytical.
So he has to optimize it to the absolute maximum  :ninja:

And yess I assume the blue rectangle is ment as a "screen" to test how far the program already distinguishs between fields to render and fields to ignore.

Awesome progress PT_ :) Keep working on it, you can do it!!  :thumbsup:
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CAS, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

PT_

Indeed, I test my algorithm to render only a part of the field to reduce time. The results are pretty good, although these are without the time needed to get the bounds, and not the entire screen:
Old: 17659450 clock cycles
New:  4131812 clock cycles
Not bad, but I fear still too slow :(

p2

U went from 17.7million to 4.1million, that's awesome!! :D
How much further would you need to reduce it?
also can omething be done by reducing the size of the ingle graphic tiles...?
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CAS, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

PT_

Indeed, the increasing speed is pretty nice, and it's almost the entire loop, I think filling the entire screen would take up 5 million clock cycles, which leads us to an FPS of almost 10. And I think not decreasing, but increasing the tile size would decrease the time to fill, as then clipping can be done in 1 time and then display, now it must clip 4 times.

MateoConLechuga

Nice work PT_! :)

Some comments to help speed things up:

Don't redraw the status bar every frame. Change the clipping region so you can update it only when necessary.
Don't erase the background with a fill routine. Use a background tile and have your rendering routine behave similar to a regular tilemapper.

Anywho, good luck! :)

p2

well if you're at 10FPS right now and you still use non-optimized rendering in some parts, then I dont see any problem :D
I guess that should be fast enough for the game ;)
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CAS, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

PT_

I've tried implementing what Mateo said, and I made a small routine that displays only the tiles, but it's still 6768350 cycles :(

If anyone can optimize it, I would be super happy :)

DrawField:
xor a, a
sbc hl, hl
ld (TilesYPosition), hl
push ix
ld b, 30
DisplayEachRowLoop:
push bc
ld ix, -20
bit 0, b
jr z, +_
lea ix, ix+16
_:
TilesYPosition = $+1
ld hl, 0
push hl
DisplayRowOfTilesLoop:
ld (AmountOfTilesLeft), a
push ix
ld hl, _tile_test
push hl
call gfx_TransparentSprite
pop hl
pop hl
lea ix, ix+32
AmountOfTilesLeft = $+1
ld a, 0
inc a
cp 11
jr nz, DisplayRowOfTilesLoop
pop bc
pop bc
ld hl, (TilesYPosition)
ld de, 8
add hl, de
ld (TilesYPosition), hl
djnz DisplayEachRowLoop
pop ix
ret

Sorunome

#56
Disclaimer: i've never written ez80 code

This doesn't use any window logic as somehow on IRC you couldn't tell me if you use that or not :P
Also this is all untested

Also I've never written ez80 asm

; this routine assumes tileMap is the tilemap, spriteSheet the spritesheet and screenBuf the screen buffer
; sprites are one byte in the tilemap
; tilemap is 255x255 tiles
; sprites are 32x16
DrawField:
ld hl,tilemap
ld de,screenBuf
ld b,255
_:
ld c,255
__:
ld a,(hl)
push hl
push de
push bc
call DrawTile
pop bc
pop de
ld hl,32
add hl,de
ex de,hl
pop hl
inc hl
dec c
jr nz,-__
; we need to fast-forward de ofc a bit more now
push hl
ld hl,255*16
add de,hl
ex de,hl
pop hl
djnz -_
ret


; ofc this could be inlined, it's just way easier to think about my code this way. If you inline this you save a few more cc. You can also unroll this
DrawTile:
push de

; let's first grab hl

; offset stuff times 512 = 32*16 = 8*16*4 = $80 * 4
ld h,a
ld a,$80
ld l,a
mlt hl ; h*l
add hl,hl ; *2
add hl,hl ; *4

ld de,spriteSheet
add hl,de

; ok our buffer thing is now in hl

pop de


ld a,16
_:
; copy a row
ld bc,32
ldir

; progress to the next row
ex hl,de
ld bc,(255 - 1)*32
add hl,bc
ex hl,de
dec a
jr z,-_
ret
  • Calculators owned: Too many (why are you even reading this?)
  • Consoles, mobile devices and vintage computers owned: Gamebuino!
This is a signature.
And now......give me an internet!

To be or not to be.........is that even a question? Who gets to decide this anyways?

tr1p1ea

He would need transparency but it is also a good idea to utilise a purpose built tile drawing routine as opposed to a general sprite routine.

Dream of Omnimaga

8 FPS would definitively be fine. 5-7 would be ok as well but only as long as keypresses are registered properly at any time (eg no missed keypresses) and processed immediately rather than one frame later.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

p2

are you kidding me soru, you learned ez80 within one day...  :ninja:
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CAS, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Powered by EzPortal