22 August 2020, 08:08 | #61 | |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
Code:
1. Computing the 3D transformation - Advantage: Can use the DMA lock-out during scanline productively - Advantage: Zero RAM consumption for large LUTs - Disadvantage: Much slower than look up 2. Using look-up tables - Advantage: much faster - Disadvantage: needs a lot of DMA access (which we don't have) - Disadvantage: needs a lot of RAM But I don't know how many DMA cycles there are during HBlank. 8-12, perhaps ? Here's a quick computation of cycles available on target NTSC system: Code:
262.5 scanlines per frame 7.15909 MHz 59.94 Hz 20 scanlines for VBLANK 7.15909 / 59.94 = 119,437 cycles of raw CPU time per frame 119,437 / 262.5 = 455 cycles per scanline (including vblank ones without DMA lock-out) I will need DMA to write the result (two words) into RAM via Code:
move.w d0,(a0)+ move.w d1,(a0)+ Code:
move.w (a1)+,d0 move.w (a1)+,d1 move.w (a1)+,d2 |
|
22 August 2020, 12:08 | #62 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Quote:
However, when we're talking about HBLANK on the Amiga it's often not really important to consider the real HBLANK ("the interval during which the beam resets for the next scanline"), but rather it's usually more important to consider the interval during which no bitplane DMA is active on any given scanline where there is bitplane DMA. This is a much larger timeslice than the HBLANK itself and represents the amount of time you have available between two scanlines to do stuff that can't run when bitplane DMA is running. With that in mind: the number of DMA cycles available between scanlines is 226-number of cycles used by bitplane DMA*. For the given screenmode of 640x200x4 we know that the number of DMA cycles used per scanline is equal to (640/16)*4, or 160 DMA slots. This leaves us 66 DMA cycles per scanline, which translates to 132 CPU cycles available per scanline. *) Note: I'm assuming no other DMA is present on the bus to simplify calculations. If the Blitter is active, or Copper+any other DMA is active during a particular scanline it gets a bit more complicated. I'm also ignoring memory refresh as that interleaves with the CPU. Last edited by roondar; 22 August 2020 at 12:28. Reason: Rewrote this to more accurately use the term HBLANK |
|
22 August 2020, 18:18 | #63 | |||
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Thanks for the info, roondar - it's very helpful
Quote:
Quote:
How many DMA slots does a sprite scanline take ? Just 1 ? It's just 2 words per scanline, so I presume HW can read both of them in one DMA cycle ? Quote:
The remaining 62.5 scanlines (262.5 - 200:Visible) I get full 454c / scanline, right ? Thus, 454*62.5 = 28,375. Correct ? Here's my current summary of cycles available per frame: Code:
Cycle Budget Scanlines Cycles Total Description -------------------------------------------- 200 132 26,400 DMA On: cycles during 200 scanlines 200 322 64,400 DMA Off: cycles (bitplane DMA) 62.5 454 28,375 DMA On: cycles (VBLANK) 54,775 : DMA cycles (26,400 + 28,375) 64,400 : No DMA cycles In reality, I will have to benchmark [in scanlines], as the moment I will require RAM, I will burn through the current scanline (up to 322c!) till I reach HBLANK area. So, it will go fast, but at least I have a good idea of the boundaries involved. |
|||
22 August 2020, 18:48 | #64 | |||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Your welcome
Quote:
Quote:
However, the CPU is normally not impacted by Sprite DMA because it interleaves with Sprite, Audio and Disk DMA. So effectively no cycles are lost from the perspective of the CPU. Again, I'm assuming no Blitter/Copper is on the bus as that can and often will cause cycles to be stolen from the CPU. Quote:
About your cycle budget, the numbers are more or less accurate. Note however that the bitplane DMA does not take 322 cycles per scanline, but rather 320. The 2 cycles you're now missing don't get to be used by the chipset (the HRM points out that out of the 227.5 cycles per scanline only 226 can be used by chipset DMA, the rest are not available). The CPU however keeps running during those "missing" cycles, leading to it getting 454 cycles per scanline effectively. I'm sure it's possible I didn't quite get all the details right in the above paragraph as to why the CPU gets 2 more cycles per scanline than the chipset does, but it's close enough for what you're doing here |
|||
22 August 2020, 20:06 | #65 | |||||
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
Quote:
Quote:
Code:
4 slots: Memory Refresh at odd-numbered slots - this is the hint for interleaving :) 3 slots: Disk DMA 4 slots: Audio DMA 16 slots: Sprite DMA 80 slots: BitPlane DMA Quote:
Quote:
Not to mention that it will be a feat if I even get an average of over 50% of CPU cycles during DMA lock-out Besides, since I want a 30fps lock, I will have to reserve a CPU Spike buffer of at least 20-25% of a frame time - e.g. somewhere around ~40,000c, which will be burned by WaitTOF () to make sure the game is always smooth. I could probably accept a very occasional framedrop, like one framedrop in 5-10 seconds, but no more than that. But, the engine absolutely must handle 30 fps with : - HUD - Audio - stars - old enemy explosion - player lasershots - new enemy - new enemy lasershots - 3 other enemies in sector processing their AI (FSM State Machine) If there's a second explosion in parallel with first one, it will eat into the Spike Buffer. Now, the Galaxy update cost will depend on how many squadrons are in the system, so it will take most of time at the start of the game. Perhaps that component will have to be spread across multiple frames (like, just one squadron processed per game frame) as updating 30 squadrons each frame would certainly kill a lot of cycles... |
|||||
22 August 2020, 20:19 | #66 | ||||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Quote:
Yes, those cycles are now technically available to the CPU And no, the CPU could already interleave with disk or sprite DMA in such was no cycles appear to be lost (i.e. the disk DMA cycles slot into the cycles the CPU is not on the bus in the first place). Sorry to harp on about it, but it's all about interleaving. The 68000 normally only accesses the bus every other DMA cycle (this is not quite 100% true, but it's true enough for our purposes). The cycle it doesn't access the bus, it's doing internal stuff. It looks a bit like this: Code:
68000 solo: C-C-C-C 68000 with refresh, disk, sprite or audio DMA: CDCDCD - = no memory access C = CPU access D = DMA access Perhaps it's helpful to remember that Sprite, audio, disk and refresh DMA cycles occur at set times during the scanline and never overlap one another, so CPU interleaving stays possible all the time. Quote:
Quote:
Quote:
|
||||
22 August 2020, 20:19 | #67 |
Registered User
Join Date: Sep 2017
Location: Kansas, USA
Posts: 324
|
VladR, in case you didn't know, WinUAE has a handy visual DMA debugger that will nicely visualize this stuff. Use shift-F12 to open the debugger, use v -2 for visual DMA debugging, and then x to exit the debugger. v -3 doubles the horizontal width, v -4 doubles it vertically as well.
Here's the default colors: Here's F-18 Interceptor: And here's Shadow of the Beast: |
22 August 2020, 21:03 | #68 | |||
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
Imagine we executed an op at the last possible slot in the Mem Refresh area and 68000 now waits for the DMA (due to accessing (a0)+). Shouldn't BitPlane get the DMA cycle (being highest priority) then ? At which point, 68000 will have to wait for whole 80/160 DMA cycles ? Quote:
Also, each 68000 op, depending on addressing mode, takes different amount of cycles even before it gets to the RAM access (EA calculation), so that will certainly result in missing the DMA slot often, I would presume. Code:
(an) (an)+ -(an) d(an) d(an,dn) --------------------------------------------- .b.w/.l 4/8 4/8 6/10 8/12 10/14 abs.s abs.l d(pc) d(pc,dn) Imm --------------------------------------------- .b.w/.l 8/12 12/16 8/12 10/14 4/8 Quote:
Well, if I find I need at least 30,000c per frame, there's always a PAL-only back-up plan |
|||
22 August 2020, 21:05 | #69 | |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
That certainly beats me putzing around with crayons, scribbling on shards of paper around the house after each build Thanks ! |
|
22 August 2020, 23:33 | #70 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Quote:
You can find it and my reply here: http://eab.abime.net/showthread.php?t=103669 Last edited by roondar; 22 August 2020 at 23:44. Reason: Felt this became too off-topic, moved it |
|
25 August 2020, 14:47 | #71 |
Registered User
Join Date: Jan 2015
Location: Melbourne, Australia
Posts: 548
|
I don't mind the slightly off-topic talk, I found it very interesting. Looks like you've got some great ideas for this VladR, well done!
|
27 August 2020, 13:02 | #72 | |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
That being said, being a huge fan of Galactica, it's impossible watching the series without getting dozens of ideas suitable to plug into a Star Raiders-type game... In our case, the sooner you destroy the Resurrection ships, the sooner you can eradicate all Cylons. If you don't destroy it ASAP, they will just keep spawning again and again and merely prove a great targeting practice |
|
28 August 2020, 03:37 | #73 | |
Registered User
Join Date: Jan 2015
Location: Melbourne, Australia
Posts: 548
|
Quote:
Having agreed with that, the idea you have said does sound good, and could add an extra layer of strategy, as in which one do you go after first, one further from where you are but closer to a starbase you need to defend, or one closer to where you currently are? |
|
28 August 2020, 18:28 | #74 | |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
The thing with Resurrection ship is that there would be only one. But shooting down Cylons while they are in its range doesn't accomplish anything as they merely download again. Actually, it's a bit more complex than that. There was a whole episode on Galactica where they explained how Death is merely a learning experience for Cylons. Meaning, the more a Cylon dies, the better he becomes as they keep their memories. Which points back to my basic RPG system with stats like {Level, HP, Armor, Attack, ShotsPerSecond, Accuracy, Rage}. Meaning when they die, and download into new body, they keep their stats. But, each time they die, their Rage stats goes up, meaning they become more aggressive. At a certain Rage level they could turn kamikaze and simply ram your ship (from up close and personal), which would prove a great learning experience for a player So, in theory, you could keep killing Cylons, and they would simply keep becoming better until they are so strong you can't do much damage to them anymore as they will kill you in one shot (after, say, 5-10 Downloads). On another hand, it would be ridiculous, if you could just show up, at Level 1, and destroy Resurrection Ship right after mission starts. So, there will have to be some balance in how much you need to upgrade yourself and how many times you can realistically respawn the same Cylons. I'm debating whether to simply show the Cylon's level in the HUD or not. It would certainly create more tension, if you could only indirectly infer their level from their behavior - but coming up with a different recognizeable attack pattern after each Death Upgrade is a ton of work and debugging... But, that'd add yet another strategy layer - imagine you encounter a Cylon and don't know their level, so attempt to come closer and notice kamikaze behavior. You'd have to hyperspace instantly and hope to survive. Of course, you would have to keep some thyllium (refilled upon docking, but easily reusable [and used up] for engine boost when hunting) on board for these scenarios, otherwise Obviously, to keep it fair, no Download for Player - only InstaDeath |
|
30 August 2020, 16:51 | #75 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
Why don't close a little bit actual screen area to gain some dma slots? Instead 640*200 you could go for 640-640 = 576*200. This will give you some edge....
|
01 September 2020, 19:08 | #76 | |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Quote:
Today, with ultra-wide monitors, this might look somewhat like doom in a postage stamp size window... Benchmarks will tell what's doable and what is not... |
|
01 September 2020, 19:22 | #77 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
I've implemented basic view-point rotation. On top of Star Raiders' Axis X and Axis Y, I figured it wouldn't hurt to also have rotation along Axis Z - could be used to enhance the Hyperspace jump...
I did about 5 versions, last being probably fastest possible without using additional look-up tables, but I suspect there will be some additional cycle savings possible once I merge this stage with 3D transform. |
02 September 2020, 07:01 | #78 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
@VladR
Think how many Great Games on Amiga used this "trick": Turrican series, Elf Mania, Shadow of the beast.... |
02 September 2020, 09:21 | #79 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
Didn't know that. I will keep it in mind.
Number one thing that is in my control is number of stars processed and how many days I wanna burn on optimizing The rest (AI+sprite handling+audio+input+HUD) has a fixed cost, though some of those components can have a different update frequency (not everything has to happen each frame). |
02 September 2020, 16:55 | #80 |
Registered User
Join Date: Dec 2019
Location: North Dakota
Posts: 741
|
I did a bit of work on rotation and tied it to a keyboard input, so stars now rotate properly along X&Y Axis, including clipping.
Next thing will be experimenting with star entry/exit. I currently assume that the star keeps its original direction vector that it had upon entry to the viewport (inverted view vector, basically) - which is what I believe gives the stars its look&feel (needs some tweaking). Since I'm testing against WinUAE, I keep 24 stars per layer and have 16 layers. That many certainly won't be realistic on OCS at a target framerate (but should certainly be fine on V4). |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is there Star Raiders 2 on Amiga ? | VladR | Retrogaming General Discussion | 16 | 19 January 2020 12:55 |
Star Trek Judgment Rites Amiga port | mc68060 | Retrogaming General Discussion | 4 | 02 January 2020 21:57 |
[Found: Star Fleet I: The War Begins!] Star Trek-like, probably not licensed | aeberbach | Looking for a game name ? | 7 | 14 October 2019 15:51 |
Star Raiders (Atari ST) - Source Code | kamelito | Retrogaming General Discussion | 8 | 19 December 2015 06:02 |
raiders from lankhor | turrican3 | project.aGTW | 11 | 19 August 2012 15:05 |
|
|