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 38 of 38 | |||||
Author | Message | ||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Hi Harm & Peter, All of those suggestions are very useful and interesting, I'm amazed that crunching the program saves 10mS, as you say not worth it for now, unless really necessary. Would you like me to look at some of Peter's other suggestions? Regards Kevin. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4239 |
Hi Kevin, Please go ahead and try to implement Peters suggestions. I started using CHOICE recently. In beginning it is much easier to use IF THEN ELSE since you can also embed executable code. CHOICE only works on variables. Dimming strings may add more code than it saves in HEAP size. And INC I am using quite a lot already. I will await your efforts. Please use THIS as starting point (it is my current "work in progress" equal to "pet25n.bas" with an EMP optimization in AI. pet25p.zip Regards, Volhout P.S. CHOICE saves 10% (0.003ms) over IF THEN ELSE INC x,1 saves 17% (0.003ms) over x=x+1 So the gain is little, try to focus on program area's that are called often. Edited 2023-12-08 20:27 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
hmm bombs doesn't kill robots anymore? ok now they do, maybe a problem with my Game*Mite Edited 2023-12-09 00:57 by Martin H. 'no comment |
||||
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 479 |
How are you profiling the game code? Has MMBasic a tool or some way to generate profiling data? |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4239 |
Hi LeoNicolas, The game has a main loop. The main loop is used to time synchronize everything. The main loop is executed every 100ms (10fps). In the video screen the time is displayed that the main loop actualy uses (i.e. 85ms). I visually check this while running the game. The 95% result is because I curiously added 2 lines of code, one to count the loops, 1 to sum the times. Then at the end do the division. And that came to 93ms average (93%). So no profiling tool, only something I coded myself. Volhout Edited 2023-12-09 01:18 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
LeoNicolas If you are interested to crate a CMM2/MMB4W Version: this test was based on the PET20 Version. so you "just have to" copy the Screen,Animation related routines and replace them whit those I used 'no comment |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4040 |
I may be imagining it, but didn't Peter enhance the PicoMite{VGA} or CMM2 with a "profiling" feature that would report "hot" pieces of code, i.e. those that were called very frequently. Not sure if that feature is still present or how you enable it. Best wishes, Tom Edited 2023-12-09 02:36 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
I used the Things that the CMM2 has more than the Pico I managed everything using Pages. 2 Pages for Tiles 1 for Sprites and one page to buildup the Screen and merge the Sprites, at the end Page 1 is copied to page 0 (the vissible screen) Instead of the memory address of the Tile/Sprites-source, I created x,y,page coordinates of the individual tiles in an array. 'no comment |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4040 |
I'm not sure why you quoted me Martin as your reply had nothing to do with anything I said ;-) EDIT: What I was referring to was OPTION PROFILING and having had a google around TBS it is/was a CMM2 feature not a PicoMite feature: https://www.thebackshed.com/forum/ViewTopic.php?TID=13459&PID=16#16#163977 Best wishes, Tom Edited 2023-12-09 02:41 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Hi Harm, Here is a modified version of pet25p I have reduced some strings to 8, modified any Inc or Choice I could find (not many), I doubt it has made any speed difference and I'm unsure how to tell if any memory has been saved, it wouldn't be much anyway. Feel free to use or not, probably needs a good test, in case I've damaged anything. :-( pet25p_k.bas.zip Regards Kevin. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4239 |
Hi Kevin, I have used some of your suggestions. Thank you Volhout PicomiteVGA PETSCII ROBOTS |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4040 |
Hi folks, My latest offering based on pet25p: pet25p-thwill-1.zip Bugs fixed: - Fixed missing underscore in variable/function name 'ctrl_wii_classic'. - Fixed implementation of kill_kb() which (for controllers) was broken by my earlier changes to read_input$() to suppress auto-repeat. Code cosmetic changes: - Renamed kill_kb() => flush_input() as that is a more accurate description of what it does. - Renamed "escape" action to "quit". UI tweaks: - Made A/Fire act as "use-item" on the intro screen so it can be used for selection / to start the game. - Changed "kill" to "destroy" in one message, I think you "destroy" robots, not "kill" them, YMMV. - Improved UI feedback from map: - Pressing the "map" button now always beeps. - A message is written describing the current map mode. - When a controller is configured the messages associated with "quiting" say SELECT rather than ESCAPE. For what it's worth I don't think it is quite "cooked" yet and would benefit from another month's playtesting and tweaking ... that said the concept of "release" is pretty meaningless as there are no publishing channels . Best wishes, Tom Edited 2023-12-10 01:54 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4040 |
Oops, try this one instead: pet25p-thwill-2.zip Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4040 |
Bug in the game logic (which I'm leaving alone): If you walk into the trash compactor then you get lots of "object crushed" (which I think should start with a capital letter) messages instead of a single "Player terminated!" message, which again I think should start with a capital letter, and in this case end with an exclamation mark. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4239 |
Hi Tom, Real good feedback. It is fixed in "robots_rc1.bas" see new thread. The "Player terminated" was printed but invisible since there where multiple "object crushed" after it. The "object crushed" was a bug. Thanks, Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1113 |
@Volhout Replace this Block and we have a Start Menu without the "Controlls" Entry. Sub show_intro 'load screen FRAMEBUFFER write l:CLS :FRAMEBUFFER write sc$ Load image path$("images/introscreen.bmp"),0,10 FRAMEBUFFER write l: fade_in: :FRAMEBUFFER write sc$ Local integer puls(11)=(0,1,9,11,3,6,7,6,5,11,9,1),t,t2 Local Message$(4) length 40 'set Map to 0, Menu State to 1 Message$(1)="...use UP & DOWN, Space or 'Start' " Message$(2)=" ...use LEFT & RIGHT to select Map " Message$(3)=" ...use LEFT & RIGHT cange Difficulty " Dim DIFF_LEVEL_WORD$(2) length 6 =("EASY ","NORMAL","HARD ") Map_Nr=0:MS=1:Difficulty=1 ' start playing the intro Music Play Modfile path$("music/metal_heads-sfx.mod") show_menu 1 'Display Map Name Text 9,70,UCase$(map_nam$(Map_Nr)) '--- copyright notices etc Text 0,224,Message$(1),,,,col(3) Local msg$ = String$(36,32) ' Cat msg$, sys.get_config$("device", "Generic " + Mm.Device$) + " - " Inc msg$, "Original Game by David Murray - " Inc msg$, "Port to Mite and MM-Basic by Volhout, Martin H and thebackshed-" Inc msg$, "Community - Music by Noelle Aman, Graphic by " Inc msg$, "Piotr Radecki - MMBasic by Geoff Graham and Peter Mather " flip=0 MT=0 'check player choice kill_kb Do If flip=0 Then Inc MT:If mt>Len(msg$) Then MT=0 tp$=Mid$(msg$,1+MT,41) If t2=0 Then 'once every 4 cycles k$=read_input$() If k$<>"" Then Play modsample s_beep-2,4 If k$="down" Then Inc MS,(MS<3) If k$="up" Then Inc MS,-(MS>1) If k$="use-item" Then Select Case MS Case 1 FRAMEBUFFER write L:fade_out:FRAMEBUFFER write sc$ Exit 'intro and go on with the Program Case 2 'select map kill_kb Text 0,224,message$(2),,,,col(3) Do k$=read_input$() If k$<>"" Then Play modsample s_beep-2,4 If k$="left" Then Inc Map_Nr,-(Map_Nr>0) If k$="right" Then Inc Map_Nr,(Map_Nr<13) If k$="use-item" Then Text 0,224,message$(1),,,,col(3): Exit EndIf Text 9,70," " Text 9,70,UCase$(map_nam$(Map_Nr)) If LCD_DISPLAY Then FRAMEBUFFER Merge 9,b EndIf Pause 200 Loop kill_kb Case 3 'select DIFFICULTY kill_kb Text 0,224,message$(3),,,,col(3) Do k$=read_input$() If k$<>"" Then Play modsample s_beep-2,4 If k$="use-item" Then Text 0,224,message$(1),,,,col(3) Text 0,232," " Exit EndIf If k$="left" Then Inc Diff_Level,-(Diff_Level>0) EndIf If k$="right" Then Inc Diff_Level,(Diff_Level<2) EndIf Text 0,232,DIFF_LEVEL_WORD$(Diff_Level) Load image path$("images/face_"+Str$(Diff_Level)+".bmp"),234,85 If LCD_DISPLAY Then FRAMEBUFFER Merge 9,b EndIf Pause 200 Loop kill_kb End Select EndIf EndIf EndIf show_menu MS,col(puls(t)) Text 8-(2*flip),0,tp$,,,,col(2):flip=(flip+1) And 3 Inc t: t=t Mod 12 'color change Inc t2: t2=t2 Mod 3 'reponse time keys If LCD_DISPLAY Then FRAMEBUFFER Merge 9,b Pause 50 Loop Play stop End Sub 'remove duplicate keys and key repeat Sub kill_kb Do While read_input$() <> "" : Loop End Sub 'start menu selection list Sub show_menu(n1,FC) Local tc,BG=0,f2=col(10) tc=f2 :If n1=1 Then tc=FC Text 32,30,"START GAME",,,,tc tc=f2 : :If n1=2 Then tc=FC Text 32,38,"SELECT MAP",,,,tc tc=f2 : :If n1=3 Then tc=FC Text 32,46,"DIFFICULTY",,,,tc End Sub Edited 2023-12-10 19:31 by Martin H. 'no comment |
||||
Page 38 of 38 |
Print this page |