Jump to content

Photo

Berzerkoids (alpha)


13 replies to this topic

#1 jum OFFLINE  

jum

    Chopper Commander

  • 116 posts
  • Location:Cape Town

Posted Thu Apr 19, 2018 11:39 AM

I have recently been working on turning my old Lynx "Befok/Berzerk" demo ( http://jum.pdroms.de...x/lynxprog.html) into a complete game.

 

It's taking longer than I thought, with detours into adapting an HTML sprite editor ("Tiny Sprite Editor") to use Lynx palette and output sprite data as C code, and a detour into relearning how Lynx audio works.

 

Also had to convert/update the old CC65 code to use the new CC65 compiler (which is way better, thanks Karri). Working with the old code was probably a mistake - it would have taken me less time just to rewrite it from scratch.

 

Also it's pretty grim for new people trying to get into Lynx programming. We need a proper mid-level Lynx C video/audio library. TGI is not the answer.

 

Anyway, here is the alpha version of "Berzerkoids". It works on a real Lynx, but seems to crash every now and then. Does not crash on Handy. Recommend using Handy 0.98b.

 

 

Attached File  bezerkoids_alpha1.zip   16.78KB   41 downloads

 

There are some audio issues and the bullets are not visible enough.

 

Please give feedback. 

 



#2 karri OFFLINE  

karri

    River Patroller

  • 2,289 posts
  • Location:Espoo, Finland

Posted Thu Apr 19, 2018 11:52 AM

The guy seems to die every time he hits the wall. But I suppose it is part of the game.

 

Works well on Mednafen.



#3 Turbo Laser Lynx OFFLINE  

Turbo Laser Lynx

    Moonsweeper

  • 389 posts
  • Location:Finland

Posted Thu Apr 19, 2018 3:22 PM

Very nice! I was playing it for a while on handy and the sound hanged for a second once, otherwise great stuff! I'll try it out on a real Lynx asap.

 

And welcome back to Lynx programming! Yay! :)

 

Also it's pretty grim for new people trying to get into Lynx programming. We need a proper mid-level Lynx C video/audio library.

 

Could you give some kind of examples what kind of functions a mid-level video/audio library would comprise of? I'm not so well versed in these things but I'm very curious of what kind of improvements would make sense.

 

I've been happy lately because compared to 10 years ago there's a lot of things that are easier now thanks to Karri, Sage, LX.net, Ninjabba, TailChao and others sharing their stuff (Sage's chipper tracker for music, Karri's cart-segments, LX tutorials and Karri's template that incorporates everything needed for a game etc.), but I agree that it's probably not exactly super easy to start out with Lynx programming yet either! There's a lot of work connecting the dots and have all the tools and resources put together in a working work-flow.

 

It could be interesting to get aboard more mid- to high- level coders that struggle with the low-level stuff, but that still would be able to create nice games with a bit easier 'game-framework-programming'. Sometimes I dream of being able to really just jump straight in creating a game for the Lynx like in some super simple but genius IDE like in pico-8:

 

Would still be more interested in trying to make more games myself instead of the tools (backward approach i guess), but in my mind there seems to be a distinction between personalities who actually seem to be more interested in creating the actual tools and personalities who are more intrerested in creating the games, not exclusively, but at least a tendency. (I might be completely wrong). Or maybe it's just a matter of different approaches, the build all tools properly from the ground up before starting coding a game-guys and the 'hack' whatever we have in the simplest way possible to create a game-guys?


Edited by Turbo Laser Lynx, Thu Apr 19, 2018 3:31 PM.

  • jum likes this

#4 walter_J64bit OFFLINE  

walter_J64bit

    Quadrunner

  • 5,115 posts
  • Location:Goldsboro NC

Posted Thu Apr 19, 2018 6:57 PM

Awesome! I've always wanted to play this game! :thumbsup: :thumbsup: It runs on real hardware, I'll have more feedback soon. ;)


Edited by walter_J64bit, Thu Apr 19, 2018 7:57 PM.

  • jum likes this

#5 TrekMD OFFLINE  

TrekMD

    River Patroller

  • 3,468 posts
  • Location:Coral Gables, FL

Posted Thu Apr 19, 2018 8:04 PM

Very nice! 



#6 jum OFFLINE  

jum

    Chopper Commander

  • Topic Starter
  • 116 posts
  • Location:Cape Town

Posted Fri Apr 20, 2018 1:39 AM

Could you give some kind of examples what kind of functions a mid-level video/audio library would comprise of? I'm not so well versed in these things but I'm very curious of what kind of improvements would make sense.

 

I've been happy lately because compared to 10 years ago there's a lot of things that are easier now thanks to Karri, Sage, LX.net, Ninjabba, TailChao and others sharing their stuff (Sage's chipper tracker for music, Karri's cart-segments, LX tutorials and Karri's template that incorporates everything needed for a game etc.), but I agree that it's probably not exactly super easy to start out with Lynx programming yet either! There's a lot of work connecting the dots and have all the tools and resources put together in a working work-flow.

 

It could be interesting to get aboard more mid- to high- level coders that struggle with the low-level stuff, but that still would be able to create nice games with a bit easier 'game-framework-programming'. Sometimes I dream of being able to really just jump straight in creating a game for the Lynx like in some super simple but genius IDE like in pico-8.

 

Would still be more interested in trying to make more games myself instead of the tools (backward approach i guess), but in my mind there seems to be a distinction between personalities who actually seem to be more interested in creating the actual tools and personalities who are more intrerested in creating the games, not exclusively, but at least a tendency. (I might be completely wrong). Or maybe it's just a matter of different approaches, the build all tools properly from the ground up before starting coding a game-guys and the 'hack' whatever we have in the simplest way possible to create a game-guys?

 

These are my thoughts exactly. The goal we are all looking for is "How do we make it easier to make games/apps for the Lynx?".

 

Some options are:

- "Lynx BASIC"  (a playform like Batari Basic or Calamari's 5200Basic)

- "Lynx IDE" - an "all in one" IDE like the Pico8 style (sprite editor, sound/music editor, code editor, emulator, serial uploader) - this is just a dream.

- Existing tools, but make them more integrated.

 

 As you say, a lot of new tools have been written in the last few yeas by Karri, Sage, LX.net, Ninjabba, TailChao and others.  Their efforts are much appreciated. But the working dev environment and workflow are still pretty clunky, and not conducive to a creative process.

 

I'm a "hack whatever we have in the simplest way possible to create a game" type of guy. 

 

So a Lynx new CC65 C library would have:

- Video functions

           - Init video (set up buffers and collision buffer)

           - Sprite start (Suzy go)

           - Sprite draw busy?

           - Draw line, circle, arc, rectangle

           - Draw text

           - Check collisions

           - SwapBuffers (with or without vsync)

           

- Audio functions

           - Init audio

           - Reset audio

           - Start sound on channel n with frequency f

           - Play MIDI note number

           - Predefined "instruments" (with shift bits, feedback bits and vol/pitch envelope)

 

- Other

           - Load data from cartridge ROM

           - Write/read to EEPROM

           - Serial functions

 

...and other functions which are sure to exist in the BLL / ASM libraries but not in any C lib as far as I know.

 

Purpose is to abstract out the low-level complexity (where possible). Also to have smallest overhead.

 

Maybe also add things like a "simple sprite engine" which could manage an array of sprites in a more user-friendly way.


Edited by jum, Fri Apr 20, 2018 1:40 AM.


#7 sage OFFLINE  

sage

    Dragonstomper

  • 861 posts
  • Location:Germany

Posted Fri Apr 20, 2018 5:40 AM

EEPROM and ROM Load exist all as libs for cc65


  • jum likes this

#8 karri OFFLINE  

karri

    River Patroller

  • 2,289 posts
  • Location:Espoo, Finland

Posted Fri Apr 20, 2018 7:03 AM

Hi Jum,

 

I try to answer the topics from cc65 point of view.

 

 

 


- Video functions

           - Init video (set up buffers and collision buffer)

 

tgi_install(&tgi_static_stddrv); // This will activate the Lynx screen

 

Setting up collision buffer has to be done in the config file:

Linkj with lynx-coll.cfg instead of lynx.cfg

 

Activating collision detection:

tgi_setcollisiondetection(active);

 

           - Sprite start (Suzy go)

tgi_sprite(spr);

 

           - Sprite draw busy?

if (tgi_busy())

 

           - Draw line, circle, arc, rectangle

tgi_line (int x1, int y1, int x2, int y2);

tgi_circle (int x, int y, unsigned char radius);

tgi_arc (int x, int y, unsigned char rx, unsigned char ry,
                           unsigned sa, unsigned ea);

tgi_bar (int x1, int y1, int x2, int y2);

 

 

           - Draw text

tgi_outtextxy (int x, int y, const char* s);

 

           - Check collisions

    /* Draw last collidable sprite */
    tgi_sprite(&Ball.sprite);

    /* Examine collisions */
    switch (Ball.collindex) {
    case 0:
      break;
    case 1:
      Ball.hvel = 2;
      LeftPaddle.penpal[0] = COLOR_RED;
      tgi_sprite(&LeftPaddle.sprite);
      break;

 

           - SwapBuffers (with or without vsync)

tgi_updatedisplay();

           

- Audio functions

           - Init audio

           - Reset audio

           - Start sound on channel n with frequency f

           - Play MIDI note number

           - Predefined "instruments" (with shift bits, feedback bits and vol/pitch envelope)

There is a lot of tools available. The easiest is probably abc music at lynx/contrib/abcmusic/cc65version.

 

char *abctune = "X7 O2 I0 V100 T20 R0 H8 K4 |:C2D2E2E2DEFFEFGEFDGGCDEEDEFFEFGEFDCCcBAABAGGAGFFEDEEcBAABAGGAGFFEDCCECDDFDEEGEFGABccECDDFDEEGEFGABccCDEEDEFFEFGEFDGGCDEEDEFFEFGEFDCC:";
 

abcstop();

abcplay(0,abctune);

 

- Other

           - Load data from cartridge ROM

The cc65 supports standard POSIX C-functions:

 

int open(const char *name, int flags, ...)
 

The filename is "0" for the first file up to "4095" which is the highest filenumber the Lynx Cart filesystem supports.

 

off_t __fastcall__ lseek(int fd, off_t offset, int whence);

 

Seeking to an absolute position on the cart.

 

int __fastcall__ read(int fd,void *buf,int count)

 

Reading data from the cart.

 

As the directory system is very often used there is a convenience function that opens the file and reads it in memory to the position defined by the build process.

 

lynx_load(int fileno);

 

 

 

           - Write/read to EEPROM

The eeprom access is done in 16 bit chunks:

 

unsigned __fastcall__ lynx_eeread_93c46(unsigned char cell);
void __fastcall__ lynx_eewrite_93c46(unsigned int addr, unsigned int val);

 

           - Serial functions

The serial functions are interrupt driven standard stuff.

unsigned char __fastcall__ ser_open (const struct ser_params* params);

unsigned char __fastcall__ ser_get (char* b);

unsigned char __fastcall__ ser_put (char b);

unsigned char ser_close (void);

 

 

...and other functions which are sure to exist in the BLL / ASM libraries but not in any C lib as far as I know.

 

The joypad

joy_install(&joy_static_stddrv); // This will activate the Lynx joypad

 

while (joy_read(JOY_1) == 0) {

...

 

Keyboard
if (kbhit()) {
            switch (cgetc()) {
            case '1':


Realtime clock.

 

if (clock() > enemyshot) {

 

Purpose is to abstract out the low-level complexity (where possible). Also to have smallest overhead.

 

Maybe also add things like a "simple sprite engine" which could manage an array of sprites in a more user-friendly way.



#9 karri OFFLINE  

karri

    River Patroller

  • 2,289 posts
  • Location:Espoo, Finland

Posted Fri Apr 20, 2018 7:06 AM

The cc65 has symbolic debugger support. With a little work you could create a complete IDE out of Code::Blocks. I actually intereated the build system there once.

 

Another tool with good integration to make files is Scintilla. It also has 6052 syntax highlighting.



#10 Turbo Laser Lynx OFFLINE  

Turbo Laser Lynx

    Moonsweeper

  • 389 posts
  • Location:Finland

Posted Fri Apr 20, 2018 7:39 AM

@Karri Nice 'compressed' manual for Lynx coding! :) The simple pico-8 manual made me think yesterday if I would be able to write a similar one for the Lynx, but you already went and did most of it ;D

 

That's why I asked this:

 

Could you give some kind of examples what kind of functions a mid-level video/audio library would comprise of? I'm not so well versed in these things but I'm very curious of what kind of improvements would make sense.

 

I was not sure if I misunderstood what 'high-level librarys' actually are, because in my experience programming the Lynx has been almost indentical to using for example the allegro C game framework for pc. I easily ported a couple of my small C lynx games to pc in a couple of hours many years ago.

 

In my opinion having all the functions and parameters listed like that (as a (game) framework/library i guess) is the most fun and intuitive way to program!

 

Probably the biggest problem would still be framgented and old documentation on this forum and spread out tools and tool-versions. A beginner would have to do a lot of research before having a viable workflow set up.


Edited by Turbo Laser Lynx, Fri Apr 20, 2018 7:59 AM.


#11 jum OFFLINE  

jum

    Chopper Commander

  • Topic Starter
  • 116 posts
  • Location:Cape Town

Posted Fri Apr 20, 2018 8:21 AM

Thanks Karri. Some nice information there.

 

What I really want is a replacement for TGI, that includes what TGI does not have (eg: audio, custom text, other draw routines which I have had to implement).

 

ie: A more complete, integrated Lynx CC65 game lib.

 

Probably the biggest problem would still be framgented and old documentation on this forum and spread out tools and tool-versions. A beginner would have to do a lot of research before having a viable workflow set up.

 

 

 

A "single download" of a "Lynx Game Dev" .zip with CC65 and libs and proper documentation and samples would go a long way to making it easier to get into Lynx game dev.

 

Edit: Preferably in github so people can contribute easier.


Edited by jum, Sat Apr 21, 2018 4:01 AM.


#12 karri OFFLINE  

karri

    River Patroller

  • 2,289 posts
  • Location:Espoo, Finland

Posted Fri Apr 20, 2018 9:05 AM

You are free to create a gaming library for the Lynx.

 

We can easily ditch TGI. It is a library created for portability between cc65 platforms. But it has not been used that way.


  • jum likes this

#13 sage OFFLINE  

sage

    Dragonstomper

  • 861 posts
  • Location:Germany

Posted Fri Apr 20, 2018 10:34 AM

There is areason I stay with macro assembler ... everything is there. :-)

 

and Macros are just like BASIC ;-)


  • jum likes this

#14 Turbo Laser Lynx OFFLINE  

Turbo Laser Lynx

    Moonsweeper

  • 389 posts
  • Location:Finland

Posted Fri Apr 20, 2018 2:02 PM

A "single download" of a "Lynx Game Dev" .zip with CC65 and libs and proper documentation and samples would go a long way to making it easier to get into Lynx game dev.

 

A couple of years ago I tried to help out by compiling some sort of list containing the most usual and important Lynx-dev tools. It's still WIP so additions, updates and corrections are welcome.

http://atariage.com/...-tutorials-wip/

 

I'll think of a way to add the 'mini-cc65-manual' Karri just wrote to the post.

 

 

There is areason I stay with macro assembler ... everything is there. :-)

 

and Macros are just like BASIC ;-)

 

I've been looking at c64 assembler a little bit with a couple of friends at work, it's been interesting learning a bit more how assembler works. As you said to me once a long time ago it's easy to understand (but being a noob at it, for what small experiments I wrote, I had to think real hard for every line and look up every register and every instruction etc.) I'm really the graphics guy in that project, because I want to also have time to make more Lynx games, but my friend who is the coder of the project and a much more seasoned programmer than me, has already started setting up a lot of useful macros. To my surprise the code has started looking like a 'normal' non-assembler programming language (generaly speaking) kind of abstracting the assembler within the assembler one level (this was all new stuff for me).

 

And Yes! I'm sure anyone who's into programming or work in the it-field that knows how much love and work goes into these tools are super appreciative to everyone that have been working on them and kindly shared them. I mean it's one of the best things in the world being able to create games for your favourite old gizmo.


Edited by Turbo Laser Lynx, Fri Apr 20, 2018 2:10 PM.

  • jum likes this




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users