Bocco's adventures

Want to talks about games you like, would like to see developed on the Oric, it's here.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Bocco's adventures

Post by iss »

Sizes cc65 vs (osdk):

_playerUpdate 3549 (7581)
_emenyLeftRightUpdate 1414 (3247)
_addObjectInEngine 81 (!?!) (3070)
_animator 1055 (2066)
_enemyUpDownUpdate 828 (1712)
_printKeysScreen 610 (1512)
_input 206 (1376)
_addObject 538 (1216)

Attached are sym+map files.
Attachments
boko-sym-map.zip
(5.9 KiB) Downloaded 283 times
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Bocco's adventures

Post by Dbug »

That's a crazy size reduction.

Is it somewhat possible to compile CC65 to assembler source code so I can compare the results with what LCC is generating?
I think Fabrice would be interested :)
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Bocco's adventures

Post by Chema »

Crazy and quite unexplainable, if you ask me. I can't see how this can happen, unless everything is implemented as subroutines, with the consequent waste of time.

Other big cuts to code size could be achieved by adding constraints to the compiler. If you don't allow recursion or limit the number or type of the parameters in functions, but I doubt that is the case here.

I am curious indeed :)
User avatar
retroric
Pilot Officer
Posts: 125
Joined: Sun Nov 22, 2009 4:33 pm
Location: Paris, France

Re: Bocco's adventures

Post by retroric »

Well,

If you look at the code on GitHub, you can see there are quite a lot of functions, many of them taking many parameters, even including "int" parameters for some of them... Yet, cc65 seems to generate code that is both quite compact and fast. On the latter point if would be interesting as well to compare the relative speeds of the game compiled with cc65 and OSDK...

Now, if you look at functions like animator() (in src/engine.c), where the generated code is twice as big for OSDK, you see it is composed mainly of conditionals, dereferencing arrays with pointers, integer computations, and only 4 calls to the same "printBG()' functions, so it looks like the difference between cc65 and lcc65 (OSDK) may not necessarily be in the calling of functions, but maybe rather in the way conditionals, tests, pointer operations and arithmetics is implemented.

Obviously, to be able to see exactly where cc65 is more efficient than lcc65 we would need to be able to compare generated assembly codes, as DBug pointed out..
flag_fr RetrOric, aka laurentd75 flag_uk
            GitHub - RetrOric
User avatar
retroric
Pilot Officer
Posts: 125
Joined: Sun Nov 22, 2009 4:33 pm
Location: Paris, France

Re: Bocco's adventures

Post by retroric »

Another thought on this:

While searching the forum for some old topics about cc65 to gather some information, I came across this one: Questions to CC65 users

There is a very important piece of info in it, examplified in the first reply by iss in which he demonstrates that cc65 cleverly optimizes calculations involving char types to 8-bit arithmetics, even though the C standard mandates conversion to the int type for all integer calculations, which means calculations using 16-bit arithmetics at least should be used, as this is the smallest acceptable width for the 'int' type in the standard. See for instance this blog post: Deep C: Integer Promotion or this one: Integer promotions in C, and ponder the implications of this rule, especially for computations involving unsigned and signed variables...

Incidentally, I totally ignored this rule in the C standard until I was told by Fabrice F. the maintainer of the lcc compiler for the OSDK, while discussing code generation and optimization and problems I faced when trying to turn my small "Electr'Oric" game demo into a fully-fledged game, soon hitting memory limits for my compiled code. This was a shock to me at the time, because I thought well, what's the use of a C compiler for the 6502 if it generates verbose, unoptimized 16-bit arithmetic code for simple 8-bit calculations?? I also unfortunately discovered, as DBug had advised me, that the way to go to reclaim some memory was to do away with all function parameters and use global variables instead... This provided a huge memory gain, however there was no cure for the "16-bit calculations" problem...

Anyway, to wrap it up, I think this fundamental difference between cc65 and OSDK's lcc for handling 8-bit arithmetics may very well explain some (or even most) of the generated code size reduction between cc65 and lcc...
Last edited by retroric on Sat Aug 24, 2019 8:26 pm, edited 1 time in total.
flag_fr RetrOric, aka laurentd75 flag_uk
            GitHub - RetrOric
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Bocco's adventures

Post by Chema »

Wells, both compilers can generate assembly code so it would be nice to compare the output of one or two of those routines...

I can't do that now, I am on holiday :D but shouldn't be difficult.
User avatar
Steve M
Squad Leader
Posts: 787
Joined: Fri Mar 24, 2006 3:33 am
Location: Cumbria, UK
Contact:

Re: Bocco's adventures

Post by Steve M »

Just seen this game - looks good. :D
Well done with the work so far.
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: Bocco's adventures

Post by rax »

Hi,
I had some free time and did a few more levels

Enjoy :)
bocco.dsk
(1000.25 KiB) Downloaded 300 times
User avatar
retroric
Pilot Officer
Posts: 125
Joined: Sun Nov 22, 2009 4:33 pm
Location: Paris, France

Re: Bocco's adventures

Post by retroric »

trrerr wrote: Mon Dec 02, 2019 12:12 am Hi,
I had some free time and did a few more levels

Enjoy :)
Hi there,

Thank you very much for adding new levels to your game, I downloaded the new version last week and finished the 4th level, it was awesome, you really have a gift for designing challenging levels, thank you! I'm now looking forward to tackling the last 2 levels!!

Also, I saw you added a new "bocco2" project on GitHUb, is it an evolution of the original bocco game? I cloned the repository and tried to load the .tap file in Oricutron, but it only changes the character font then the emulator hangs so I guess it's not finished yet! :)

Anyway, please keep going at it, I really enjoy your games, I also tried 'Sea Battle' and although I much prefer Bocco's adventures of course, it's still a nice little game that's really well crafted too, congratulations!
Last edited by retroric on Thu Dec 12, 2019 2:34 am, edited 2 times in total.
flag_fr RetrOric, aka laurentd75 flag_uk
            GitHub - RetrOric
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: Bocco's adventures

Post by rax »

Hello retroric,
I'm glad you like what I did. I like the enthusiasm you talk about Bocco Adventures :)

For Bocco2Adventures, yes this will be a sequel to the roguelike style game. What you saw is a very early version. Unfortunately, memory is not enough for what I want to do, and now I'm looking for a way to do it. May I solve this problem.

The idea is rooms and several floors, including monsters and chests, items and spells.

Here are some screenshots of what has been done here:
bocco2.png
bocco2.png (18.27 KiB) Viewed 8215 times
This github repository is temporary and I will remove it. It spoiled the surprise :).

I don't know exactly what will come out with this game :)

I have a few more projects started, and maybe after that I will continue with Bocco2Adventures.
User avatar
coco.oric
Squad Leader
Posts: 720
Joined: Tue Aug 11, 2009 9:50 am
Location: North of France
Contact:

Re: Bocco's adventures

Post by coco.oric »

Lovin' Roguelike games
I'll be happu to try this one, as your games are fantastic trrerr
coco.oric as DidierV, CEO Member
Historic owner of Oric, Apple II, Atari ST, Amiga
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Bocco's adventures

Post by Dbug »

Question: Are you making sure there's a clear version number indicated somewhere in the game?
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: Bocco's adventures

Post by rax »

Hi :),

coco.oric: I also hope to try it on this roguelike game.

Dbug: Тhe version is not described anywhere. Maybe I should put it in the disk name (for easier orientation). The game release versions can be retrieved from the github commits, but maybe you are not asking that. retroric came across repositories of a new game that is a sequel to this one. If I can finish it, it will be in a new git repository.
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Bocco's adventures

Post by Dbug »

trrerr wrote: Mon Dec 16, 2019 11:24 pm Dbug: Тhe version is not described anywhere. Maybe I should put it in the disk name (for easier orientation). The game release versions can be retrieved from the github commits, but maybe you are not asking that. retroric came across repositories of a new game that is a sequel to this one. If I can finish it, it will be in a new git repository.
What I mean, is that at some point your game is going to be in game archives, websites, etc... and nobody will know which versions they are playing with. As a developer it is always super annoying when you get people to complain about missing features, bugs, difficulty, length of a game... when they are actually using a 3 years old version and there was 3 updates with additional levels and bug fixes and speed optimization done since.
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: Bocco's adventures

Post by rax »

You are absolutely right. Thanks for the advice. I'll put the game versions in a prominent place. Thanks :)
Post Reply