Javanaise / mrboom-libretro

Mr.Boom is an 8 player Bomberman clone for RetroArch/Libretro
http://mrboom.mumblecore.org
MIT License
200 stars 59 forks source link

"eastern egg" on xmas week #81

Closed frranck closed 3 years ago

frranck commented 3 years ago

What about triggering some xmas features on xmas week? Like vlc that is changing its icon. Willing to help on that @SimpleTease ?

SimpleTease commented 3 years ago

I can try to assist where I can.

Technical

  1. https://github.com/libretro/libretro-common/blob/master/time/rtime.c -- should cover localtime for Libretro

  2. Graphics replacements -- If you add surprises for multi-holidays, (...) (...) maybe it'd be simpler to have different zips and run-time select which package to use? -- edit: Splitting the audio files might be wise in that case. Although the binary would start to grow with each replacement theme regardless.

Theme = I suppose depends on how far you want to go with the makeover

  1. Title
  2. Menu
  3. Pause
  4. Bombermen
  5. Power-ups
  6. Medals
  7. Victory
  8. Draw
  9. Stages

On a side-note, I was looking into expanding the Supreme Victory screen. Adding rest of missing players to stage. Have an idea but need time to test it out.

frranck commented 3 years ago

So I was thinking of something small, this doesn't need to be huge. VLC does the trick with 1 icon... I would change the menu image, so that bombermen have hats, and use an xmas chiptune there also. Since SDL and retrolib are loading differently, I guess one easy option for the image would be to use the same palette and include it as raw data, and then patch the previous version in memory after SDL has decrunched. (after the first call to program()). For the extra music, I would regenerate the zip file that SDL is loading and we would need to add some extra raw data for retrolib.

PS: you're right the supreme victory is really weak...

SimpleTease commented 3 years ago

Since SDL and retrolib are loading differently, I guess one easy option for the image would be to use the same palette and include it as raw data, and then patch the previous version in memory after SDL has decrunched. (after the first call to program()).

I think that could work. Will you be using (8 different bombermen helmet gfx) or (one generic hat sprite and overlay each helmet by copying using transparency bits)?

For the extra music, I would regenerate the zip file that SDL is loading and we would need to add some extra raw data for retrolib.

I imagine that would be the easier part. I'll look into creating some dry runs so I know what to do.

frranck commented 3 years ago

Menu_christmas

SimpleTease commented 3 years ago

That is quite delightful to look at! Carefully drawn. It's the color contrast that's pleasing to me, even when scaled up. Would make a good wallpaper also. I really do enjoy studying it.

Makes the current menu picture a little "drab" from the "darkness". Like it could be brightened up a bit for more energy like this one conveys.

Christmas can start on Sunday. Or it should activate 7 days before the holidate?

SimpleTease commented 3 years ago

Used GIMP. Converted Adobe to sRGB colorspace. Then GIF export. But got stuck extracting raw indexed data from compressed GIF. Also bit sad that GIF conversion dithered picture down from original high quality artwork.

Found Mr. Boom addresses for menu data. m.pal = palette (768 bytes) m.heap[0x3e800] = picture (320x200 = 0xfa00 bytes)

I think your idea about hotpatching the data after running 1 frame would work really well. And allow more customizations.

frranck commented 3 years ago

Hello, I pushed a version with the xmas music: https://github.com/Javanaise/mrboom-libretro/commit/192fa807d205bbc425d43070948679db20797c0b I haven't tried on libretro but It's working on SDL2. I will check tomorrow for the raw data...

frranck commented 3 years ago

what about from the 20 of December to NYE?

SimpleTease commented 3 years ago

Good idea! Added date PR that works on libretro. But! Libretro has some odd music problem and plays wrong tracks. Looking into it.

SimpleTease commented 3 years ago

Looking at using libgif from http://enchantia.com/graphapp/package/src/ and printing out raw index data from there. Seems like it almost works but I'm getting an overdump somehow.

SimpleTease commented 3 years ago

I got the picture loading. Had to correct palette to 25% to work. I'm not sure how it should be integrated to Mr. Boom (file names) so I put the raw source here. https://raw.githubusercontent.com/SimpleTease/mrboom-libretro/theme/xmas_menu.txt

frranck commented 3 years ago

what do you mean 25%?

SimpleTease commented 3 years ago

When I tested the gif data and palette, menu colors came out heavily saturated when displaying xmas image. Final colors did not match the palette at all. Then I saw this line https://github.com/Javanaise/mrboom-libretro/blob/eec5154d973a7d1b1c856d8d879a937c36c2553d/retro.cpp#L363

which has that 4x palette booster. I regenerated the palette at 25% and ran the menu again. Now it shows something recognizable to the correct winter picture.

frranck commented 3 years ago

I figure out for the image, but I still have some issues with the texts colors...

SimpleTease commented 3 years ago

That is going to be harder.

c3 = player1 text color  [c4 44 7c]
e0 = player2 text color  [a4 10 10]
d6 = player3 text color  [38 54 88]
90 = player4 text color  [00 5c 00]
fd = scroll text color   [f4 f4 f4]

So we'll need to export the gif again but use 252 colors and reserve other 4 for team text. White should be very close to something in palette already.

And we'll have to swap around the index values to line up with the fixed color spots. Unless there's a way to change the font colors, which I haven't found yet.

frranck commented 3 years ago

Yes, I asked the graphician to edit the image.

frranck commented 3 years ago

Are you sure about the scroll text color?

frranck commented 3 years ago

btw to generate the image I patched grafx2 https://gitlab.com/GrafX2/grafX2 BMP export in fileformats.c, and I'm saving the image as BMP:


/// Save BMP file
void Save_BMP(T_IO_Context * context)
{
  FILE *file;
  T_BMP_Header header;
  short x_pos;
  short y_pos;
  long line_size;
  word index;
  byte local_palette[256][3]; // R,G,B,0

  File_error=0;

  // Ouverture du fichier
  if ((file=Open_file_write(context)))
  {
    setvbuf(file, NULL, _IOFBF, 64*1024);

    // Image width must be a multiple of 4 bytes
    line_size = context->Width;
    if (line_size & 3)
      line_size += (4 - (line_size & 3));

    header.Signature[0]  = 'B';
    header.Signature[1]  = 'M';
    header.Size_1   =(line_size*context->Height)+1078;
    header.Reserved_1   =0;
    header.Reserved_2   =0;
    header.Offset   =1078; // Size of header data (including palette)
    header.Size_2   =40; // Size of header
    header.Width    =context->Width;
    header.Height    =context->Height;
    header.Planes      =1;
    header.Nb_bits    =8;
    header.Compression=0;
    header.Size_3   =0;
    header.XPM        =0;
    header.YPM        =0;
    header.Nb_Clr     =0;
    header.Clr_Imprt  =0;
    {
      //   Chez Bill, ils ont dit: "On va mettre les couleur dans l'ordre
      // inverse, et pour faire chier, on va les mettre sur une échelle de
      // 0 à 255 parce que le standard VGA c'est de 0 à 63 (logique!). Et
      // puis comme c'est pas assez débile, on va aussi y rajouter un octet
      // toujours à 0 pour forcer les gens à s'acheter des gros disques
      // durs... Comme ça, ça fera passer la pillule lorsqu'on sortira
      // Windows 95." ...
      for (index=0; index<256; index++)
      {
                local_palette[index][0]=context->Palette[index].R >> 2;  

        local_palette[index][1]=context->Palette[index].G >> 2;
                local_palette[index][2]=context->Palette[index].B >> 2;

      }

      if (Write_bytes(file,local_palette,256*3))
      {
        // ... Et Bill, il a dit: "OK les gars! Mais seulement si vous rangez
        // les pixels dans l'ordre inverse, mais que sur les Y quand-même
        // parce que faut pas pousser."
        for (y_pos=0; ((y_pos<context->Height) && (!File_error)); y_pos++)
          for (x_pos=0; x_pos<line_size; x_pos++)
                Write_one_byte(file,Get_pixel(context, x_pos,y_pos));

        fclose(file);

        if (File_error)
          Remove_file(context);
      }
    }
  }
  else
    File_error=1;
}
frranck commented 3 years ago

Fixed the palette!

frranck commented 3 years ago

thanks for your help @SimpleTease, could you please check the libretro version? then I guess we can close this...

SimpleTease commented 3 years ago

Libretro xmas menu looks great!

SimpleTease commented 3 years ago

If you're playing and the clock rolls over to xmas week, new music theme plays but old backdrop stays same. And same happens with NYE rollover at midnight; regular music with winter theme.

I also have this nutty idea of using hq background images (full 24-bpp) but it's still in thinking stage.

frranck commented 3 years ago

I see, we should get the test sticky then and don't bother for roll overs.

HD background images would be quite some work graphical wise, it's hard to find people to draw these things. I applied that filter in the SDL version and that does look better, though there are some small bugs...

One real crazy challenge would be to add a new level with an actual new feature. like conveyor belts.

SimpleTease commented 3 years ago

Not going for HD. Libretro has shaders to upscale the original pixels. Want to use full 320x200 RGB, 24-bpp raw backdrops in place of palettes.

Adding a new level would be a monster challenge. I would do that in C mostly if even possible.

frranck commented 3 years ago

It's not that crazy it's just adding data...

SimpleTease commented 3 years ago

Conveyer belts.

frranck commented 3 years ago

Conveyer belts.

  • Animation. Are they part of looping background slideshow or sprites?

would say looping background, but could be a layer of sprites.

  • Physics. Are monsters affected by them? Powerups? Bombs?

that's a very tricky part

  • AI. How to teach them to use or avoid automatic motion?

well you can modify the path algorithm, you make the trip longer/shorter when you walk on them

  • Image. You have unused level maps or require someone to draw?

would need to find someone

  • Data. Are levels loaded onto heap? Where is expansion added to RAM?

there is level data in some struct in the assembly code, graphics data that is a PCX decrunched and random hardcoded specific stuff when rendering graphics like an "xmas tree sprite".

  • Math calculations to change speed.
  • Apocalypse?

that's part of level data

  • Palette. Shared with other levels? Separate?

there is one palette for all levels