π
<-

Age of CEmpires I

Assembleur, Axe, C/C++, ICE...

Re: Age of CEmpires I

Unread postby Ti64CLi++ » 28 Jan 2017, 15:20

I wait an update :)
Great job PT_ :bj:
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.5%
 
Posts: 3446
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi

Re: Age of CEmpires I

Unread postby PT_ » 01 Feb 2017, 20:49

I've uploaded all the files to Github, in case anyone wants to help or give tips.

https://github.com/PeterTillema/Age-Of-CEmpires-I
Age of CEmpires I - In progress!
40%
User avatar
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Level up: 57.2%
 
Posts: 259
Joined: 09 Feb 2016, 23:06
Gender: Male
Calculator(s):
MyCalcs profile

Re: Age of CEmpires I

Unread postby Adriweb » 01 Feb 2017, 21:44

Nice :)

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 79.9%
 
Posts: 14837
Images: 1131
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: Age of CEmpires I

Unread postby PT_ » 14 Feb 2017, 17:38

Time for some small updates. Last days I've been busy with optimizing the routine to display all the tiles at the screen. I've decided to add a border around the field, to avoid clipping, and with the help of both grosged and TheMachine, I got it down to like 711751 cycles, which is really good ;D When there are no more optimizations left, I will start with other stuff, such as the edges of the field and scrolling :)

Entire code (DrawFieldStart = mpShaData, AoCEDisplayIsoTile = cursorImage):
Code: Select all
DrawField:
   scf
   sbc hl, hl
   ld (hl), 2
; Speed: 722161/721349/711751 cycles
   ld hl, -3
   jp mpShaData
   
DrawFieldStart:
   add hl, sp
   ld (TempSP2 - AoCEDisplayIsoTile + cursorImage), hl
   ld hl, (currDrawingBuffer)
   ld de, 15
   add hl, de
   ld (startingPosition - DrawFieldStart + mpShaData), hl
   ld de, 8*320
   ld b, 29
DisplayEachRowLoop:
   bit 0, b
   exx
startingPosition = $+2
   ld iy, 0
   ld a, 10
   jr nz, DisplayRowOfTilesLoop
   dec a
   lea iy, iy+16
DisplayRowOfTilesLoop:
   ld hl, _tile_test \.r2
   call cursorImage
   lea iy, iy+32
   dec a
   jr nz, DisplayRowOfTilesLoop
   exx
   add hl, de
   ld (startingPosition - DrawFieldStart + mpShaData), hl
   djnz DisplayEachRowLoop
   ret
DrawFieldEnd:
.echo DrawFieldEnd-DrawFieldStart

AoCEDisplayIsoTile:
; Thanks a lot to TheMachine02 and grosged for help and optimizations!
; Input:
;   IY = pointer to output
;   HL = pointer to iso sprite
;
; Bytes: 168 bytes
; Time: 2558 cycles

   lea de, iy
   ld ix, 0
   lea bc, ix+2
   add ix, de
   ld sp, 320
   ldir
   add ix, sp
   lea de, ix-2
   ld c, 6
   ldir
   add ix, sp
   lea de, ix-4
   ld c, 10
   ldir
   add ix, sp
   lea de, ix-6
   ld c, 14
   ldir
   add ix, sp
   lea de, ix-8
   ld c, 18
   ldir
   add ix, sp
   lea de, ix-10
   ld c, 22
   ldir
   add ix, sp
   lea de, ix-12
   ld c, 26
   ldir
   add ix, sp
   lea de, ix-14
   ld c, 30
   ldir
   add ix, sp
   lea de, ix-15
   ld c, 32
   ldir
   add ix, sp
   lea de, ix-14
   ld c, 30
   ldir
   add ix, sp
   lea de, ix-12
   ld c, 26
   ldir
   add ix, sp
   lea de, ix-10
   ld c, 22
   ldir
   add ix, sp
   lea de, ix-8
   ld c, 18
   ldir
   add ix, sp
   lea de, ix-6
   ld c, 14
   ldir
   add ix, sp
   lea de, ix-4
   ld c, 10
   ldir
   add ix, sp
   lea de, ix-2
   ld c, 6
   ldir
   add ix, sp
   lea de, ix
   ldi
   ldi
TempSP2 = $+1
   ld sp, 0
   ret
AoCEDisplayIsoTileEnd:

If you see optimizations, feel free to post it :P
Age of CEmpires I - In progress!
40%
User avatar
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Level up: 57.2%
 
Posts: 259
Joined: 09 Feb 2016, 23:06
Gender: Male
Calculator(s):
MyCalcs profile

Re: Age of CEmpires I

Unread postby grosged » 14 Feb 2017, 19:15

I can see a few optimisations ...But I need to know more about the final version of the routine DrawFieldStart as it will read several different sprites pointers according to a defined map, won't it ?
Size of that map also needed
And perhaps a diagonal manner/order for displaying isotiles would be faster ?... :p
User avatar
grosgedVIP++
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 30.2%
 
Posts: 770
Images: 75
Joined: 14 Sep 2011, 12:29
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Age of CEmpires I

Unread postby PT_ » 14 Feb 2017, 23:52

grosged wrote:I can see a few optimisations ...But I need to know more about the final version of the routine DrawFieldStart as it will read several different sprites pointers according to a defined map, won't it ?
Size of that map also needed
And perhaps a diagonal manner/order for displaying isotiles would be faster ?... :p

Well, the final algorithm for drawing fields, is first knowing the offsets (i.e. shifting the entire map), is really easy though. Next is that I need something that checks if the displayed tile is in the range of the tilemap or not, and if not, draw a black tile (the background). If we continue this, we can skip drawing the tiles where the base of the buildings are, so if a lumbercamp is located at (10,11), and that tile is in the screen boundaries, skip the drawing part, as the builing will already draw that tile. And yes, I've thought of a diagonal renderer, never did anything with it :P Oh, the map size will be around 200x200, but that can change if I want to ;)
Age of CEmpires I - In progress!
40%
User avatar
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Level up: 57.2%
 
Posts: 259
Joined: 09 Feb 2016, 23:06
Gender: Male
Calculator(s):
MyCalcs profile

Re: Age of CEmpires I

Unread postby grosged » 15 Feb 2017, 12:08

PT_ wrote:Well, the final algorithm for drawing fields, is first knowing the offsets (i.e. shifting the entire map), is really easy though. Next is that I need something that checks if the displayed tile is in the range of the tilemap or not, and if not, draw a black tile (the background). If we continue this, we can skip drawing the tiles where the base of the buildings are, so if a lumbercamp is located at (10,11), and that tile is in the screen boundaries, skip the drawing part, as the builing will already draw that tile. And yes, I've thought of a diagonal renderer, never did anything with it :P Oh, the map size will be around 200x200, but that can change if I want to ;)


Oh, I thought the display would be composed of this unique isotile format only. So, a building would require another way of displaying. In that case, you're not forced to skip isotiles just up as when "non diagonnaly" displaying from top to bottom, thoses isotiles would be, er...,"overwritten" (of course, one manner or other choosen according to speed ;) )

Concerning simple isotiles, you'd just have to add 2 half-tiles display routines already included in the DrawFieldStart routine to get rid off clipping troubles:
|><><><><><><><><><|
<><><><><><><><><>
And concerning building shape, why not beginning drawing from bottom to top : thus , it would be easier to know when to stop ;)

I hope my explainations are clear enough :p

EDIT: I forgot : obviously we'd also need 2 other half-isotiles : the "V" shape for top 1st line , and the "delta" shape for bottom last line ;)
User avatar
grosgedVIP++
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 30.2%
 
Posts: 770
Images: 75
Joined: 14 Sep 2011, 12:29
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Age of CEmpires I

Unread postby Wistaro » 16 Feb 2017, 09:19

Oh, you switched to ASM :p

Do you want to (re)write the entire program in ASM?
Nouveau sur le site, ClaudeBot [spider] ? Avant de poster sur le chat et sur le forum, n'oublie pas de lire les règles. En cas de problème, tu peux m'envoyer un message, je réponds rapidement.

Liens utiles:
Image
Découvre mes programmes et mon site!
User avatar
WistaroSuper Modo
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 88.5%
 
Posts: 3191
Images: 37
Joined: 25 Feb 2013, 16:21
Location: Toulouse
Gender: Male
Calculator(s):
MyCalcs profile
Class: Ingénieur en électronique
YouTube: Wistaro
Twitter: Wistaro
GitHub: Wistaro

Re: Age of CEmpires I

Unread postby PT_ » 16 Feb 2017, 11:03

Wistaro wrote:Oh, you switched to ASM :p

Do you want to (re)write the entire program in ASM?

Well... yes :P I find ASM much easier to write (Mateo: keep calm ;)), so I switched to ASM.
Age of CEmpires I - In progress!
40%
User avatar
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Level up: 57.2%
 
Posts: 259
Joined: 09 Feb 2016, 23:06
Gender: Male
Calculator(s):
MyCalcs profile

Re: Age of CEmpires I

Unread postby PT_ » 17 Feb 2017, 22:06

Got smooth scrolling working! :)

Image

It can actually be like 3 or 4 times faster, I disabled it for now to show it ;)
Age of CEmpires I - In progress!
40%
User avatar
PT_Programmeur
Niveau 13: CU (Calculateur Universel)
Niveau 13: CU (Calculateur Universel)
Level up: 57.2%
 
Posts: 259
Joined: 09 Feb 2016, 23:06
Gender: Male
Calculator(s):
MyCalcs profile

PreviousNext

Return to Langages alternatifs

Who is online

Users browsing this forum: ClaudeBot [spider] and 12 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1298 utilisateurs:
>1244 invités
>46 membres
>8 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)