Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PICO PETSCII
Page 34 of 38 | |||||
Author | Message | ||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
Martin, The keys was a stupid fault. The TC is because I originally excluded player from getting trashed. After including player I did not test . Fixes will be in new beta. Volhout PicomiteVGA PETSCII ROBOTS |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Hi, It doesn't look like converting word arrays to byte arrays is going to be successful. I have converted two 64 word arrays to 9 word arrays, a saving of about 0.5k, but the overhead of doing just these 2 has caused the time used to go back up by about 5mS!, so between 80 and 90mS. I experimented withe PEEK and POKE, but it turned out that LONGSTRING SETBYTE and LGETBYTE were slightly faster. The two arrays I've initially converted are UT() and UX() 'unit attributes in integer arrays for speed Dim UT(8) 'unit type Dim UX(8) 'unit x coordinate Dim UY(63) 'unit x coordinate Dim UA(63) 'unit a parameter Dim UB(63) 'unit b parameter Dim UC(63) 'unit c parameter Dim UD(63) 'unit D parameter Dim UH(63) 'unit health Which does make loading the arrays much easier, by doing this. 'load unit attributes in arrays LONGSTRING APPEND UT(),Input$(64,#1) LONGSTRING APPEND UX(),Input$(64,#1) For i=0 To 63: UY(i)=Asc(Input$(1,#1)):Next For i=0 To 63: UA(i)=Asc(Input$(1,#1)):Next For i=0 To 63: UB(i)=Asc(Input$(1,#1)):Next For i=0 To 63: UC(i)=Asc(Input$(1,#1)):Next For i=0 To 63: UD(i)=Asc(Input$(1,#1)):Next For i=0 To 63: UH(i)=Asc(Input$(1,#1)):Next However, everywhere that UT or UX are used you have to do a read or write, like this. 'adapt hoverbots for difficulty level if Diff_level=2 then for i=1 to 27: longstring setbyte UT(),i,4*(lgetbyte(UT(),i)<4):next 'aggroall hoverbots end if or this. case 22 'raft left-right 'slow down IF UD(i)=0 then UD(i)=2 'move raft MID$(lv$(UY(i)),lgetbyte(UX(),i)+1,1)=Chr$(&hCC) 'old becomes water if UA(i)=1 then 'move raft left longstring setbyte(UX(),i,lgetbyte(UX(),i)+1:if lgetbyte(UX(),i)=UC(i) then UA(i)=0:UD(i)=16 'wait at dock else 'move right longstring setbyte(UX(),i,lgetbyte(UX(),i)-1:IF lgetbyte(UX(),i)=UB(i) then UA(i)=1:UD(i)=16 end if MID$(lv$(UY(i)),lgetbyte(UX(),i)+1,1)=Chr$(&hF2) 'new is raft tile if dx=0 and dy=0 then xp=lgetbyte(UX(),i) 'if we where on the raft, stay on it end if inc UD(i),-1 'timer End Select Which, although it is working great, is not only long winded, but less readable and ultimately slower, for a less than 1k gain in space! If I was to convert all the U*() arrays shown above, it would only save about 3.5k. Regards, Kevin. Edited 2023-11-26 03:28 by Bleep |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
Hi Kevin, Thank you for testing.This confirms my earlier tests performed after Peters suggestion. The AI is taking up most of the cpu cycles and the fastest was to use integer arrays. The issue was with the strip.bmp file and memory issues for the lcd version when using sprites for the strip. Martin already provided an alternate solution. And another alternative could be to use the A drive to store the strip.bmp. There would be no conflict with framebuffer merge. Volhout Edited 2023-11-26 04:19 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Hi Harm, I thought that trying to save ram was probably still needed because you said "This means that RAM is (very) critical at the Game*Mite. Note that there where only 97 variables when Game Mite ran out of memory. In VGA when running there are 141 variables." Anyway, without the sprite read there appears to be about 35k of variable ram free, on the LCD version, plus any gains from Peters optimisations, so hopefully that will be enough. :-) Regards Kevin. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
All, Bug fixes, and Martin.H's work around for the memory problem on the LCD version. UNZIP copy metal_heads-sfx.mod to /music copy layer_b.bmp to /images run "pet25a.bas" This fixes the TC bug when player walks into it This fixes the bug with the wrong key opening the STAR locked door pet25a.zip @Kevin All gameplay is in. The game is not going to grow in any significant way anymore. What is on my list: - check against the VGA DOS version if information text and sounds match - add sfx sounds to menu (probably Martin will do this, not the correct mod file is in) - implement Martin's last soundtrack with sfx sounds (edit in works). - bug fixes in game play (like the 2 Martin found so far). So playing, and finding bugs, is essential now. Above version still has F3 cheat key. Above version still has the loop time counter Volhout Edited 2023-11-26 05:28 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4042 |
Note that as far as I am aware the output of the MEMORY command is misleading in that it suggests variables and general come from the same pool and that the free memory is the remainder of that pool. In reality the memory for a fixed number of variables (1024?, possibly much less) is preallocated and the remainder forms the MMBasic heap from which arrays, sprites, buffers and temporary working memory required by the interpreter is allocated. What is reported as free is the space taken by unused variable slots plus the unallocated heap. Thus you can run out of heap even though MEMORY reports plenty of free space. I await Peter telling me I am wrong, in which case I should have looked at the firmware source before pontificating. Best wishes, Tom Edited 2023-11-26 05:33 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
Hi Tom, In stead of blindly changing variables, is there any way we can diagnose what is happening (some MM.INFOxx or PEEKxxx), and see if a change we make helps...or makes it worse? I know that presiously (for the chess program) there was a C-stack and C-heap "pointer". And we had to subtracts end of stack to see the free space. I remeber that every level deeper nested came at a cost of 600bytes. Maybe we are just stacking SUB's to deep, and should flatten the structure... -or- It is a change I made to speed up the execution, changeing: IF a AND b AND c THEN 'do it END IF to IF a THEN IF b THEN IF c THEN 'do it END IF END IF END IF Volhout Edited 2023-11-26 05:41 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4042 |
Hi @Volhout, Assuming I'm not talking bo**ocks none of what you suggests matters* and I am unaware of any peek/info that can help you. You appear to be running out of MMBasic heap which means what matters is arrays, strings, buffers and sprites which are all allocated from the heap; note that I believe PicoMite sprites have a bigger colour depth and thus memory requirement to those on VGA, hence the issue appearing on the PicoMite first. * Unless you want to persuade Peter to rewrite the memory model so that variables are allocated from the heap which potentially gives you more heap ... and more opportunity for it to become fragmented which means implementing a defragmentation strategy ... Good luck with that ;-) Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
Hi Tom, Would this give the required information ? I have no idea how to use it, but if I type this after the "not sufficient memory" error it should help us finding improvements ? When I run the game engine, and stop (ctrl-C) and type ?MM.INFO(SYSTEM HEAP) 1488 No idea if 1488 is much, or little... After "NEW" I get the same answer (1488). Volhout P.S. in Dutch (my native language) I could not find any word that matches bo**ocks, and my English might need an ugrade... Edited 2023-11-26 06:19 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
@Martin, Kevin, I tried selecting and running a level using the NES controller (one I received from Tom 2 years ago). One of these chineese cheapies.. I had a very hard time, many "double clicks", especially anoying when trying to move an object, or selecting in the start menu. Before I start "tuning" the NES controller code...how are you experiencing the controller operation. Maybe my NES controller is simply sloppy. I hate to break something that works for others. Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9122 |
System heap is irrelevant for all but the WebMite mm.info(heap) lets you know how much of the MMBasic heap is left. MMbasic memory is split into two sections. Variable memory = 28K - for individual variables (56-bytes each) and heap (132K on the PicoMite and 100K on the VGA) which is used for strings, arrays and various working buffers (mod file playback uses 24K). Your application is unlikely to get near using the 512 variables available (256 global + 256 local) but it sounds like you are using a lot of the heap memory. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4042 |
Is the problem with the NES controller (though I would expect the same to be true with Game*Mite) to do with a fundamental difference between reading a keystroke with INKEY$ and reading a digital input / button press ? Do While Len(Inkey$) : Loop Do ? Inkey$ Loop Press and hold "a" and it will print one "a" and then print a bunch of empty lines whilst waiting for the key repeat to kick in before printing more "a". Do the equivalent with a digital input and as soon as you press and hold a button you will (ignoring any bounce) get an endless stream of 1's without that initial break. For this game you may want to change the controller input code such that except when just a direction button is pressed you ignore any input that is the same as the immediately previous input. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
8 integer arrays length 64 That should be 4k The world map String array 64, length 128 should be 9k Index arrays, total some 400 integers Another 3k Tile attribute string, lenght 255 And some more strings, mostly length limitted. Framebuffer? Edited 2023-11-26 09:01 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
MarkF Regular Member Joined: 01/08/2023 Location: AustraliaPosts: 47 |
Hello Volhout. Version "pet25.bas" works great on my PicoGAME VGA using the NES/Famicon controller. I can start the game, search, move objects, fire the gun in any direction, etc. Question... In order for the NES/Famicon controller to work, I need to edit this line: Const nesPG1=0 and make it Const nesPG1=1 Just wanted to know if this is normal? If it is, it's an easy enough code edit to do on any Petscii Robot software revision. Edited 2023-11-26 10:22 by MarkF |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Note that the LENGTH attribute for strings only works for string arrays, although "LENGTH" is accepted in the definition of a non-array string variable. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
Mark yes, this is normal and intended for exactly that. nesPG1 stands for NES Controller on PicoGAME port one Set this to 1 and the Nes controller works, exactly the way you did it. Since everyone can freely configure their PicomiteVGA (which we don't know) I used this setting as an example and it is set to 0 by default to avoid possible conflicts with the IO settings of other configurations. I'm currently using this configuration (and Game*Mite for LCD) for testing. It is possible that we also put the settings for latch, clock and data at the beginning of the listing to keep the configuration flexible. If one don't want that, he can still play the Game using the keyboard and/or the terminal. Cheers Martin Edited 2023-11-26 14:25 by Martin H. 'no comment |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
@all The game, as it is now is, thanks to Harm, almost fully programmed and the controls work. The size and memory consumption by now does not cause any errors and will imho not change much in the finished program. The changes that are still to be done are more in the flow and logic of the game. So please only repair what is really broken. Optimizations that can then come concern the execution speed and the control.I will also try, if i can speed up the generation of the map thanks to Peter's tip and maybe add, for a harmonious overall impression, some beeps and fades here and there. We can discuss the chocolate sprinkles on the cherry on the cream on the cake when the entire cake (gameplay) is finished. Have a nice Sunday Cheers Martin Edited 2023-11-26 15:14 by Martin H. 'no comment |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4042 |
According to Google "talking bollocks" = "onzin praten" Though a literal translation would be "testikels praten" As it happens I wasn't and Peter confirmed by understanding. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4042 |
Martin, Which MOD Tracker(s) did you end up using, I know you posted it somewhere in this thread but I can't find it. Note, I want to know for a different project, I'm not fiddling with sound for PETSCII Robots. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
Hi Tom I started with a PT2 Clone , which works much like the original Trackers in the early 90s. But I changed to Milky Tracker which still seems quite nostalgic, but in my opinion it has more powerful functions and is more comfortable to use. btw. The main problem was that the music was not in the standard MOD format on GitHub, and some of the samples used were defective. The last problem I have to solve is that the last mod file is too big to squeeze into 125k with the SFX. Or we leave it at 2 mod files for in-game music Have fun Edited 2023-11-26 21:49 by Martin H. 'no comment |
||||
Page 34 of 38 |
Print this page |