Jump to content
IGNORED

Berzerkoids (alpha)


jum

Recommended Posts

I have recently been working on turning my old Lynx "Befok/Berzerk" demo ( http://jum.pdroms.de/lynx/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.

 

 

bezerkoids_alpha1.zip

 

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

 

Please give feedback.

 

Edit: latest version of Berzerkoids is here: http://atariage.com/forums/topic/277916-berzerkoids-alpha/page-2?do=findComment&comment=4268115

Edited by jum
  • Like 4
Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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/forums/topic/256753-atari-lynx-programming-tools-and-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
  • Like 1
Link to comment
Share on other sites

  • 9 months later...

I first downloaded befog, and then berrkoids -- wow, the game came along quite a way in between the two releases!

 

Like you say, there are audio issues.

 

I have tested it on a Mac (OpenEmu) and on an Android Lynx emulator I'm working on.

 

I did have to rename it to .LNX for OpenEmu, but that was cosmetic.

 

I think the main issue/one that fixing would help the most would be the audio issue.

 

 

 

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.

 

 

attachicon.gifbezerkoids_alpha1.zip

 

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

 

Please give feedback.

 

Edited by bhall408
  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Here is the latest (and maybe final) version of Berzerkoids for Lynx.

 

I have only tested on Handy so far, still have to test with my RetroHQ Lynx SD card.

 

Main changes are some minor speed improvements, and some voice samples.

 

Edit: Replaced the attached version with one that works on real hardware.

 

 

bezerkoids_alpha2.zip

Edited by jum
Link to comment
Share on other sites

Here is the latest (and maybe final) version of Berzerkoids for Lynx.

 

I have only tested on Handy so far, still have to test with my RetroHQ Lynx SD card.

 

Main changes are some minor speed improvements, and some voice samples.

 

 

 

It isnt working for me on my sd v2 software, i get the intro sound and the title then it goes away and that is all i got.

  • Like 1
Link to comment
Share on other sites

Same on a real cart. The Title text works but immediately when you push a button or joypad the screen gets blank.

 

The difference with an emulator and a real cart is that all variables are zeroed at startup in an emulator. On a real Lynx uninitialized variables contain garbage.

Edited by karri
  • Like 1
Link to comment
Share on other sites

Sorry, may bad for not testing it on real hardware.

 

Seems that the Lynx does not like my "raw text printing" routine, so I have removed it an updated the download in post #16 above. Please re-download and try again.

 

Picked up some other issues on real hardware (screen refresh/vsync, sound glitches, bullet visibility).

 

Thanks for trying it :)

Link to comment
Share on other sites

It is working fine now. The top 1/3 isnt updating properly on my mcwill screen. nice little game. one thing not sure if it is supused to or not, if you shoot a guy and shoot again before the explosion clears it will hit it again.

Looking foward to updates, thanks for making it.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

The first time I heard the robot voice on the splash screen I was appropriately amused! ;-)


Here are some ideas…

  • Allow both A & B buttons to act as fire button (unless you plan to use the B button for something else later on?)
  • Something on title/splash screen to tell you to press a button or move to start the game
  • Scrolling the play field as you move from room to room would be nice
  • Is it possible to play the sampled sounds async? (Or are you doing it sync on purpose?)
  • This wasn’t in the original, but the comment about not knowing the walls would kill you… Is it possible to color cycle animate the walls? (Does Lynx support indirection like that? like 4/800 did?)
Befork vs Berkerkoids… FWIW, I kept saying Berzerker-oids in my head… As in the robots are berserkers…
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...