Outrun style road demo MSX2

Page 2/26
1 | | 3 | 4 | 5 | 6 | 7

Par Pac

Scribe (7103)

Portrait de Pac

28-11-2019, 21:02

Nice work! Smile

Par Ivan

Ascended (9371)

Portrait de Ivan

28-11-2019, 21:09

Looking really good! I would like to see changes of slope like in Chase HQ or WEC Le Mans.

Par Pencioner

Scribe (1609)

Portrait de Pencioner

28-11-2019, 22:21

Metalion wrote:

It's a funky mix of HMMV, OTIR, Bresenham and large tables Wink

If you use long OTIRs (with bigger values in B register), you might try to optimize speed with kind of loop unrolling technique
I made sketch (might contain bugs, i didn't verify it, just to make an idea):

OTIR_UNROLL:
  LD A, B
  AND A, #0F
  ADD A
  LD DE, OTIR_LOOP
  ADD E
  LD E, A
  LD A, 0
  ADC D
  LD D, A
  PUSH DE
  LD A, B
  AND #F0
  LD B, A
  RET  ; jumps to OTIR_LOOP + 2 * (B AND #0F)

OTIR_LOOP:
REPEAT 16   ; 16 OUTI command in a row
  OUTI
ENDR
  LD A, B
  OR A
  JP NZ, OTIR_LOOP
  RET

This technique is described in more detail in Grauw's article on fast loops but i tried to modify it to the case when you don't know exact number of bytes you OUT. If you know exact number of bytes, it gets simpler and faster :)

Par Grauw

Ascended (10819)

Portrait de Grauw

29-11-2019, 00:11

Or if the number of bytes is an exact multiple of the number of OUTIs.

Par Metalion

Paragon (1628)

Portrait de Metalion

29-11-2019, 07:43

I know about the OTIR/OUTI optimization, but when you don't know the b value in advance, you're left with an overhead code that destroy the benefit of OUTI, at least under a certain value of b. I have calculated that you need at least 10 bytes for the OUTI optimization to be profitable. My b values are between 1 and 31, at the moment.

Furthermore, my OTIR are racing against HMMV, in order for the CPU to use all the time the VDP takes. It is already too fast, as HMMV writes over my OTIR in some extreme cases. If I accelerate by using OUTI, it will be a problem.

Par Pencioner

Scribe (1609)

Portrait de Pencioner

29-11-2019, 08:40

Metalion wrote:

I know about the OTIR/OUTI optimization, but when you don't know the b value in advance, you're left with an overhead code that destroy the benefit of OUTI, at least under a certain value of b. I have calculated that you need at least 10 bytes for the OUTI optimization to be profitable. My b values are between 1 and 31, at the moment.

Yes, those are small values.

Metalion wrote:

Furthermore, my OTIR are racing against HMMV, in order for the CPU to use all the time the VDP takes. It is already too fast, as HMMV writes over my OTIR in some extreme cases. If I accelerate by using OUTI, it will be a problem.

That's crazy Smile

Par Metalion

Paragon (1628)

Portrait de Metalion

12-12-2019, 10:54

erpirao wrote:

Now we just need a car and some curves

It's been a few days, but curves and hills have been added to the road engine.
Wink

Par wimpie3

Champion (436)

Portrait de wimpie3

12-12-2019, 12:23

Niiiice!

Par ARTRAG

Enlighted (6976)

Portrait de ARTRAG

12-12-2019, 14:35

very nice!!

Par zett

Hero (608)

Portrait de zett

12-12-2019, 14:36

Metalion wrote:
erpirao wrote:

Now we just need a car and some curves

It's been a few days, but curves and hills have been added to the road engine.
Wink

Good start

Page 2/26
1 | | 3 | 4 | 5 | 6 | 7