Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user ltk_tscc ! (Registered 2018-07-15) You are not logged in 
CSDb User Forums

Forums > C64 Coding > [Req for help] TigerMoth performance
2017-08-02 07:56

Registered: Nov 2005
Posts: 50
[Req for help] TigerMoth performance

Hi all,

I'm getting to a point in TigerMoth that I'm thinking of dropping it. If you watch the video below, you can see when I start hitting a large number of bullets I get really bad performance.


It's kind of expected, but this version doesn't even have the raster splits for dealing with the score or player, no collision detection for the TigerMoth or the player, nor any music, so performance is only going to get a lot, lot worse. I really like what I've managed to put together so far, but if it's not going to be playable, then I might as well drop it now.

So I thought I'd pop on here and see if anyone was willing to have a quick look and see if there were any points that look really bad. My code is broken down in to lots of subroutines (this might be a problem regarding performance?) with headers that hopefully explain what it's job is, and I've tried to keep all the related pieces together in aptly named files so it's easy to mooch about.

I've been working in a private git on my local server, but I've uploaded a snapshot of the current code to GitHub. The source code is MIT license, and if the project is finished, the full source will be released with the game.


Also, for reference, the .spriteproject file can be opened in C64 Studio. Export to data, but change the "!byte" to ".byte"
C64 Studio 4.1

I currently use TASM as my compiler, though I was thinking of trying to move across to the ca65 assembler in the cc65 package. But that doesn't really have any baring on the life of this project.

Oh, and finally, before anyone says, yes, I've got my Sine/Cosine tables all messed up (Sine starts at the positive value, Cosine starts at zero and goes negative before positive), but I'm "okay" with that, I just count my angles anti-clockwise from the "3 o'clock" when dealing with bullets

Thanks in advance
... 29 posts hidden. Click here to view all posts....
2017-08-10 19:06

Registered: Aug 2012
Posts: 8
Quoting ChristopherJam
[...] the Amstrad version looks like it's only doing around 80 enemy bullets [...]

80 bullets? You should try a bit harder and get to the further levels :)
2017-08-14 20:43

Registered: Nov 2005
Posts: 50
I'm kind of getting angles now, but my maths code is still pretty poor. These videos are supposed to show an exploding circle.


The code before this looks pretty nice, it made a "star" explosion... still all wrong though.

I really can't wrap my head around why it's doing this, partly because I'm tired. Feel so close to just ditching this project and working on a simpler one... one that preferably doesn't need 8bit trigometry...
2017-08-15 04:42

Registered: Jun 2002
Posts: 1332
That my friend is you not having proper 2 complements math. First of all, is your sinus table signed at all?!
2017-08-17 19:04

Registered: Nov 2005
Posts: 50
Yeah, my tables are signed. I've clearly got something wrong though
2017-08-18 03:51

Registered: Aug 2004
Posts: 804
It looks like you've just toggled the high bit from the absolute value to get your negative numbers, rather than flipping all the bits and adding one (or alternately just subtracting from 256).

-5 isn't %10000101 ($85), it's %11111011 ($fb)
2017-08-19 20:27

Registered: Nov 2005
Posts: 50
I think you're right, but at the same time, I wrote a subtract_fraction routine, so it shouldn't be a problem, as it'll be subtracting the fraction amount, rather than adding the negative version.

I think I might start a new project that is just my math code and see if I can fix all the problems there, then bring it back into my game project. Should help speed up debugging
2017-08-20 19:09

Registered: Nov 2005
Posts: 50
I bizarrely have 3 angles which don't work properly, and there seems to be a couple of gaps, but otherwise, I think it's looking much better

2017-08-21 13:16

Registered: Nov 2005
Posts: 50
Okay, so the 1st problem was that I had angle 180, where my range is 0-179. Then I also had some issues with sine/cosine of -1.0

Anyway, looks good, but slow
2017-08-21 13:26
Bago Zonde

Registered: Dec 2010
Posts: 28
Well, the real bullet hell :D. In terms of gameplay, do you think you're going to avoid all that bullets during the gameplay? I would try to remove half of the bullets, and try to play with the speed. I'm thinking about the game itself here, as from tech perspective, would be great to have thousands of bullets moving around.

2017-08-21 19:37

Registered: Jul 2009
Posts: 436
Two quick thoughts I had;

#1: How is the plotter set up, not using a shitload of jsr and stuff I hope. Also as it's <256 pixels, you should get away with a:

    lda Y_Table_Hi,y
    sta $fc
    lda Y_Table_lo,y
    sta $fb

    ldy X_Table,x
    lda BitMask,x
    ora ($fb),y
    sta ($fb),y

where X and Y contains the plott coordinates.

Second, the bullets seem to follow the path of an expanding circle. Could this be handled by a adapted Bresenham's circle algorithm (only drawing in two lower quadrants and limiting the number of pixels to match what you have on your youtube video)?
Previous - 1 | 2 | 3 | 4 | 5 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Users Online
Almighty God/L64/Ons..
Guests online: 19
Top Demos
1 Uncensored  (9.7)
2 Edge of Disgrace  (9.7)
3 Coma Light 13  (9.6)
4 Comaland 100%  (9.6)
5 The Shores of Reflec..  (9.6)
6 Wonderland XII  (9.6)
7 Lunatico  (9.6)
8 We Come in Peace  (9.5)
9 Incoherent Nightmare  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 FMX Music Demo  (9.6)
2 Daah, Those Acid Pil..  (9.5)
3 Pandemoniac Part 2 o..  (9.5)
4 Treu Love [reu]  (9.5)
5 Merry Xmas 2017  (9.4)
6 Dawnfall V1.1  (9.4)
7 Arok 20 Invitation  (9.4)
8 In Memoriam BHF  (9.4)
9 Dawnfall  (9.4)
10 Synthesis  (9.4)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Finnish Gold  (9.4)
5 Crest  (9.3)
Top Hardware-Gurus
1 Soci  (9.9)
2 Wiesel  (9.9)
3 Grue  (9.8)
4 Zer0-X  (9.8)
5 Lemming  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2018
Page generated in: 0.054 sec.