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
    25251
    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

      @xevdev it’s working! Thank you.

      “
      screenimage1=createimage(1920,1080,true,image_rgba)
      serdrawtarget(screeninage1)
      box(0,0,1920,1080,black,0)
      setdrawtarget(framebuffer)

      array night_day[1]
      night_day[0]={0,0,0,0}//Morning
      night_day[1]={0,0,0,0.3}//Afternoon
      night_day[2]={0,0,0,0.8)//Evening
      night_day[0]={0,0,0,0.99)//Night

      loop
      :
      drawimageex(screenimage1,{960,540},0,{1,1},white*night_day[0],{0,0})
      :
      Repeat
      “

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

        I was surprised that worked then I saw that your using the box.
        If you just draw the game image using drawimageex()
        You can alter the colour spectrum of the image.
        {R,g,b,a}
        Red component.
        Green component.
        Blue component.
        Alpha transparency component.
        Each has a number between 0 and 1
        So as your getting closer to night time twilight you might have slightly more red than the green and blue and don't worry about the alpha set to 1
        Night_day = {1,0.8,0.8,1}
        Or {0.5,0.4,0.4,1}
        So the second is half of the first and will be darker.

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

          You would probably need to think about layers of drawing.
          So your game would be one image and your control schemes would be another ( which you already have ) and print the control scheme with no colour adjust last.

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

            @xevdev this also works The same as you said (without the black box):

            //display scale (handheld or hdmi)
            float descale=0
            int width=0
            width=gWidth()
            if width==1280 then
               descale=2/3
            endif
            If width==1920 then
               descale=1
            endif
            :
            g_buffer=createimage(1920,1080,false,image_rgb)
            :
            array night_day[1]
            night_day[0]={0,0,0,0}//Morning 
            night_day[1]={0,0,0,0.3}//Afternoon 
            night_day[2]={0,0,0,0.8)//Evening 
            night_day[0]={0,0,0,0.99)//Night
            :
            loop
               setdrawtarget(g_buffer)
               clear() //need this!
            :
               drawmap()
               updatesprites()
            :
               drawimageex(g_buffer,{960,540},0,{1,1},white*night_day[2],{0,0})
            :
               drawsprites()
            :
               setdrawtarget(framebuffer)
               drawimage(g_buffer,0,0,dscale)
            :
               update()
            Repeat
            
            1 Reply Last reply Reply Quote 1
            • tdg8934
              tdg8934 @Jongjungbu last edited by

              @Jongjungbu I was able to add in your timer into my game along with all of the items I listed to @xevdev . I had to double the length to account for after midnight going into the next morning as the character in the original Faery Tale Adventure (FTA) game did walk around all night getting very tired and stumbling a little as he walked due to being tired while looking for a building with a bed or mat to get some rest.

              Only one issue is the ultimate system crash after a minute or two. So tired of crashes with Fuze! I hope 2.15 will come out ASAP

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

                You might have a runaway memory leak or array access that Fuze isn't detecting, and so it crashes. I've seen that happen before. It's pretty good about catching invalid array access, but sometimes it will still run despite accessing it out-of-bounds (particularly if it use to be in-bounds), and that may then crash your program.

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

                  Did the crash use to happen before. If it didn't you may have to move your createimage() so they only happen once.

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

                    @xevdev yes crashes have been with me for a while. I spent the day narrowing down the areas / functions causing them but when I think I have it after a couple of successful attempts isolating functions, I get a crash the 3rd time.

                    I think I have it now isolated to both the Character Walk() AND MenuPress() functions. When there commented out in the main loop, I don’t appear to be getting any crashes.

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

                      If it's a minute or two it would mean that you've got some memory allocation in a loop somewhere. It would be an array or a create function. Ideally you could move all those to the start of your program before any code to manipulate them is called.
                      If you have the fps meter enabled it will show you a free memory left counter. If that's going down during your game that's a memory leak. All fuze programs currently if stopped do not release all the memory used in a game and this leads to a crash but this takes quite a few runs to achieve.

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

                        @xevdev

                        ID: Z7573MND51

                        If you or anyone can check it out. Currently I only have the CharacterWalk() commented out in the main loop. It should crash within a minute or two. If you comment out the other function call MenuPress() it shouldn’t crash.

                        Thanks. I am not seeing any memory leaks

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

                          I'll have a look when it becomes live.

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

                            Had a look at your old code.


                            I would have thought that would throw an error.
                            So return void
                            What I can see is you are also using OSx and OSy to push sprites off screen. I don't use sprites but I think they may have updated the sprite control set with removesprite()?.
                            Someone else may know better.

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

                              There is certainly a remove sprite command (always has been) but moving them off screen is also a perfectly valid way of doing things too if you want to do it that way. The reason people typically push sprites off screen when they are not in use is that sprites can have custom properties added to them which is incredibly useful but if you use 'removeSprite()' then there is a bit more work involved in making sure that the sprite still exists before accessing these properties. A simple way round that is to create an empty sprite at the start that you never use (we'll call it nullSprite but it could be called anything). This sprite has no image, no custom properties and never has any of the built in properties set. Then after calling removeSprite(spr) you would assign spr = nullSprite. That way you can ensure that you don't get an error by accessing a property that doesn't exist by checking if it is equal to nullSprite first.

                              An example of what I'm talking about - this isn't necesarily a real world scenario:

                              nullSprite = createSprite()
                              
                              player = createSprite()
                              setSpriteImage(player, image)
                              player.x = 100
                              player.y = 100
                              // Custom properties
                              player.lives = 3
                              player.health = 100
                              
                              // Some time later
                              if player != nullSprite then
                                  player.lives -= 1
                                  if player.lives == 0 then
                                      removeSprite(player)
                                      player = nullSprite
                                  endif
                              endif
                              

                              I've used this for ship firing shots where you have an array of maybe 10 shots and when the player presses fire you rattle through the array looking for the first slot in the array that isn't nullSprite and then create a new player shot, otherwise if all the slots are taken you just ignore the fire button.

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

                                Yes this basically what I do but I don't use sprites I just use struct in an array and the drawimageex () to display them. All the commands for sprites are things you need to really keep track of anyway. So I can't (blame fuze then(in the end it's myself)) see the point of sprites or maps other than you can create these in fuze.

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

                                  but i cant see anything yet that is that problematic in this code (old code) yet. So its interesting in that all of the code I've written never crashes like this.

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

                                    @xevdev

                                    I’m almost sure I have this figured out to be too many c=control(0) statements where there should only be 1 in a loop.

                                    The character selection blue screen uses it along with MenuPress() and CharacterWalk() functions.

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

                                      @tdg8934 hopefully yes. I once tried something like that. In another thread somewhere I'll look.

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

                                        https://fuzearena.com/forum/topic/804/crashing-what-did-i-do
                                        This is it

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

                                          And you should check out saharamins reply at the end I use this and it's awesome.
                                          https://fuzearena.com/forum/topic/645/any-way-to-hide-this-mess-of-initialisation-code/6

                                          tdg8934 1 Reply Last reply Reply Quote 2
                                          • 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
                                            • First post
                                              Last post