Second Passion MSX2 contest - Results

by Latok on 25-08-2011, 11:14
Topic: MRC
Tags: Challenges
Languages:

Three years ago, the website PassionMSX started a new contest. It was an interesting initiative to get some more attention to MSX2 game development, after MSXdev has assumingly taken away most of the MSX2 development. The first edition resulted in two entries, by TNI and Infinite. For the second edition, initiated about two years ago, the prize money - a considerable amount - was increased even more. However, after a year, the same two groups (TNI and Infinite) came up with entries again, and coincidentally both games were about escaping from jail. Game developers either couldn't finish their efforts in time, or they hadn't even begun. Whatever reasons there may be, the intentions to inject some life back into MSX2 game development didn't quite work out.

In the year that followed after the contest was closed, people were questioning what ever happened to it. With Passion MSX halting its editorial duties it was already evident that any formal announcements would be moved to MSX Blue. A few days ago, MSX Blue announced that the results of this contest would finally be published, in the 'other' section of the MSXdev website. So here it is; according to the jury (SuperCobra, Manuel Pazos and mars2000) the winner of the second Passion MSX2 contest is Jailbreak, by Infinite. This entry received a score of 69.3%, winning all individual aspects except polish, while TNI's Moron van der Slut received a score of 57.3%.

And with that, the Passion MSX2 contest series has come to an end. And that's probably not something that comes as a surprise to most of us. As the organizer has mentioned, there's little point in organizing a contest when the harvest contains only two entries, made by the same people. It would perhaps be interesting to discuss the concept of contests. There's certainly an audience for MSX2 games, not to mention MSX2+ games and turbo R games. How could such a contest be initiated in a fruitful way? If you have ideas about this matter, let's hear it!

Relevant link: MSXdev - Passion MSX2 results - jury report

Comments (53)

By hap

Paragon (2020)

hap's picture

25-08-2011, 12:25

If I say anything bad, will mars delay prize payment?
Anyway, good news! congrats to the winner and runner-up.

About any new contest, I don't think it can be successful: developers will hesistate to join unless the contest is a success (which it will only be if there are enough entriesTongue). Therefore, I believe it'd have to be organized by a group of active(and willing!) developers.

By ARTRAG

Enlighted (6229)

ARTRAG's picture

25-08-2011, 12:56

Loot at the demo on the first page of MSX Blue at 3:09
http://www.youtube.com/watch?v=oxTPkHkrais&feature=player_embedded

This 3d raycasting looks great! What is the trick?

By hap

Paragon (2020)

hap's picture

25-08-2011, 13:05

What raycasting? Tongue
In demos, if it looks too good, it's a trick. I don't think that part is feasible as a 3D maze game engine.

By Paulbrk

Hero (611)

Paulbrk's picture

25-08-2011, 17:41

I recomend to ask to the coder of the demo, I think it can be a good engine.

By JohnHassink

Ambassador (5399)

JohnHassink's picture

25-08-2011, 18:34

Not to be negative, but a demo is just that: it does its thing, never interrupted by sudden changes.
It's an entirely different story when the engine has to immediately react, at all times, on user input.

(ofcourse there are demos which do react on some keys etc., but not at the level which an actual game implies)

By ARTRAG

Enlighted (6229)

ARTRAG's picture

25-08-2011, 19:12

never the less raycasting on z80 can work at reasonable speed
there are lots of examples (outside the msx scene)

By hap

Paragon (2020)

hap's picture

25-08-2011, 19:24

Ok you're the expert.
Also keep in mind that the VDP is not fast when it comes to simulating 3D animation on screen.

What about the other game, Jailbreak. Is it also too slow for ya? oO

By ARTRAG

Enlighted (6229)

ARTRAG's picture

25-08-2011, 20:09

No. It is fast, but the level of detail of walls and corridors and the general feeling of 'all the same' make the player look only at the mini map...

By dvik

Prophet (2200)

dvik's picture

25-08-2011, 20:36

I did some calculations to see if it would be feasible to make a screen 3 wolfenstein like engine similar to the demo, and I believe it is. I didn't get to actually try the concepts and its really pushing the limits, but I did pseudo code for the engine that would give a frame rate of 10-15 fps (not sure if I needed three or four VBLANKS for the calculations and some game logic)

By PingPong

Prophet (3413)

PingPong's picture

25-08-2011, 21:02

@dvik: so your screen area is 64x48 pixels? how you think to deal with strange vram address layout of screen 3?

By ARTRAG

Enlighted (6229)

ARTRAG's picture

25-08-2011, 21:28

From my experiments, with some vdp trick for the scaler, like RLE encoded textures, it could be done also on msx2 in screen 5.
The frame rate varies according to the complexity of the textures (longer runs ==> faster rendering).
BTW an average of 10fps is perfectly reasonable for a screen 256x160 (where x resolution is 2 pixels)

By ARTRAG

Enlighted (6229)

ARTRAG's picture

26-08-2011, 13:34

maybe using only 4 colors and a resolution of 64x48 could lead to great results on msx1 too. In this way only the pnt has to be writen. One could even double buffer the pnts...

By wolf_

Ambassador_ (9765)

wolf_'s picture

26-08-2011, 13:48

Yea well, even for MSX1/2/+/R there's probably a way to have a first person shooter engine. But I much rather prefer to play Nemesis 2, Usas, Dragon Slayer 6 and some others. Do you want to play an experimental game that may be technically interesting, but nothing more than that, or do you want to play a stone age concept that works great within the hardware boundaries of the MSX?

One could work a whole year on the best possible FPS for MSX, or work a whole year on a smash hit RPG. I know what I would want to do, and play!

By ARTRAG

Enlighted (6229)

ARTRAG's picture

26-08-2011, 13:59

How many rpgs there are on msx? How many fps? How many msx users would buy a good fps game for msx?

By wolf_

Ambassador_ (9765)

wolf_'s picture

26-08-2011, 14:17

How many rpgs there are on msx? How many fps? How many msx users would buy a good fps game for msx?
The latter question I don't know, especially because of the word 'good' you've added. The first two are questions for which everyone knows the answer.

But it seems like you see it as important to have an FPS on MSX, why? To say 'look, we can do that too!', or because you really think it results into a quality game that's as enjoyable as the best game?

By ARTRAG

Enlighted (6229)

ARTRAG's picture

26-08-2011, 15:10

becouse we can do it and do it well. I expect we could do, on msx1, as well as m.o.o.d. for c64

By wolf_

Ambassador_ (9765)

wolf_'s picture

26-08-2011, 15:45

Again: it may quite be possible, that's true, but the fact that is may be possible does not guarantee a game that's fun to play. You're seeing all this through the eyes of a programmer..

Out of these two, I know which one I'd prefer to play Tongue

m.o.o.d. - C64
http://www.youtube.com/watch?v=X3Oqz5WjDPI

Zelda - C64 (obviously the music isn't SID)
http://www.youtube.com/watch?v=0-mu2rAgK_w

By Paulbrk

Hero (611)

Paulbrk's picture

26-08-2011, 15:59

I like to play a 3D game on MSX with the look of Avaakkus 3D engine Smile but with well designed levels of course.

Can be a lot better than Mood on C64.

Screen3 with 2x sprites can be a large enemies Smile

If someone likes to do, I can make the textures and the enemies for him.

By dvik

Prophet (2200)

dvik's picture

26-08-2011, 16:22

Out of these two, I know which one I'd prefer to play

Yes, no question.

M.O.O.D is technically pretty cool, but I don't think a game like that, even if it was made in '84 would have revolutionized the game industry like the original Wolfenstein did when it was released.

It is a fun challenge though to do something like M.O.O.D on an 8 bit computer. On MSX1 you could get higher resolution than on C64 though, mainly because most of a 3D game is computing, not output to VRAM. I actully didn't even consider using 8x4 pixel blocks, but that would make it easier.

By ARTRAG

Enlighted (6229)

ARTRAG's picture

26-08-2011, 18:31

Using 8x4 blocks would lead to a screen resolution of 32x48 and 16 colors. VRAM update would be easy and the raycaster should compute only 32 columns.

Never the less, I'd go for 4x4 blocks, having thus a screen 64x48 and 4 colors

In both cases you can update only the PNT, but and higher resolution would give better results, even if with fewer colors.

On msx2 I would lead to this kind of results (atari 8 bit)
http://www.youtube.com/watch?v=Z3-J2-VeoH8&feature=related

By ARTRAG

Enlighted (6229)

ARTRAG's picture

26-08-2011, 23:26

By sd_snatcher

Prophet (3031)

sd_snatcher's picture

27-08-2011, 02:26

And Even the ZX-Spectrum has it. Hehehe

IMHO, all of those are like demos: technically impressive, but not exactly great to play.

For those who want to play a great 3D game on MSX, I'd recommend Red Zone. It's not a FPS, but it's a great shooter anyway. It gets even better with the enhancement patch and with turbo enabled.

By Paulbrk

Hero (611)

Paulbrk's picture

27-08-2011, 09:40

ZXSpectrum has a good Wolfenstein version: http://www.youtube.com/watch?v=vzm9KkJ5lGI

Artrag, I preffer screen3 with 16 colors :)

:)

By ARTRAG

Enlighted (6229)

ARTRAG's picture

27-08-2011, 10:22

writing the tile definition needs too much work. Maybe one could use only pct with blocks 8x2 and screen 32x96

By SLotman

Paragon (1211)

SLotman's picture

27-08-2011, 14:53

That Wolf3D video is running on a Pentagon 256... not on a regular speccy machine, so it doesn't count as a direct comparison to MSX/MSX2 machines Tongue

By ARTRAG

Enlighted (6229)

ARTRAG's picture

27-08-2011, 15:34

look at Project M for atari 8 bit

By Manuel

Ascended (15600)

Manuel's picture

27-08-2011, 16:33

That Project M thing is really quite impressive. Smooth and colorful. And like the ZX Spectrum, it uses a trick (the black lines) to reduce some work Smile

By ARTRAG

Enlighted (6229)

ARTRAG's picture

27-08-2011, 20:50

Project M uses 64 columns
it is the s.c. APAC mode
http://atariwiki.strotmann.de/wiki/Wiki.jsp?page=APAC%20Graphics%20Mode
with a 32 pixel wide area around the screen

By Paulbrk

Hero (611)

Paulbrk's picture

28-08-2011, 18:52

Slotman, Wolf3D of speccy works on a normal 128kb machine, you can try if you like Smile

By ARTRAG

Enlighted (6229)

ARTRAG's picture

29-08-2011, 00:11

Minigame compo 2011 with The Keep for vic 20
http://minigamecompo.weebly.com/4k-page.html

By PingPong

Prophet (3413)

PingPong's picture

30-08-2011, 00:37

in only 4KB? i'm imressed. is there the source code?

By dvik

Prophet (2200)

dvik's picture

30-08-2011, 01:19

Here is the source for my IOCCC winner, which is a wolfenstein type engine in 2000 characters of code. Most of the code is unix graphics and input management, loading maps and bitmaps etc. the actual raycasting is pretty small. You can download it from the ioccc website with some maps and bitmaps. The program has a default map but its not that interesting.

#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<sys/time.h>
#include<X11/Xlib.h>
#include<X11/keysym.h>
Window L;
GC N;
Display *K;
XEvent O;
XImage *Q;
float w, x, y[7 << 16];
struct timeval S, U;
int a, b, c, d =
  92, e, f, g, h, i, j, k, l, m, n, o, p, *q[96], r[7 << 16], s[96], *t,
  *u = r, *v, P = 256, R[64], T, J = 12288;
struct
{
  int a, b, c, d, e;
} A[9999], *B, *G, *H;
unsigned char C, D[9999], *E = D, F[] = " .bmp";
FILE *I;

#define Q(o,X,Y,C)B->b=b+32*o,B->c=c+32*X,B->d=Y,B->e=C,B++->a=l,
#define D(o,X)(int)((X*(B->b-e)-o*(B->c-f))/(x*B->e-w*B->d))

int
main (int X, char **Y)
{
  for (j = J << 8, x = y[i], w = y[i + 32], B = A; k = D (x, w), B->b;
       k >> 8 ? 0 : (l = D (B->d, B->e), l > 0
		     && l < j) ? j = l, h = k, g = B->a : 0, B++);
  for (;
       X
       && (p =
	   1 | 3 * (o = (--X < 2 || 119 - 1[Y[1]] ? 320 : atoi (2[Y]))) / 4);)
    {
      for (e = f = J / 2, K = XOpenDisplay (0); m < o << 8;
	   y[m] =
	   sin ((m & 255) / 20.4 + asin ((m / P - o / 2) / 3.2 / o)),
	   D[m & 511] = 10 + d * !(1 & (m >> 3 & m)), r[m++] =
	   m / 18 << (16 & (m >> 6 ^ m)));
      for (N =
	   XCreateGC (K, L =
		      XCreateSimpleWindow (K, RootWindow (K, 0), 0, 0, o, p,
					   0, 0, 0), 0, 0), ((I =
							      fopen (X ?
								     Y[X]
								     : "",
								     "r")) ?
							     fread (E + 1,
								    1,
								    1 << 15,
								    I),
							     fclose (I) :
							     0), B = G =
	   A + J / 3; *++E; f = l == 32 ? e = b + 99, c + 99 : f)
	for (l = *E - 10, *F = *E, k = !l, b *= !k, c += P * k, b += P;
	     l > 54 && l < 96
	     && (Q (0, 0, 1, 0) Q (8, 0, 0, 1) Q (8, 8, -1, 0)
		 Q (0, 8, 0, -1)
		 ! q[l] && (s[l] = 1, q[l] = u, I = fopen (F, "r"))); l = J)
	  for (q[l] = ++u + 19, m = 2;
	       n = (m++ % 3 ? n : 0 ** ++u) >> 8 | C << 16, *u =
	       n, 0 < fread (&C, 1, 1, I)
	       || (m /= J, s[l] = m ? m : 1) * fclose (I););
      for (XMapWindow (K, L),
	   XSelectInput (K, L, KeyPressMask | KeyReleaseMask), H = A; G->b;
	   *H = *G++, H += !B->b)
	for (B = A + J / 3;
	     B->b && !(B != G && B->b == G->b - 128 * (B->d - G->d)
		       && B->c == G->c - 128 * (B->e - G->e)); B++);
      for (Q =
	   XCreateImage (K, DefaultVisual (K, 0), DefaultDepth (K, 0),
			 ZPixmap, 0, (char *) (v =
					       malloc (4 * o * p)), o, p,
			 32, 0);
	   d = (d + R[19] - R[17]) & 127, n = R[18] - R[20], n ? (i =
								  o * 128 +
								  d + (n <
								       0) *
								  64, main (0,
									    Y)
								  >
								  200) ? e +=
	   (int) (y[i] * 64), f += (int) (y[i + 32] * 64) : 1 : 1;
	   XSync (K, 0), gettimeofday (&S, 0), m = T - S.tv_usec)
	{
	  for (T -=
	       (m > 0
		&& m < J * 4 ? U.tv_usec =
		m, select (0, 0, 0, 0, &U) : m) - 4 * J, a =
	       a + 1 & -1 >> 1, m = 0;
	       k =
	       1 +
	       (int) (p * 512 /
		      ((i = m * P + d, g = n =
			0, main (0, Y)) * y[m * P + 32])), m < o; m++)
	    for (t = g ? c =
		 64 * s[g], q[g] + h / 4 + 64 * (a / 3 % s[g]) : t;
		 l = 32 - (17 << (k < 2)) * (2 * n - p) / k, n < p;
		 v[m + o * n++] = l >> 6 ? 4477904 << (l < 0) : t[c * l]);
	  for (XPutImage (K, L, N, Q, 0, 0, 0, 0, o, p); XPending (K);
	       R[63 & XLookupKeysym (&O.xkey, 0 & XNextEvent (K, &O))] ^=
	       O.type == KeyPress || O.type == KeyRelease);
	}
    }
  return j;
}

By ARTRAG

Enlighted (6229)

ARTRAG's picture

30-08-2011, 08:37

about The Keep, its asm source is here
http://www.kweepa.com/step/vic20/thekeepsrc.zip

dvik, nice code! BTW the source for a raycaster already optimized for z80, (ASM+C no float, only integer) is in the maze3D project
https://sites.google.com/site/testmsx/msx2-doom

By Ivan

Ascended (9093)

Ivan's picture

30-08-2011, 19:45

There's certainly an audience for MSX2 games, not to mention MSX2+ games and turbo R games. How could such a contest be initiated in a fruitful way?Make a special MSXdev edition only for MSX2/2+/turboR, for God's sake!

By dvik

Prophet (2200)

dvik's picture

30-08-2011, 19:46

I think the VIC-20 version is quite attractive actually. Using 8x2 pixels gives to me a much more natural look and feel than 4x4. On MSX I think this could be made quite fast as well, Less raycasting (only 32 horizontal lines) and most likely possible to pre-calculate tiles so only updates to name table. With this approach I think its possible to get 25fps.

By dvik

Prophet (2200)

dvik's picture

30-08-2011, 19:49

Make a special MSXdev edition only for MSX2/2+/turboR, for God's sake!

Not sure why MSDDEV would be a more successful avenue for MSX2 games than the Passion MSX 2 contest Question

By Ivan

Ascended (9093)

Ivan's picture

30-08-2011, 20:01

Everybody would be forced to develop for MSX2!

By Huey

Prophet (2644)

Huey's picture

30-08-2011, 20:06

Just creating an MSX2 (and up) competition is not going to give results.

MSXdev works because MSX1 keeps it small and simple (small learning curve). MSX2 not (higher learning curve).
And for all who dare to say differently I wonder where their entries for the previous 2 Passion contest went?Running Naked in a Field of FlowersRunning Naked in a Field of FlowersRunning Naked in a Field of FlowersRunning Naked in a Field of FlowersRunning Naked in a Field of FlowersRunning Naked in a Field of Flowers

By wolf_

Ambassador_ (9765)

wolf_'s picture

30-08-2011, 20:35

MSX2 is different, not harder. Both MSX1 and MSX2 have pros and cons.

MSX1
+ fast full screen updates
- crappy sprites
- crappy tiles
- no scrolling
- ultra bright candy colors

MSX2 (bitmap)
+ per pixel detail
+ improved sprites
+ palette
+ scrolling, of which at least the vertical scroll is not bad at all, in practice
- whole screen changes aren't going to be fast

Which boils down to: in tile mode you can have any screen at any time, in bitmap mode you'll have to plan ahead a lot, and assume that you can't have any screen at any time. That is the main difference. And in screen 4 you have benefits of both - sorta! There may for sure be a reason why MSX2 development lacks behind, but that an MSX2 would be harder to work with won't cut it, for me.

Did it ever occur to you that this contest wasn't marketed very well? "Guess the number" could've won the third prize two times, both with 10 lines o' code in screen 0. If people don't even do that (free money!), then they just don't know the contest.

By ARTRAG

Enlighted (6229)

ARTRAG's picture

30-08-2011, 20:52

dvik, I do agree, never the less, with blocks of 8x2 pixels you can update just the PNT only if you reduce the number of colors to 4

8x2 pixels <==> each tile has 4 macro pixels

256 tiles per PNT <==> 4 macro pixel ^ (4 colors) = 256 possible pre-computed tiles

By SLotman

Paragon (1211)

SLotman's picture

30-08-2011, 21:46

I agree an MSXDev "2" contest you be great!

I don't believe in this argument that "MSX2" games are bigger, therefore harder to make - you can make the same game on MSX1/SCR2 and MSX2/SCR4, but on SCR4 with less flicker and more colors (8 sprites per line, plus 3 colors using only 2 sprites). And if you're feeling 'bold' you can do the whole game on SCR5, or even SCR8! Wink

Also, the game itself doesn't have to be big, just fun!

And there are some quite big games developed for MSXDev/MSX1! Look at the 'big' winners of every year: they are very big games!

By dvik

Prophet (2200)

dvik's picture

30-08-2011, 21:50

with blocks of 8x2 pixels you can update just the PNT only

Yes, that's what I meant.

And visually I think it could be better than SC3.

By boblet

Master (188)

boblet's picture

30-08-2011, 22:47

personally I'd like the msxdev'xx contest to include "that which can run on any (or specific) msx with optional addon hardware that actually exists", by that if someone says "msx2+ with scc" then yay! if it means "turboR + 9990" then yay for that too.

But I guess I'm in a minority

as wolf says someone could have written a ten line epic in basic and erm.. got prizes.. at some... point

Of course for higher end systems more effort for assets blaa blaa time blaa blaa not get done blaa blaa and whatever.

Even if something's just a non scrolling sc4 game, free choice of colours and better sprites could reach a actually I can't remember what the point I was trying to make was.

Running Naked in a Field of Flowers

By MäSäXi

Paragon (1884)

MäSäXi's picture

31-08-2011, 08:11

I don't believe in this argument that "MSX2" games are bigger, therefore harder to make - you can make the same game on MSX1/SCR2 and MSX2/SCR4, but on SCR4 with less flicker and more colors (8 sprites per line, plus 3 colors using only 2 sprites). And if you're feeling 'bold' you can do the whole game on SCR5, or even SCR8!

Also, the game itself doesn't have to be big, just fun!

[Just my thoughts] I have dreamed if there could be someone who A) likes a lot colourful early eighties arcade games (1980-1983) and B) can code for MSX2. Such person could probably quite easily make some nice shooter or platform or maze game for MSX2. Just go to youtube and KLOV to search arcade games from such years. There are more than MANY to choose from. And even better would be that that person would choose the best ideas from each game and make even better game!!!! Those early eighties arcade games are VERY PLAYABLE and mostly quite easy in their ideas, so it couldn´t be too hard to adapt samelike enemy flying/walking paths and get some graphic ideas too. Most of those games are graphically "close" to MSX1 too, but they are of course easier to make on MSX2. Please remember that MSX-DEV started with 8Kb games. They are faster to make too as you cannot put too much into them. And please remember that those colourful early eighties arcade games were either less than 10Kb long or maybe 21Kb or something like that if programmers went crazy with all that memory space!! LOL! But if I am the only one who likes this idea.... to have an easy way to make easy to make good looking and really playable oldies-style MSX2 games....... well.... maybe you don´t need new MSX2 games anyway....? Maybe it is better to continue whining and living without new MSX2 games.... Wink Tongue Hopefully somebody likes my dream. Smile
[/just my thoughts]

By Huey

Prophet (2644)

Huey's picture

31-08-2011, 08:36

I guess I am the only one that thinks MSX2 programming has a higher learning curve.

Let's get it over with and please someone start a competition for MSX2 (or higher/lower).
I am not an MSX2 hater. I would be happy to see MSX2 games released.

By ARTRAG

Enlighted (6229)

ARTRAG's picture

31-08-2011, 09:28

@dvik using only 4 colors is ok for walls but a bit limiting for enemies. IMHO the cpu time saved by the pnt trick could be used to do some bitwise work on the spt (like scaling and clipping). The other option is no pnt trick, update the sole pct (about 6k, 4k with a large scorebar) and render also enemies as bitmap. It gives 16 colors and also, willing, allows for a 64 columns rendering but seems too slow for actual games

By dvik

Prophet (2200)

dvik's picture

31-08-2011, 21:21

I think using sprites and masking is the better option (even the large sprites). As you said, this is really fast, and would reduce the appearance of blockiness.

By PingPong

Prophet (3413)

PingPong's picture

31-08-2011, 21:58

[Just my 1.5 cents]
Maybe we can live without the need to make msx1 games at all cost? Maybe if a game looks too horrible on msx1 because of hw limits, it's not better to try on more powerful ( more powerfull? we are speaking of a 8bit machine ) generation instead of having the usual crappy-but-at-any cost-msx1 version?
[/Just my 1.5 cents]
About learning curve: using msx2 screen 4 does not imply learning anything, except of:
we have 8 sprites/scanline
we are not limited to slow bandwidth in active area.
we can use a vertical scrollreg
we need to write sprite color definitions 512 bytes before than we do on msx1

By dvik

Prophet (2200)

dvik's picture

31-08-2011, 22:46

Maybe we can live without the need to make msx1 games at all cost

I totally agree. From a personal pow I'm not that interested in MSX2 development, but I definitely think MSX2 development should be encouraged. I wouldn't be a big contributor though. I do have one MSX2/2+ project in mind that I would like to do though, a port of Pinball Fantasy. I've done some conceptual thinking, but with limited time its unlikely to go somewhere, but perhaps someone else can do it Wink

By ARTRAG

Enlighted (6229)

ARTRAG's picture

01-09-2011, 00:41

Great game, 50% of the fun were sampled sfx and mod musics. It could be a good project to have SCC pcm samples.

By MäSäXi

Paragon (1884)

MäSäXi's picture

01-09-2011, 07:56

Maybe we can live without the need to make msx1 games at all cost?
I do hope you got my point? Smile
maybe you don´t need new MSX2 games anyway....? Maybe it is better to continue whining and living without new MSX2 games....
I just asked which one is better: to keep whining for the lack of new msx2 games and continue such way rest of your lives or to make even a little msx2 game to make people happy? Choice is yours, MSX(2) people.

Smile

By ARTRAG

Enlighted (6229)

ARTRAG's picture

01-09-2011, 12:57

my contribution: a raycasting engine in C/asm
fixed point math functions are missing and have to be added in z80 asm
Note also that in the DDA asm code, a R800 mul has to be changed to a z80 mul


#include <float.h>
#include <math.h>
#include <string.h>
#include <hitech.h>

#define uint unsigned int

#include "msx2lib.h"
#include "doom.h"
#include "ports.h"



////////////////////////////////////////////////////////////////////////////////
//GLOBAL VARIABLES//////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////


extern    uchar right, left, up, down, key1, key2;

static    uchar kbd, kb0;
static    uchar shift;
static    uchar jst;

uchar right, left, up, down, key1, key2;

#define getTicks() (*((unsigned int *) 0xFC9E))


extern uchar worldMap[mapWidth][mapHeight];

void minimap(uchar p)
{
	// put here code to show a minimap in buffer p
}

int lineHeight;

uchar color;
  
uchar mapX,mapY;
      
//direction to step in x or y-direction (either +1 or -1)
char stepX;
char stepY;
    
//was a NS or a EW wall hit?
uchar 	side; 

int 	x;

int 	_temp1;
int 	_temp2;
long	_temp3;
				
int		_cameraX;
int 	_sideDistY,_sideDistX;
int 	_deltaDistX,_deltaDistY;

int 	_posX, _posY;
int		_dirX,_dirY;
int		_planeX,_planeY;
int		_rayDirX,_rayDirY;
int 	_rayPosX,_rayPosY;

uchar	raynum;
uchar	*_tmp;

int StartX,StartY;

#define NDIRS 48

#define  MoveSpeed1  6
#define  MoveSpeed2  5

#define  rotSpeed   (2.0*PI/NDIRS)

#define cos_rot  (long)(cos(rotSpeed) * 0x4000UL)
#define sin_rot  (long)(sin(rotSpeed) * 0x4000UL)
 
// some precomputed tables to speed up the raycasting

int dirX[NDIRS/4];
int dirY[NDIRS/4];

int dDistX[NDIRS/4][Wscr/Xres];
int dDistY[NDIRS/4][Wscr/Xres];
int ryDirX[NDIRS/4][Wscr/Xres];
int ryDirY[NDIRS/4][Wscr/Xres];

int alpha;

int *PdDistX;
int *PdDistY;
int	*PryDirX;
int	*PryDirY;

void setmap(int X,int Y,char t)
{
	// put here code to update the minimap with your position
}

void ray_main(void)
{
    screen();

     //x and y start position
	_posX = (StartX + 0.5) * 0x400UL;
	_posY = (StartY + 1.5) * 0x400UL;

	setmap(_posX,_posY,15);	
	
	_dirX = 0.0*0x4000UL;
	_dirY = 1.0*0x4000UL;
	_planeX = 0.66*1.0*0x4000UL;
	_planeY = 0.66*0.0*0x4000UL;
	
	// Precompute as much as you can
	
	for (alpha=0;alpha 0)
                    break;
                color = worldMap[mapX][mapY];
            }
*/

            // Perform DDA in ASM
			// Note: worldMap[][] cannot be larger than 24x24

#asm

			ld	b,mapWidth
			ld	a,(_mapX)
			db 0xed,0xc1		; R800 opcode: mulub .a,.b <=>  hl<- a*b 
			ld	a,(_mapY)
			ld	e,a
			ld	d,0
			add	hl,de
			ld	de,_worldMap
			add	hl,de
			ex	de,hl			;de -> _woldMap[mapX][mapY]

			exx
			ld    a,(_stepX)
			ld    c,a
			ld    a,(_stepY)
			ld    b,a
			ld    a,(_mapX)
			ld    e,a
			ld    a,(_mapY)
			ld    d,a
			exx

			push    iy
			push    ix
			ld    ix,(__sideDistX)
			ld    iy,(__sideDistY)
			and    a

    ;while (1)
_while:
			;{
			;if (sideDistX < sideDistY)
			push	ix
			pop		hl
			push	iy
			pop		bc

			sbc    hl,bc
			jp    nc,_else
			;{

			; sideDistX += deltaDistX;
			ld    bc,(__deltaDistX)
			add    ix,bc

			; mapX += stepX;
			exx
			ld    a,e
			add    a,c
			ld    e,a
			bit    7,c
			exx

			jp    z,_incx
_decx:
			ld    hl,-mapWidth
			jp    1f
_incx:
			ld    hl,mapWidth
1:                      
			add   hl,de
			ex    de,hl

			; side = 0;
			ld    c,0
			;}
			jp    _L3

			;else
_else:
			;{

			; sideDistY += deltaDistY;
			ld    bc,(__deltaDistY)
			add    iy,bc

			; mapY += stepY;
			exx
			ld    a,d
			add    a,b
			ld    d,a
			bit    7,b
			exx

			jp    z,_incy
_decy:
			dec    de
			jp    1f
_incy:
			inc    de
1:
			; side = 1;
			ld    c,01h
_L3:
			;}

			;if (worldMap[mapX][mapY] > 0)  break;   // any tile!=0 blocks the ray

			ld    a,(de)
			or    a
			jp    z,_while

			ld    (_color),a			; //return the blocking tile
			ld    a,c
			ld    (_side),a

			exx
			ld    a,e
			ld    (_mapX),a
			ld    a,d
			ld    (_mapY),a
			exx

			pop    ix
			pop    iy
			;}

#endasm

			//Calculate distance projected on camera direction (oblique distance will give fisheye effect!)
			// and height of line to draw on screen
			if (side == 0)
			{
				_temp1=(((int)((mapX + (1 - stepX) / 2)) <<10) - _rayPosX);

				if (_rayDirX)
					_temp2 = iabs( imul(Hscr / 0x10, _rayDirX) / _temp1 );
				else
					_temp2=0;

				lineHeight = _temp2;
			}
			else
			{
				_temp1=((((int)(mapY + (1 - stepY) / 2)) <<10) - _rayPosY);
				if (_rayDirY)
					_temp2 = iabs( imul(Hscr / 0x10, _rayDirY) / _temp1 );
				else
					_temp2 = 0;
				lineHeight = _temp2;
			}

			if	(color>2)			// FLAT COLOR SECTION 
			{

				if    (lineHeight >= Hscr)    lineHeight = Hscr;

				//give x and y sides different brightness (colors 0-7 are half tones of 8-15)
				if (side == 0)
					color |= color*16;//colorSideA[color];
				else
				{
//					color = (color>>1);
					color |= (color>>1)*16;// colorSideB[color];
				}

				//draw the pixels of the stripe as a vertical line
				colRender ( x, lineHeight, color );								// set here your scaler for flat colors
			}
			else									// TEXTURED SECTION (ONLY FOR TILES 1 and 2 in this sample)
			{
				//texturing calculations
				uchar texNum = color - 1; 			//1 subtracted from it so that texture 0 can be used!

				//calculate value of wallX
				uint _wallX;

				//x coordinate on the texture
				uchar texX;

				if (side == 1)
				{
					_wallX = _rayPosX + imul(_temp1,_rayDirX) /_rayDirY;
				}
				else
				{
					_wallX = _rayPosY + imul(_temp1,_rayDirY) / _rayDirX;
				}

				_wallX & = (0x400UL-1);

				//x coordinate on the texture
				texX = shar10((int)_wallX * (int) texWidth) ;

				if	(side == 0 && _rayDirX > 0)
					texX = texWidth - texX - 1;

				if	(side == 1 && _rayDirY < 0)
					texX = texWidth - texX - 1;

				texColRender ( x, lineHeight, texNum, texX, side );			// set here your scaler for textures
			}

        }


        swap_buffer();

        kbd = checkkbd (8);
        jst = joy ();

        //////////////////////////////////////

        right    = ((!(kbd & 128))|| !(jst & 8));
        left     = ((!(kbd & 16)) || !(jst & 4));
        up       = ((!(kbd & 32)) || !(jst & 1));
        down     = ((!(kbd & 64)) || !(jst & 2));
        key1 	 = ((!(kbd & 1))  || !(jst & 16));

        shift 	=  ((!(checkkbd (6) & 1)) || !(jst & 32));


        //move forward if no wall in front of you
        if (up)
        {
			if (shift)
			{
				_temp1 = (_posX + (_dirX>>MoveSpeed2));

				if (worldMap[shar10(_temp1)][shar10(_posY)] == 0)
					_posX = _temp1;

				_temp1 = (_posY  + (_dirY>>MoveSpeed2));

				if (worldMap[shar10(_posX)][shar10(_temp1)] == 0) 
					_posY = _temp1;

			}
			else
			{
				_temp1 = (_posX + (_dirX>>MoveSpeed1));
			
				if (worldMap[shar10(_temp1)][shar10(_posY)] == 0) 
					_posX = _temp1;

				_temp1 = (_posY  + (_dirY>>MoveSpeed1));

				if (worldMap[shar10(_posX)][shar10(_temp1)] == 0) 
					_posY = _temp1;

				if ((worldMap[shar10(_posX)][shar10(_temp1)] == 1) || (worldMap[shar10(_posX)][shar10(_temp1)] == 2)) break; 
			}
        }
		
        //move backwards if no wall behind you
        if (down)  
        {
			if (shift)
			{
				_temp1 = (_posX - (_dirX>>MoveSpeed2));
				if (worldMap[shar10(_temp1)][shar10(_posY)] == 0) 
					_posX = _temp1;
				_temp1 = (_posY - (_dirY>>MoveSpeed2));
				if (worldMap[shar10(_posX)][shar10(_temp1)] == 0) 
					_posY = _temp1;
			}
			else
			{
				_temp1 = (_posX - (_dirX>>MoveSpeed1));
				if (worldMap[shar10(_temp1)][shar10(_posY)] == 0) 
					_posX = _temp1;
				_temp1 = (_posY - (_dirY>>MoveSpeed1));
				if (worldMap[shar10(_posX)][shar10(_temp1)] == 0) 
					_posY = _temp1;
			}
        }
		
        if (right)        //rotate to the right
        {
			if (!shift)
				alpha ++;	
			else
				alpha +=2;
				
			if	(alpha>=NDIRS) 
				alpha -=NDIRS;
        }

        if (left)	        //rotate to the left
        {
			if (!shift)
				alpha --;	
			else
				alpha -=2;
				
			if	(alpha<0) 
				alpha +=NDIRS;
		}
    }
}


By ARTRAG

Enlighted (6229)

ARTRAG's picture

01-09-2011, 14:38

Wscr is the screen window
Xres is the Xstep
Acting on those parameters you can any resolution you like (e.g. 32 columns)