MaxCoderz

for your 1 bit pleasure!

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: C&CG RTS
PostPosted: Thu 11 Mar, 2010 5:22 pm 
Offline
New Member
User avatar

Joined: Mon 13 Jul, 2009 6:23 pm
Posts: 16
I am planning on making a RTS game, I think it will be with modern guns. It is slightly based on Command and Conquer generals (in the design) and based on The Total War series in gamplay. Don't get me wrong, you won't be able to zoom but you will have predefined armies, there is no base from where you build your army it will all be choosen using a predefined amount of money.
To still your hunger for new concpets, some concept art...
Image

You can grab the image here: http://farm5.static.flickr.com/4009/442 ... c751_o.jpg

edit: I can just smell questions may arise about which programming language I will use, well I have figured that a combination of TI-BASIC and ASM works best for me. Simplybecause I lack the skill to program the whole game in assembly. So what I'll do is make routines for the sprites to be drawn and I can call them from a BASIC prgm like so:
Code:
0:Asm(prgmGH    ;this for example could be a ClearScreen routine
some more code...
11:Asm(prgmGH   ;this could be drawing a tank at the current values of X and Y
etc...


So it is going to be the ease of use in variables and lists from BASIC and the graphical superiority of ASM, together a COMMANDROUS combination! (COMMANDER is the game title, just I case you did not catch the joke...ooh well)

So what are your thoughts about this? Is it dangerous to combine ASM and BASIC like this? (I mean certain ASM routines might disturb the values in OP1-6 and thus cause the values of certain variables to screw up?


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Fri 12 Mar, 2010 10:20 am 
Offline
New Member
User avatar

Joined: Mon 13 Jul, 2009 6:23 pm
Posts: 16
OK, I have encountered a slight problem. Whenever I want to draw something I have to bring the graphscreen up. I know how to do this in basic and it works...but not entirely. Whenever I code a small BASIC prgm that changes the X value of the sprite so that it should move I get a blank graph screen until I break the program and goto the graphscreen manually, then I see everything...
Now I did copy a sprite routine from the net so I do not really know where this problem hides...Also I know there are some optimizations possible but this works and that is what counts for me, after it works the way i WANT it to work i'll optimize...

So here is the code I use
Code:
crz1spriteroutine:
   ;| Input: c is operator (1=and, 2=or, 3=xor)                          |
   ;|        d is x-position (min. -7, max. 95)                          |
   ;|        e is y-position (min. -7, max. 63)                          |
   ;|        ix is sprite-address                                        |
   ;| Destroys: a, bc, de, hl, ix, (currow), (curcol)                    |
   ;+--------------------------------------------------------------------+
.nolist
#include "ti83plus.inc"
#define ProgStart 9D95h
.list
.org ProgStart -2
.db t2ByteTok, tAsmCmp
getvars:
   LD IY, flags
   res plotLoc, (IY+plotFlags)
   B_CALL(_BufClr)
   B_CALL(_ZeroOP1)
   LD A, 'D'               ;DIRECTIE variabele
   LD (OP1+1), A
   B_CALL(_RclVarSym)
   B_CALL(_ConvOP1)
   PUSH AF
   B_CALL(_ZeroOP1)
   LD A, 'T'
   LD (OP1+1), A
   B_CALL(_RclVarSym)
   B_CALL(_ConvOP1)
   PUSH AF
   B_CALL(_ZeroOP1)
   LD A, 'X'
   LD (OP1+1), A
   B_CALL(_RclVarSym)
   B_CALL(_ConvOP1)
   PUSH AF
   B_CALL(_ZeroOP1)
   LD A, 'Y'
   LD (OP1+1), A
   B_CALL(_RclVarSym)
   B_CALL(_ConvOP1)
   LD E, A ;getting the Y var
   POP AF
   LD D, A
   LD C, 2 ;choosing the OR
   POP AF
   OR A
   JP Z, TANKS
   CP 1
   JP Z, DROIDS     
   CP 2
   JP Z, TREE
   ;HIER CP's TOEVOEGEN VOOR MUREN, PLANES EN MEER!
   RET
TANKS:
   POP AF
   OR A
   JP Z, IXtankU
   CP 1
   JP Z, IXtankR
   CP 2
   JP Z, IXtankD
   CP 3
   JP Z, IXtankL
   RET
DROIDS:
   POP AF
   OR A
   JP Z, IXdroidU
   CP 1
   JP Z, IXdroidR
   CP 2
   JP Z, IXdroidD
   CP 3
   JP Z, IXdroidL
   RET
TREE:
   POP AF
   OR A
   JP Z, IXTree_1
   CP 1
   JP Z, IXTree_2
   RET
GRASS:
   POP AF
   OR A
   JP Z, IXGrass_1
   CP 1
   JP Z, IXGrass_2
IXtankD:
   LD IX, tankD
   JP begindraw
IXtankL:
   LD IX, tankL
   JP begindraw
IXtankU:
   LD IX, tankU
   JP begindraw
IXtankR:
   LD IX, tankR
   JP begindraw
IXdroidU:
   LD IX, droidU
   JP begindraw
IXdroidR:
   LD IX, droidR
   JP begindraw
IXdroidD:
   LD IX, droidD
   JP begindraw
IXdroidL:
   LD IX, droidL
   JP begindraw
IXTree_1:
   LD IX, Tree_1
   JP begindraw
IXTree_2:
   LD IX, Tree_2
   JP begindraw
IXGrass_1:
   LD IX, Grass_1
   JP begindraw
IXGrass_2:
   LD IX, Grass_2
;ONDERSTE HOEFT GEEN JP
;|                         DRAWING ROUTINE                            |
;|         (programmed by Pelle Kersaan a.k.a. Cerzus, ©2003)         |
;|                       (cerzus69@hotmail.com)                       |
begindraw:
   ld b, 8
   push bc   
   ld hl, 0   
   ld (CurRow), hl
   ld a,e
   ld b,7
crz1topoffcheck:
   inc a
   jr z,crz1topoff
   djnz crz1topoffcheck
   ld c,e
   add hl,bc
   add hl,bc
   add hl,bc
   add hl,hl
   add hl,hl
   ld a,e
   sub 56
   ld b,7
crz1bottomoffcheck:
   dec a
   jr z,crz1bottomoff
   djnz crz1bottomoffcheck
   jr crz1checkxpos
crz1topoff:
   push bc
   ld a,8
   sub b
   ld c,a
   ld b,0
   add ix,bc
   pop bc
crz1bottomoff:
   ld a,b
   pop bc
   ld b,a
   push bc
crz1checkxpos:
   ld a,d
   ld b,7
crz1leftoffcheck:
   inc a
   jr z,crz1leftoff
   djnz crz1leftoffcheck
   ld c,d
   srl c
   srl c
   srl c
   add hl,bc
   ld a,d
   sub 88
   ld b,7
crz1rightoffcheck:
   dec a
   jr z,crz1rightoff
   djnz crz1rightoffcheck
   jr crz1finishscreenpos
crz1leftoff:
   ld a,10b
   ld (currow),a
   dec hl
   jr crz1finishscreenpos
crz1rightoff:
   ld a,01b
   ld (currow),a
crz1finishscreenpos:
   ld bc,plotsscreen
   add hl,bc
   ld a,d
   pop de
   and 00000111b
   jr z,crz1aligned
   ld (curcol),a
crz1nonaligned:
   ld b,(ix+0)
   ld a,e
   cp 1
   jr nz,crz1orxorshift
   ld c,11111111b
   ld a,(curcol)
crz1andshiftloop:
   srl b
   rr c
   ex af,af'
   ld a,b
   add a,10000000b
   ld b,a
   ex af,af'
   dec a
   jr nz,crz1andshiftloop
   jr crz1endshiftloop
crz1orxorshift:
   ld c,00000000b
   ld a,(curcol)
crz1orxorshiftloop:
   srl b
   rr c
   dec a
   jr nz,crz1orxorshiftloop
crz1endshiftloop:
   ld a,(currow)
   and 10b   
   call z,crz1putsprite
   ld b,c
   inc hl
   ld a,(currow)
   and 01b
   call z,crz1putsprite
   inc ix
   ld bc,11
   add hl,bc
   dec d
   jr nz,crz1nonaligned
   ret
crz1aligned:
   ld b,(ix+0)
   call crz1putsprite
   inc ix
   ld bc,12
   add hl,bc
   dec d
   jr nz,crz1aligned
   ret
crz1putsprite:
   ld a,e
   dec a
   call z,crz1putand
   ld a,e
   cp 2
   call z,crz1putor
   ld a,e
   cp 3
   call z,crz1putxor
   ret
crz1putand:
   ld a,(hl)
   and b
   ld (hl),a
   ret
crz1putor:
   ld a,(hl)
   or b
   ld (hl),a
   ret
crz1putxor:
   ld a,(hl)
   xor b
   ld (hl),a
   ret
tankD:
   .db %01111110
   .db %10111101
   .db %10100101
   .db %10100101
   .db %10111101
   .db %10011001
   .db %10111101
   .db %01011010
   RET
tankL:
   .db %01111110
   .db %10000001
   .db %01011111
   .db %11110011
   .db %11110011
   .db %01011111
   .db %10000001
   .db %01111110
   RET
tankU:
   .db %01011010
   .db %10111101
   .db %10011001
   .db %10111101
   .db %10100101
   .db %10100101
   .db %10111101
   .db %01111110
   RET
tankR:
   .db %01111110
   .db %10000001
   .db %11111010
   .db %11001111
   .db %11001111
   .db %11111010
   .db %10000001
   .db %01111110
   RET
droidU:
   .db %00000000
   .db %00011100
   .db %00100010
   .db %00101010
   .db %00110110
   .db %00110110
   .db %00101010
   .db %00011100
droidR:
   .db %00000000
   .db %00000000
   .db %01111100
   .db %10110010
   .db %11001010
   .db %10110010
   .db %01111100
   .db %00000000
droidD:
   .db %00111000
   .db %01010100
   .db %01101100
   .db %01101100
   .db %01010100
   .db %01000100
   .db %00111000
   .db %00000000   
droidL:
   .db %00000000
   .db %00111110
   .db %01001101
   .db %01010011
   .db %01001101
   .db %00111110
   .db %00000000
   .db %00000000
Tree_1:
   .db %00011000
   .db %01100110
   .db %01001010
   .db %10100001
   .db %10001001
   .db %01000010
   .db %01100110
   .db %00011000
Tree_2:
   .db %00011000
   .db %01100110
   .db %01010010
   .db %10000001
   .db %10100001
   .db %01001010
   .db %01100110
   .db %00011000
Grass_1:
   .db %00001000
   .db %01000110
   .db %01000000
   .db %10001000
   .db %00000001
   .db %01001010
   .db %01100110
   .db %00101000
Grass_2:
   .db %00011000
   .db %01001010
   .db %01010010
   .db %00000001
   .db %10001001
   .db %01001010
   .db %01000000
   .db %00001000
.end
.end


And here is the BASIC code I use.
Code:
ClrDraw
Lbl A
0->K
While K !=26
getKey->K
X+(K=26)->X
End
DispGraph
Asm(prgmGCOM
Goto A


I know this ^ code is not that good but It is just a test...and it does not do the trick...


Anyone any suggestions? (should this be posted under prograamming help? because on the other hand this is related to the original topic, my project.)


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Fri 12 Mar, 2010 11:43 am 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
Looks interesting so far, though I think you'd have a better response on a more active forum than MaxCoderz. :( Incidentally, I think this thread should be in "Announce Your Projects" - would you like me to move it?

To copy the graph buffer to the LCD you can use the grBufCpy B_CALL.


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Fri 12 Mar, 2010 4:29 pm 
Offline
New Member
User avatar

Joined: Mon 13 Jul, 2009 6:23 pm
Posts: 16
Well I think we can better keep it here...I am not all to good at finishing things...
I tried using the BufCpy command but I get grain as a result. Where would you place it?


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Fri 12 Mar, 2010 6:57 pm 
Offline
Regular Member
User avatar

Joined: Wed 18 Oct, 2006 7:34 pm
Posts: 112
Location: The ex-planet Pluto
You should disable interrupts before you use shadow registers. (I notice you use the ex af,af' instruction)

_________________
~calc84maniac has spoken.

Projects:
F-Zero 83+
Project M (Super Mario for 83+)


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Fri 12 Mar, 2010 8:44 pm 
Offline
New Member
User avatar

Joined: Mon 13 Jul, 2009 6:23 pm
Posts: 16
I added the DI instruction but I did not really help. The problem is that I can not see the Updated screen of the drawn sprite. For example if I had a simple for loop that increments X every iteration then I can only see the black stripe (stripe because all the sprites rendere on top of each other with an offset of X)rendering was set to OR)) it causes after the loop has finished. Shortly siad, I can move my sprites but If the were to move from A to B I only get to see their state at B, I can not see any in-between frames...


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Sat 13 Mar, 2010 2:14 am 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
Call GrBufCpy (not BufCpy) when you've finished rendering a frame and wish to present it to the user. This routine copies the image data from the graph buffer to the RAM on the LCD driver chip.


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Sat 13 Mar, 2010 12:03 pm 
Offline
New Member
User avatar

Joined: Mon 13 Jul, 2009 6:23 pm
Posts: 16
I have tried grBufCpy (I meant grBufCpy not BufCpy a couple of comments up) but it does not seems to work. Well,. I am convinced it does work but honestly I have no clue where to place it...I'll be looking throught that code another time I think, you see I did not write that sprite routine....

But thanks for your help anyway....

Oh and can't I just copy it directly onto the screen, does it have to go through the plotsScreen buffer?

Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Sat 13 Mar, 2010 7:14 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
Matthias1992 wrote:
Oh and can't I just copy it directly onto the screen, does it have to go through the plotsScreen buffer?
In theory you could, but accessing the LCD memory is slow and you'd end up with flicker as it drew the sprites one by one. It looks better to draw everything to plotSScreen first then copy to the LCD when you're done.

In your case, it may be worth writing a routine that just called GrBufCpy (e.g. 50:Asm(prgmGH) and use that.


Top
 Profile  
Reply with quote  
 Post subject: Re: C&CG RTS
PostPosted: Sat 13 Mar, 2010 9:00 pm 
Offline
New Member
User avatar

Joined: Mon 13 Jul, 2009 6:23 pm
Posts: 16
Thanks! that worked!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB ® Forum Software © phpBB Group | DVGFX2 by: Matt