Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Digging games

    Help
    9
    30
    1463
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Martin
      Martin Fuze Team last edited by

      Yep, I'm after some help for a change!

      SO, many of my favourite games from the early 80's involve digging. By this I mean Mr Do!, Dig Dug, Robby Roto and so on. But how would you best go about that? So we'll take DigDug since most people will know that one. It's trivial to draw the level in the map editor. Oh, scrub that, Dig Dug has stripes. Mr Do! then - same theory, no stripes. You can also do spawn points and what-not, and place the cherries. All pretty simple stuff.

      But how would you go about making the player dig away at the "playfield" as they move? You can't use collision shapes because as far as I know you can't redfine the shapes "on the fly".

      So how about it? I'm not after code examples, or explicit detail. Just a bit of game theory on how you might tackle this.

      Ta very much in advance. And I promise to produce something that uses it if I can get my head round it (but don't hold your breath, you might expire)

      1 Reply Last reply Reply Quote 3
      • SteveZX81
        SteveZX81 F last edited by

        I'm a huge fan of games like Mr Do!, Dig Dug etc. The way I'd "attempt"to go about it is probably stupid but hey I'm going to say it anyway.
        I would basically try to cheat and use several boxes to draw the solid coloured 'background and the dirt I'd have sprites (say 16x16 or 32x32) and I'd place the sprites under or behind you as you walk around. That way it would have the illusion of having dug a path into the coloured background?

        Retrocade_media 1 Reply Last reply Reply Quote 3
        • Retrocade_media
          Retrocade_media F @SteveZX81 last edited by

          @SteveZX81 Thats actually really smart, I've never thought of placing sprites. Just remember to adjust the speed of the player based on if they're digging or walking on predug ground

          1 Reply Last reply Reply Quote 1
          • Martin
            Martin Fuze Team last edited by

            Oh! Well, I'm not 100% following that because in, for example, Mr Do! you can dig anywhere can't you? But you have got me thinking now though. After the benchmarks the other day where we proved that Fuze can happily cope with 1024 to 2048 sprites on the screen at once, the screen could surely be entirely made of sprites!

            I'm 100% sure that's not the way it's normally done but that's largely down to the fact that hardware of the time might had topped out at like 8 or 16 sprites and the rest would have been tiles.

            Retrocade_media 1 Reply Last reply Reply Quote 1
            • Retrocade_media
              Retrocade_media F @Martin last edited by

              @Martin could use small 4x4 tiles, but I don't think you can write to tilemaps on the fly in Fuze

              1 Reply Last reply Reply Quote 0
              • Martin
                Martin Fuze Team last edited by

                @Retrocade_media that depends on how you do the tilemaps. If you have an array of tile numbers (or 2 dimensional array of tiles) then you can. But you have to be careful because array performance suffers with multiple dimensions. I did a proof of concept with a similar thing before but I got completely stuck on how to make the tiles be eaten away rather than vanishing tile by tile. Well, the proof of concept was for something different but it was essentially the same wall that I hit.

                1 Reply Last reply Reply Quote 1
                • Martin
                  Martin Fuze Team last edited by

                  Ohhh, the proverbial penny has just dropped about how to do this! I wonder how quickly I can knock up a proof of concept.

                  SteveZX81 1 Reply Last reply Reply Quote 1
                  • SteveZX81
                    SteveZX81 F @Martin last edited by

                    @Martin said in Digging games:

                    Ohhh, the proverbial penny has just dropped about how to do this! I wonder how quickly I can knock up a proof of concept.

                    Well don't keep it to yourself. do tell!

                    1 Reply Last reply Reply Quote 0
                    • Martin
                      Martin Fuze Team last edited by

                      Well I want to test it first! But my sticking point has always been the eating away of the tile pixel by pixel. Whether that tile is a sprite or an image. But just for once, if instead of a transparent background you give the player a black background with an alpha of 1 then you'll naturally appear to be eating away at the tile as you move and once they are over a certain threshold you remove the tile. Simplz

                      1 Reply Last reply Reply Quote 2
                      • Martin
                        Martin Fuze Team last edited by Martin

                        OK, my idea isn't going to work because as you travel along the dirt is removed with jagged edges and rounded corners:

                        Screenshot 2020-05-02 at 00.44.20.png

                        [EDIT] Oops, that's a bit large!

                        1 Reply Last reply Reply Quote 1
                        • xevdev
                          xevdev F last edited by xevdev

                          Use two layers back layer totally filled dirt
                          Overlay a transparent screen and draw your tunnel on that screen. Looking at the edge pixels of the tunnel they repeat every 8 pixels each direction so if you want to remove dirt one pixel layer at a time you'd need eight images on the x and eight on the y or two pixels half that. Just keep track using mod to find which image to draw.
                          Haven't played Mr do ? For a long time looks like it's set on a grid with the fruit .so keep track of the grid in an array - uses four bits to denote open or closed directions so you can program the enemies.
                          Overlay your sprites over that.
                          Oh yeah almost forgot give you tunnel image rounded corners.

                          1 Reply Last reply Reply Quote 0
                          • waldron
                            waldron F last edited by waldron

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            • waldron
                              waldron F last edited by

                              This post is deleted!
                              1 Reply Last reply Reply Quote 0
                              • PB____
                                PB____ last edited by PB____

                                Just looked at a short video on how Mr Do does this. It appears it just draws the background black where you walked (not really collision detection on the grass needed?) In that case you could probably just draw the grass of the level on an image, then draw black over that image where you have walked (not sure if you can erase part of a picture to become transparent, otherwise I'd go with that in stead of black, so the digging could reveal things that are drawn behind the image if that would be necessary).

                                Eventually you just draw the updated grass image to the framebuffer that gets cleared every now and again (since you don't want to 'clear()' the grass image)

                                #EDIT: You could almost certainly draw the grass image to the framebuffer using renderEffect(..) to use a specific mask color on the grass image as transparent (and use a render effect not to draw that coulor [I'm not brittish] to the framebuffer)

                                DomDom Gothon 2 Replies Last reply Reply Quote 0
                                • DomDom
                                  DomDom F @PB____ last edited by

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 1
                                  • PB____
                                    PB____ last edited by

                                    🇳🇱 well I wasn't thinking on how my typo would sound 😋

                                    1 Reply Last reply Reply Quote 0
                                    • Martin
                                      Martin Fuze Team last edited by

                                      Right, I need to put some of these ideas together and do some digging (ouch!).

                                      1 Reply Last reply Reply Quote 2
                                      • xevdev
                                        xevdev F last edited by

                                        Retrocade_media 1 Reply Last reply Reply Quote 5
                                        • Retrocade_media
                                          Retrocade_media F @xevdev last edited by

                                          @xevdev are you not clearing the screen or just creating sprites?

                                          xevdev 1 Reply Last reply Reply Quote 0
                                          • Gothon
                                            Gothon F @PB____ last edited by Gothon

                                            @PB____ You can actually draw in transparent or partially translucent colors, but you have to change the blend mode to 0 using setBlend(0). With the default blend mode the colors will blend because of the transparency. So, you can have a background layer that is gradually revealed by writing transparent color to the foreground layer using render targets and blend modes.

                                            1 Reply Last reply Reply Quote 2
                                            • First post
                                              Last post