Navigation

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

    New to Fuse4-want a Faery Tale Adventure like game

    General Discussion
    17
    186
    24888
    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.
    • tdg8934
      tdg8934 @xevdev last edited by tdg8934

      @xevdev SUCESS - NO CRASHES !!!

      Following Sahara-Min method:
      “
      function main()
      // Program starts here
      return void

      // Other functions...
      // Variables...

      main()
      “

      See the working crash free (WIP) FTA like game:

      ID: Z7573MND51

      From now on I will always use this program layout.

      Thanks so much especially @xevdev and @sahara-min

      tdg8934 1 Reply Last reply Reply Quote 5
      • tdg8934
        tdg8934 @tdg8934 last edited by

        All,

        I have made some great updates to the (WIP) - FTA like game

        Updates:

        1. Fixed logic so when you find objects they are removed not going into the abyss
        2. Have N S E W NE SE SW NW and Home teleport locations (Use if you have a travel stone)
        3. 24 hour day over 1800 seconds (Set it to what you want but it might get dark sooner)
        4. Green jewel night vision capability
        5. Bird totem zoom out capability
        6. Find object- keys, jewels, rings, jade skulls, orbs, glass vials, bird totems, money bags, treasure chest
        7. Coins (find money bag)
        8. Use Glass viaL to increase vitality
        9. Help menu

        Plus previous stuff - all crash free!!!

        What’s not working yet:
        Keys, orb, ring, jade skull, sea shell
        Creating bad guys to fight
        Creating landscape, water
        More...

        ID: Z7573MND51

        tdg8934 1 Reply Last reply Reply Quote 8
        • tdg8934
          tdg8934 @tdg8934 last edited by

          Update on the FTA (WIP) game!

          ‪FTA ‬
          ‪ID: Z7573MND51‬ (Live)

          For all that are following this game development. I’m now over 8K lines of code still with no crashes.

          I have been focusing on going outside of the home village of Tambry. You can teleport to 9 locations (if you have a bird totem). There is now a cemetery when the character can also fight to the left or right now. The grim reaper is inside of the crypt and will give you a gold statue if you come back after midnight. If you continue south and then to the right along the paths (note teleport stations). You will find the capital city of Marheim where the king is at. His daughter is missing. Lots more to see and do but not going to give away too much yet. See the pics ![alt text](9EF7F16C-58BA-42E3-ABB9-8458EC29F821.jpeg 507FE402-7FEC-423D-93D6-B6F06CF5361C.jpeg 94A393F3-3FA5-4ED6-B88D-46712E8E9056.jpeg DE5A2000-9D1F-44EB-8C20-353E76D57A32.jpeg 17B33F0A-851A-42F4-B734-DEE1A9ABF834.jpeg 8CFB7047-023D-4CB7-ADC6-D45119FA8523.jpeg 0AB111F8-6462-42E8-927B-E50CEAE93B6A.jpeg A5004BEB-BD1A-43E0-A19A-1221339BC46E.jpeg 3E1E5349-634A-4360-AE21-64FD8E11439D.jpeg D9C8912D-F67B-4295-82D0-F2BC6C9AF56E.jpeg 7E8138B5-0636-4993-9A5D-AD0DA74A9690.jpeg 17C31CE6-E494-46C0-8450-E37A4492687C.jpeg image url)

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

            Looking really sweet.

            tdg8934 1 Reply Last reply Reply Quote 2
            • tdg8934
              tdg8934 @xevdev last edited by

              @xevdev yes I’m pretty happy with it . I just can’t believe how much work is involved in the details. I love spending every free minute I can on it daily. I have learned so much on this project being my first Fuse4 program.

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

                Addicted like me.
                I like how you've kept on going because there is a lot of details in every game and that's where you learn to code. I love the puzzle of it all too.

                tdg8934 1 Reply Last reply Reply Quote 2
                • tdg8934
                  tdg8934 @xevdev last edited by

                  @xevdev I’ve been able to get 5 enemies to come out (no weapons yet). They can walk towards the main character and keep some distance between all of them. The main character can collide his weapon into the enemy and the visibility is set to false (ie killed). One issue is the main character uses c=controls() but the enemies move toward the main character from random locations but they are always in a running/waking animated mode (no idle stance) that I can’t seem to figure out yet. It’s looking great so far.

                  tdg8934 1 Reply Last reply Reply Quote 2
                  • tdg8934
                    tdg8934 @tdg8934 last edited by

                    I did a lot of code cleanup and added in a user interface coding from Gothans Rubics cube Fuze4 program. Also focused on the title screens . Sorry the lighting wasn’t great for the time of day on my tv.312C837D-9B34-474B-92B8-90EA4FF0264B.jpeg 3A412623-0BF2-42BF-A324-D05A5D6712B7.jpeg AB1E53E4-CC8B-4C01-B64D-56A6C2956F2A.jpeg F5A5F6BB-7423-463B-97BB-0D596E5789FF.jpeg B0B810CE-ED09-4991-BA84-86BC791D68E9.jpeg 86DB4DD0-C2F6-408E-A2E1-60F2C8DF5576.jpeg B8E981A0-C176-42FC-94CE-4DADAC91BED6.jpeg 3427EC39-08CB-473E-86AC-683D824F0E37.jpeg Gotham

                    1 Reply Last reply Reply Quote 11
                    • vinicity
                      vinicity F last edited by

                      Looking good, Tim!

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

                        Yeah, it totally is!

                        1 Reply Last reply Reply Quote 2
                        • Z-Mann
                          Z-Mann last edited by

                          Good luck! This was one of the first games I played on my own computer, so it has a special place in my heart. Don't forget to include the secret of mysterious Pixle Grove! (Going by the ingame spelling)

                          You should probably spend some time on removing code duplication, though. I haven't looked too closely, only had a quick scroll through (the version from two days ago or so), but are you handling each item in the world in its own bit of code? If you continue that, you'll go mad. The code editor is slowing down already, that's only going to get worse as the file grows. Code cleanup isn't sexy and it's tempting to put it off for later, but in my experience (outside of FUZE), it's best do do it as early as possible.

                          tdg8934 1 Reply Last reply Reply Quote 3
                          • tdg8934
                            tdg8934 @Z-Mann last edited by tdg8934

                            @Z-Mann thank you for the insight. I’m not a programmer so I tend to do things as I think of them. It has definitely been driving me crazy but I’m drawn to it.
                            I was figuring out how to deal with all of the landscaping (plants, etc) hoping I could make them into sprites and randomly lay down a few million of them but that caused memory array issues. But the worst was the more I add, it seams like the NOTE FREQ music seems to slow down. I then thought of making plants into Images but all that happens is that they float on the main 1920x1080 window as the character walks. So it looks like I’m going to have to use the map editor and just click all over the grass. I did that and got the character and enemies to slow down at random speed differences so that worked. But the larger this program gets it makes me wonder about the effort in the landscaping and being worth it. Yes grass and villages and mountains and castles are ok but it’s already over 10k of code lines to scroll through. The enemies don’t really fight yet but they do swarm around and get near the main character. I can kill them by running back and forth into each one 5 times when they drop a random item for me to pick up.
                            I also had problems getting arrays to transfer with functions too so I went back to how it is now.

                            I just shared the latest copy:

                            ‪FTA ‬
                            ‪ID: Z7573MND51‬

                            Z-Mann 1 Reply Last reply Reply Quote 0
                            • Z-Mann
                              Z-Mann @tdg8934 last edited by

                              I haven't used images myself yet and the documentation is not super clear, but could it be that the coordinates you give to drawImage are just screen coordinates? With sprites and maps, any coordinates you give them are modified by the sprite camera postion. So when you want to draw images in specific world positions, you may need to place them at {x - centerPoint.x, y-centerPoint.y}. That's what I would try, anyway. But: stick to sprites and maps. The huge advantage of sprites is that Fuze takes care of not wasting time on offscreen sprites for you. Slowdown only crops in between 5000 and 10000 sprites. I'd be surprised if the map system would perform worse.
                              To make the map less tedious to fill, you could define your own huge grass image (like four screens big) and use that as background over and over. That would only need repeating... 4250 times. Err. You'll need to either shrink the map or divide the world between several maps, it seems.

                              Speaking of the sprite camera postion: You should do drawMap() after setSpriteCamera(). The way you do it now, the old sprite camera position is still used for the map, so the map scrolling is one frame behind the sprite scolling. The visible effect is that as you change walking direction, the sprites seem to wobble back and forth on the ground.

                              A little push in the right direction against code duplication: Around line 1730, you're distributing the items randomly. You can simplify that:

                              function RandomizePositions(ref sprites)
                              positions = []
                               for i = 0 to len(sprites) loop
                                rx = rnd(range1)-range2
                                ry = rnd(range1)-range2
                                positions[i] = {rx, ry}
                                setSpriteLocation(sprites[i], rx, ry)
                                setSpriteVisibility(sprites[i], true)
                               repeat
                              return positions
                              

                              Key caveats are that while you can modify array elements of an array you pass in via 'ref', you can't currently extend the array. So the options to fill the positions array are to either pre-allocate it to its correct length before passing it into the randomize function by reference, or just having the randomize function return it. Returning it is easier.
                              Then you can position your white keys with

                              p2white = RandomizePositions(keywhite)
                              

                              and the other items accordingly. Extra randomization, like the bag contents, still need extra care, obviously.

                              tdg8934 1 Reply Last reply Reply Quote 3
                              • tdg8934
                                tdg8934 @Z-Mann last edited by tdg8934

                                @Z-Mann and others,

                                I was able to clean up alot of my code in sprite duplicate areas for 10k lines down to 7k without even looking at the enemy coding yet so that’s a huge improvement!

                                However I’m still seeing the Game and music playing slower for some time now. When Map1 is loaded the FPS drops from 60 to less than 30.

                                Since the original Faery Tale Adventure game had 17k screens that were 256x256 which equates to 1.1 billion screens. (It’s hard to believe over a billion screens were created by hand with 16x16 tiles)

                                Map1 which only covers a small portion of the original game (Tambry, graveyard, marheim, teleportation, walking, etc) is ~ 86,000 x 44,000 which is 1,824 (1920 x 1080) screens. If the original games 1.1 billion (256x256) screens were divided into (1920x1080) screens that would be 57,456 screen so currently my too large 1824 (1920x1080) screens would need to be 31.5 times more maps.

                                As it appears my configuration would need much smaller and higher quantities of maps to keep the frames per second up towards 60, I believe will need to scrap my Map1 and try to figure out what screen size would keep my FPS high.

                                If I load a blank map (map graphics are gone but game operates normally with sprites present running normal. It’s showing with Map-Blank loaded 1686 MB at 60 FPS. However with Map1 (map graphics are all there, ie houses, grass, teleported) but has 30 FPS and 1431 MB size playing slowly.

                                Thoughts on this?

                                Thank you - Tim

                                Z-Mann 1 Reply Last reply Reply Quote 0
                                • Z-Mann
                                  Z-Mann @tdg8934 last edited by

                                  To make the music play at constant speed no matter the FPS, you need to incorporate the measured frame rate into account somehow. The length in second of the previous frame is returned by deltaTime(). Care needs to be taken: it will not be exactly 1/60 if you hit 60 fps and 1/30 if you drop to 30 fps. Even in the best case, it is going to fluctuate a little around 1/60. The playback code should cope with that.

                                  What I tried, and it worked, is to modify the playMelody function near the bottom. Before it, I declare a global variable:

                                  melodyRemainder = 0.0
                                  

                                  And in the body, I replace

                                  melodyTimer += melodyTempo
                                  

                                  with this:

                                  melodyRemainder += deltaTime() * 60              // take into account actually passed time
                                  melodySteps = floor(melodyRemainder)             // take only integer part
                                  if melodySteps < 1 then melodySteps = 1 endIf    // advance at least one step
                                  melodyRemainder -= melodySteps                   // keep balance for next frame
                                  
                                  melodyTimer += melodyTempo * melodySteps
                                  

                                  If you hit 60 FPS, even if deltaTime fluctuates, melodySteps will be 1 almost all of the time, so no change. And if you hit 30 FSP, deltaTime() will be about 2, so will melodySteps.

                                  Or, if you prefer it to be simpler, you can omit the melodyRemainder variable and just do

                                  melodyTimer += melodyTempo * deltaTime() * 60
                                  

                                  This might even be better, depending on how sound and video output interact timing wise. Go with the simpler version first and switch to the more complicated one only if the simple version doesn't work for you.

                                  Regarding the map: Make sure it is really the map rendering. Just because you jump from 30 to 60 FPS if you disable it says nothing; maybe the map rendering takes 1 ms and the rest of your main loop takes 16 ms, just fast enough to allow 60 FPS, and the map rendering just pushes you over the edge. You can test that by not removing the map rendering, but replacing it with

                                  sleep(0.008) // 8 ms of sleep
                                  

                                  If you still get 60 FPS with that, you know the map rendering takes more than about 8 ms and yeah, you'll need to do something about that.
                                  But if you drop to 30 FPS, you know the rest of your main loop takes more than about 8 ms and that's where you're more likely to find improvement opportunities.
                                  You can play with the 0.008 parameter to get a better feel for where the problems lie.

                                  If it is indeed the map rendering, there would be one way to deal with it without splitting the map. Instead of rendering the map to the screen, you render a section of the map, say of size 3x3 screens, into an image. That image is then what you render to the screen. Since it is larger than the screen, you can scroll around in it quite a bit before you hit the edge; until you do so, you do not have to refresh it from the map. Of course, every time you do have to refresh the image, there will be a short, but noticeable, pause. And any chance to maybe put sprites behind map objects is lost. I'd just split the map up, I think.
                                  (Well, no. I would try to implement the metatile system, fail miserably and give up.)

                                  tdg8934 1 Reply Last reply Reply Quote 2
                                  • tdg8934
                                    tdg8934 @Z-Mann last edited by tdg8934

                                    @Z-Mann thank you for your analysis!

                                    I tried the simple fix (1 line approach) and the note freq music played normally at 60 FPS so that fixed that issue.

                                    I inserted the sleep (0.008) statement and removed load / draw map statements and the FPS did stay at 60 FPS so that tells me it’s a draw map issue. Perhaps with the music sounding right again, the game appears to be ok at 30 FPS. Is it ok to have it at 30 FPS or should it always be close to 60 FPS?

                                    I’m heading on vacation in the morning to Ohio for a few days so I won’t be able to work on this until Friday.

                                    Thank you again!

                                    1 Reply Last reply Reply Quote 1
                                    • Z-Mann
                                      Z-Mann last edited by

                                      If you do manage to hold 30 FPS to the end, it should be fine. It's a slow paced game. The original ran at 20 FPS at most, going by memory and feeling, and that was not an issue. Focus your attention to things that matter more.

                                      1 Reply Last reply Reply Quote 2
                                      • tdg8934
                                        tdg8934 last edited by

                                        Hi All! I haven’t left the site but experienced a job loss which turned into a transfer and promotion within my company. I have moved with my wife to Utah from Illinois and have been tied up with my new role and purchasing a house. I will continue with my FUZE4 FTA like game in February or March once we close on the house. (Tim)

                                        1 Reply Last reply Reply Quote 9
                                        • CasualTie5
                                          CasualTie5 F last edited by

                                          Sounds busy! Good look with everything you're doing, and happy coding (once you got time for it again, that is)

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

                                            Glad you haven’t left, Tim. Congrats on the promotion!

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