Outrun style road demo MSX2

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

By PAC

Guardian (5603)

PAC's picture

28-11-2019, 21:02

Nice work! Smile

By Ivan

Ascended (9156)

Ivan's picture

28-11-2019, 21:09

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

By Pencioner

Scribe (1094)

Pencioner's picture

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 :)

By Grauw

Ascended (8914)

Grauw's picture

29-11-2019, 00:11

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

By Metalion

Paragon (1110)

Metalion's picture

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.

By Pencioner

Scribe (1094)

Pencioner's picture

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

By Metalion

Paragon (1110)

Metalion's picture

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

By wimpie3

Champion (293)

wimpie3's picture

12-12-2019, 12:23

Niiiice!

By ARTRAG

Enlighted (6338)

ARTRAG's picture

12-12-2019, 14:35

very nice!!

By zett

Hero (606)

zett's picture

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/18
1 | | 3 | 4 | 5 | 6 | 7