Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - wrightmat

Pages: [1] 2 3
1
Development / Hero sprite error new to 1.6?
« on: January 09, 2019, 04:13:11 am »
I discovered something in my game today that wasn't in 1.5, so I think it may be a bug introduced in 1.6. I may a couple of maps in my game where there are a number of dynamic entities of water tiles that I disable at one point in the game (basically you drain an entire lake, and this is how it's accomplished). Now with 1.6, when I move from the top map to the bottom map, the "splashing" animation shows for a short time immediately after the transition, and then returns to the normal "walking" animation. This didn't happen in 1.5 - the transition was seamless and the player wouldn't suspect there was ever water there. Oddly enough, the same thing does not happen when moving from the bottom map to the top map, so maybe it only occurs when the hero is facing down?

2
Development / NPC routines
« on: December 06, 2017, 04:41:41 am »
Hey all,

I've been thinking recently about how to create more interesting NPC routines in Lua without it being too complicated. Right now I'm on the idea of passing routines as a table from the NPC script to another scripts that parses it and stores it to be executed on the regular. I'm a little fuzzy on the details though, so I thought I'd throw my thoughts here!

Code: (lua) [Select]
local routine = { [08]="to_shop", [10]="to_house", [13]="to_mill" }
function entity:on_created()
  self:set_routine(self, routine)
end
Here is where I thought about encoding the routine as a nested table - with time (hours) in brackets and waypoint entity in quotes. Then I can parse that table out to get the individual parts of the routine.

Code: (lua) [Select]
  for k,v in pairs(routine) do
    game:add_routine(k, npc:get_name(), v)
  end

I think my next step would be to create a new table, or several tables, organized by hour so the game easily parse the correct table at the correct time (the add_routine routine I'm playing around with up there). If this table contains the entity name and waypoint entity name, then the movement should be able to be created pretty easily.

My main issue right now is the structure/format of the routine tables organized by time. I'm not an expert on Lua tables and I'm not sure how to make this without a bunch of if/then statements which would be best to avoid.

Anyway, I'd love to hear thoughts on the idea, and especially the execution thereof!

3
General discussion / PC Gamer article
« on: September 18, 2017, 07:49:53 pm »
PC Gamer did an awesome little article on our own Christopho and his excellent engine, Solarus! If you haven't seen it, I highly recommend the read!  :D

http://www.pcgamer.com/zeldas-most-dedicated-fan-game-developers-built-an-engine-anyone-can-use/

Great to see good work recognized, and we all know that Christopho has done some great work with Solarus!

4
Bugs & Feature requests / "normal" video mode is at 2x
« on: June 02, 2017, 04:31:33 am »
It appears, and the API confirms, that the "normal" video mode actually stretches the image by a factor of 2. Is it possible to just have the game run un-stretched? If there's not currently, I really think this should be added as a feature soon. Currently it would be pretty much impossible to use higher resolution resources when making games.

5
Development / Enemies not piling up
« on: May 26, 2017, 02:36:48 am »
In my game my enemies have a bad habit of "piling up" on each other, which makes it much easier to kill several of them with one hit. I was trying to avoid this with the code below, but I've now traced the code to some random crashes I've been having, so I need to take it out. I'd still like to find a way to not have the enemies pile up, and my guess is this was a stupid way in the first place and there's some obvious answer I've missed. So, my hope is the community can save me from my own stupidity again :)

 
Code: ("lua") [Select]
function enemy:on_collision_enemy(other_enemy, other_sprite, my_sprite)
  if enemy:is_traversable() then
    enemy:set_traversable(false)
    sol.timer.start(200, function() enemy:set_traversable(true) end)
  end
end

6
Bugs & Feature requests / text surface fade_in and fade_out?
« on: April 07, 2017, 03:53:55 pm »
When I create a text surface, I can draw it near a custom entity by using draw_visual from on_post_draw, but when I try to apply a fade_in or fade_out to that surface (which the api says is general to all drawables) it doesn't seem to do anything. Is this a bug? Has anyone else tried this and succeeded?

7
Development / Equipment items as a class
« on: October 13, 2016, 03:08:59 pm »
I've been thinking about equipment items and if it would be possible to extend them to work more like a class in an RPG, so you could give custom stats and such to items. The ultimate extension would be to allow for a sort of crafting system where you could customize the item and it would be saved with the custom stats and sprite.

My thought is this should be possible by creating an item script for each type of item, say a sword or dagger or axe, then using variants to cover the different sprites. Then I'm wondering if it's possible to create a function in the item script that's called after item_create that passes and sets the stats and saves the item. The condition I see is that you'd still only be able to have one type of each item, or at least one variant, right?

Any other interesting ideas anyone has about extending the built in items? Or is this something that's better handled by ditching the built in items and using custom entities?

8
Development / Is there a way to tell when the map is scrolling?
« on: October 05, 2016, 03:25:21 pm »
I'd like a script to detect when the map is undergoing a scrolling transition - is that possible? This may be related to Solarus issue #989 (https://github.com/solarus-games/solarus/issues/989), but my screen overlay for map tone scrolls with the map when the hero hits the teletransporter. This is not the desired behavior since all of the lights that I've drawn on the surface move when they should stay stationary. My contingency plan is to disable drawing of those lights at the moment of screen scrolling, but I can't figure out if that's possible.

9
Bugs & Feature requests / Video/hardware acceleration
« on: August 22, 2016, 02:18:24 pm »
Is there a way from code or settings to disable video/hardware acceleration by default? It looks like you can do it from the launcher, but I'd like to not give the option and just disable it for my game by default if possible. Thanks!

10
Development / Failed to create software surface
« on: July 31, 2016, 01:52:18 am »
I'm using a modified version of Satoh's code that was posted at http://forum.solarus-games.org/index.php/topic,676.15.html to make the day/night system I had work with the new blend modes introduced in 1.5. It uses the map metatable to force a night overlay to drawn on all maps when it's night time. The problem is that after 10 to 15 minutes of game play at night (an overlay with blend modes being drawn) my game crashes with the fatal error "Failed to create software surface". I'm assuming that my code is just inefficient and the repeated re-drawing is causing memory issues, but I'm not sure how to improve it. Hopefully someone here will have an idea that can help me improve me code! And thanks for looking!

Code: ("lua") [Select]
  function map_metatable:on_draw(dst_surface)
    local game = self:get_game()
    local hour_of_day = (time_counter / 3000)
    -- Put the night (or sunrise or sunset) overlay on any outdoor map if it's night time.
    if (hour_of_day >= 19.6 or hour_of_day <= 7.4) and
    (game:is_in_outside_world() or (self:get_world() == "dungeon_2" and self:get_id() == "20") or
  (self:get_world() == "dungeon_2" and self:get_id() == "21") or (self:get_world() == "dungeon_2" and self:get_id() == "22")) then
      local x,y = game:get_map():get_camera():get_position()
      local w,h = game:get_map():get_camera():get_size()
     
      if draw_counter >= 15 then
        shadow:clear()
        if hour_of_day >= 19.6 and hour_of_day < 20 then
          t[1] = 255; t[2] = 255; t[3] = 255
          -- Dusk
          if t[1] >= 2 then
            t[1] = t[1] - 2 -- Red: Goal is 0 (fade to black, which is the same as fading in for this blend mode)
          else
            game:set_value("time_of_day", "night")
            game:set_value("hour_of_day", 20)
          end
          if t[2] >= 3 then
            t[2] = t[2] - 3 -- Green: Goal is 0
          else
            game:set_value("time_of_day", "night")
            game:set_value("hour_of_day", 20)
          end
          if t[3] >= 4 then
            t[3] = t[3] - 4 -- Blue: Goal is 0
          else
            game:set_value("time_of_day", "night")
            game:set_value("hour_of_day", 20)
          end
          shadow:fill_color(t)
        elseif hour_of_day >= 20 and hour_of_day <= 21 then
          -- Sunset
          if t[1] >= 32 then t[1] = t[1] - 3 end -- Red: Goal is 32 (from 255)
          if t[2] >= 64 then t[2] = t[2] - 2 end -- Green: Goal is 64 (from 255)
          if t[3] >= 128 then t[3] = t[3] - 1 end  -- Blue: Goal is 128 (from 255)
          shadow:fill_color(t)
        elseif hour_of_day >= 6 and hour_of_day <= 7 then
          -- Sunrise
          t[1] = (182*(hour_of_day-6))+18 -- Red: Goal is 182 (from 32)
          t[2] = (62*(hour_of_day-6))+66 -- Green: Goal is 126 (from 64)
          t[3] = (37*(1-(hour_of_day-6)))+87 -- Blue: Goal is 91 (from 128)
          shadow:fill_color(t)
        elseif hour_of_day > 7 and hour_of_day <= 7.4 then
          -- Dawn
          if t[1] <= 253 then
            t[1] = t[1] + 2 -- Red: Goal is 255 (fade to white, which is the same as fading out for this blend mode)
          else
            game:set_value("time_of_day", "day")
            game:set_value("hour_of_day", 7.5)
          end
          if t[2] <= 252 then
            t[2] = t[2] + 3 -- Green: Goal is 255
          else
            game:set_value("time_of_day", "day")
            game:set_value("hour_of_day", 7.5)
          end
          if t[3] <= 251 then
            t[3] = t[3] + 4 -- Blue: Goal is 255
          else
            game:set_value("time_of_day", "day")
            game:set_value("hour_of_day", 7.5)
          end
          shadow:fill_color(t)
        else
          -- Night
          shadow:fill_color({32,64,128,255})
          game:set_value("time_of_day", "night")
        end
       
        lights:clear()
        for e in game:get_map():get_entities("torch_") do
          if e:get_sprite():get_animation() == "lit" and e:get_distance(game:get_hero()) <= 250 then
            local xx,yy = e:get_position()
            local sp = sol.sprite.create("entities/torch_light")
            sp:set_blend_mode("blend")
            sp:draw(lights, xx-32, yy-32)
         end
        end
        for e in game:get_map():get_entities("night_") do
          if e:is_enabled() and e:get_distance(game:get_hero()) <= 250 then
            local xx,yy = e:get_position()
            local sp = sol.sprite.create("entities/torch_light")
            sp:set_blend_mode("blend")
            sp:draw(lights, xx-24, yy-24)
          end
        end
        for e in game:get_map():get_entities("lava_") do
          if e:is_enabled() and e:get_distance(game:get_hero()) <= 250 then
            local xx,yy = e:get_position()
            local sp = sol.sprite.create("entities/torch_light_tile")
            sp:set_blend_mode("blend")
            sp:draw(lights, xx-8, yy-8)
          end
        end
        for e in game:get_map():get_entities("warp_") do
          if e:is_enabled() and e:get_distance(game:get_hero()) <= 200 then
            local xx,yy = e:get_position()
            local sp = sol.sprite.create("entities/torch_light_tile")
            sp:set_blend_mode("blend")
            sp:draw(lights, xx-16, yy-16)
          end
        end
        for e in game:get_map():get_entities("poe") do
          if e:is_enabled() and e:get_distance(game:get_hero()) <= 200 then
            local xx,yy = e:get_position()
            local sp = sol.sprite.create("entities/torch_light")
            sp:set_blend_mode("blend")
            sp:draw(lights, xx-32, yy-32)
          end
        end
        -- Slowly drain magic when using lantern.
        if magic_counter >= 50 then
          game:remove_magic(1)
          magic_counter = 0
        end
        if not game:is_suspended() then magic_counter = magic_counter + 1 end
        draw_counter = 0
      end
      draw_counter = draw_counter + 1

      if game:has_item("lamp") and game:get_magic() > 0 then
        local xx, yy = game:get_map():get_entity("hero"):get_position()
        local sp = sol.sprite.create("entities/torch_light_hero")
        sp:set_blend_mode("blend")
        sp:draw(lights, xx-64, yy-68)
      end

      lights:draw_region(x,y,w,h,shadow,x,y)
      shadow:draw_region(x,y,w,h,dst_surface)
    end
  end

11
Bugs & Feature requests / Universal Windows App
« on: June 26, 2016, 08:40:46 pm »
I'm wondering if it would be possible in a future release (1.6?) to enable the Solarus engine as a Universal Windows App (UWA), which should allow games to be run on XBox One as well as Windows 10. It looks like it would require SDL version 2.0.4 (not sure what Solarus is using currently) and development in Visual Studio 2015. I just think it would be really cool to be able to play our games on XBox!

https://msdn.microsoft.com/en-us/library/hh875012.aspx

12
Development / Hole into teletransporter
« on: June 17, 2016, 04:42:16 pm »
In the past, I was able to place a teletransporter over a hole so that when the hero fell into the hole, he was transported to a new map. This no longer appears to work in 1.5dev - was this intentional? Is it possible to get the old behavior back?

Also Christopho, I was wondering if there was any estimate on the release of 1.5? I wanted to release the full version of my game soon, but wanted it to run on Solarus 1.5

Thanks!

13
Bugs & Feature requests / Flying enemies and walls
« on: April 14, 2016, 02:48:15 pm »
I have enemies where I've set enemy:set_obstacle_behavior("flying") and enemy:set_layer_independent_collisions(true) that are traversing walls that are set to block enemies - is this the expected behavior? Is there a way I can change this if it is?

14
I get multiple "libpng warning: iCCP: known incorrect sRGB profile" errors when displaying a menu. I'm guessing this is related to my pause_submenus.png file, but the error does not specify. I also haven't been able to manipulate the image to eliminate the error - I use gimp, and have searched the internet for solutions to no avail. Anyone have any insight into this?

In a future version, can the engine at least specify the file that's throwing the error?

15
Development / Expanding item_1 and item_2 commands
« on: February 09, 2016, 01:41:48 am »
I'm thinking it should be possible, probably using metatables, to expand the item_1 and item_2 commands and include item_3 and even item_4, for when more items are needed. But I'm wondering, does modifying the metatable of existing functions expand them or overwrite them? For example, would the code below work? If not, I could create a custom function similar to each of the built-in ones for each of the item slot functions.

Code: (lua) [Select]
local game_metatable = sol.main.get_metatable("game")
function game_metatable:get_item_assigned(slot)
  if slot == 2 then
    return game:get_value("slot_2_item")
  elseif slot == 3 then
    return game:get_value("slot_3_item")
  end
end

I'm also not 100% sure how the button mapping part would work. Is game:get/set_command_keyboard_binding() expandable or configurable?

Just brainstorming and wanted others' thoughts...

Pages: [1] 2 3