![]() |
|
Speccy Wars - Printable Version +- Boriel Basic Forum (https://forum.boriel.com) +-- Forum: Compilers and Computer Languages (https://forum.boriel.com/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://forum.boriel.com/forumdisplay.php?fid=11) +---- Forum: Gallery (https://forum.boriel.com/forumdisplay.php?fid=18) +---- Thread: Speccy Wars (/showthread.php?tid=410) Pages:
1
2
|
Re: Speccy Wars - boriel - 2013-04-19 slenkar Wrote:is it ok to add it when its not finished?I can see the screenshot, and its OK. Maybe a cache problem? Re: Speccy Wars - slenkar - 2013-04-19 yep its workin now thanks Re: Speccy Wars - slenkar - 2013-04-27 its playable now its at the limits of the memory so new features are unlikely Re: Speccy Wars - slenkar - 2013-05-02 here is the source code: How could I free up some more RAM? Re: Speccy Wars - boriel - 2013-05-02 slenkar Wrote:here is the source code:
so don't know if something else could be done. Why do you need more ram? Try lowering the ORG with --org=26000? Re: Speccy Wars - slenkar - 2013-05-02 yeh the line function allows me to do line of sight, (need all x and y coordinates of a line) Thanks for the other tips Re: Speccy Wars - LCD - 2013-05-03 In main file: Code: PRINT AT 3,13 ; PAPER 1 ; INK 7 ; "BattleField"
PRINT AT 5,9 ; PAPER 7 ; INK 0 ; "Q - Up"
PRINT AT 6,9 ; PAPER 7 ; INK 0 ; "A - Down"
PRINT AT 7,9 ; PAPER 7 ; INK 0 ; "O - Left"
PRINT AT 8,9 ; PAPER 7 ; INK 0 ; "P - Right"
PRINT AT 9,9 ; PAPER 7 ; INK 0 ; "M or Space- Select"
PRINT AT 10,3 ; PAPER 7 ;INK 0 ; "C to End Turn"
PRINT AT 10,3 ; PAPER 7 ; INK 0 ; "You have to select units"
PRINT AT 11,3 ; PAPER 7 ; INK 0 ; "to fight the enemy units"
PRINT AT 15,3 ; PAPER 7 ; INK 0 ; "Press any key to start"Code: PRINT AT 3,13 ;"\{p1}\{i7}BattleField"
PRINT AT 5,9 ; "\{p7}\{i0}Q - Up"; AT 6,9 ;"A - Down"; AT 7,9 ; "O - Left"; AT 8,9 ; "P - Right"; AT 9,9 ; "M or Space- Select";AT 10,3; "C to End Turn";AT 10,3 ; "You have to select units"; PRINT AT 11,3; "to fight the enemy units"; PRINT AT 15,3; "Press any key to start";Code: 60 LET j$ = INKEY$
IF j$ = "" THEN GOTO 60: END IFCode: Do
j$=inkey$
loop until j$<>""Code: PRINT AT 1,x ; PAPER 1 ; INK 0 ; " "Code: PRINT AT 1,x ;"\{p1}\{i0} "Code: FUNCTION millisecs AS ULONG
REM Reads the FRAMES counter
RETURN INT((65536 * PEEK(23674) + 256 * PEEK(23673) + PEEK(23672)))
END FUNCTIONCode: dim millisecs as ULONG at 23672Also check if there are undimed variables as this make them float There is a lot of optimisation potential. I'm sure, you can save 3-5 Kb. It looks like you define UDG multiple times. Thats what I found quickly checking the sources. Optimising the source is a bit time consuming because you did not use indentation. You can also change: Code: dim selecty as byte
dim selectx as byte
dim selectedUnit as ubyte
dim targettedUnit as ubyteCode: dim selecty,selectx,selectedUnit,targettedUnit as ubyteAnd as boriel said, you can set up org to 24200 without problems. Reduce the heap to 512. Re: Speccy Wars - boriel - 2013-05-03 Another trick (not yet implemented) is: There is many arrays which are taking lot of memory. If you don't need 2 of them *at once* it's possible to map two of them in the same memory area (note: This feature IS NOT implemented; i'm still working on it). Basically, it's using DIM ... AT ... with arrays (at the moment only available with single variables). Re: Speccy Wars - boriel - 2013-05-03 slenkar Wrote:yeh the line function allows me to do line of sight, (need all x and y coordinates of a line)Did you use Bresenham's algorithm for speed also? A classical y = x0 + mx take much less memory (althoug slower, if using FP, but FP is in ROM). Update: Also, in the speccy.org (Spanish) forum people are also talking about 128K ram management. I think we could manage so create some simple bank-switching functions and store graphs and some array/logic there. Re: Speccy Wars - slenkar - 2013-05-03 thanks for all the tips I used bresenham just because thats the only line function I know of, where I can get all the co-ordinates along the line. I dont know how to use 'y = x0 + mx' , to make a line from two known points. |