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.


Messages - Max

Pages: [1] 2 3 ... 12
1
General discussion / Re: Need Help With Enemy Scripting
« on: October 30, 2018, 01:10:46 am »
I've made a spike trap enemy, and just heads up, it's surprisingly difficult. My method was to make it so they would go in any of the 4 directions if the hero's x/y lined up with theirs +/- 16px.

I think having the enemy check on_update() might be overkill. I usually run check_hero methods every 100ms or more, which have never been a noticeable delay. Idk what Solarus' framerate is, but having a timer run a checking method every 100ms is at last half the processing, if not less.

What that might look like is this:
function Enemy:check_hero()
--some code that gets the hero's coordinates and maybe calls another function if the hero is close or lined up
so.timer.start(enemy, 100, enemy:check_hero())
end

Basically, after the timer, it calls the function, which after the timer calls the function, which after the timer calls the function, which after the timer........

Christopho or someone might know better than me, but I don't think movement:on_finished() is called for interrupted movements. I would, just in case something weird happens, set a call back function for when the movement completes, as well as defining an on_obstacle_reached event.

One thing that, until 1.6 comes out, you could do is use the enemy's initial facing direction as a property to set which direction it's capable of going, but if you're totally new to coding, I'd recommend working on some different enemies first.

2
Your projects / Re: Some Maps I've been working on...
« on: October 28, 2018, 03:28:06 am »
Welcome : )
I really like the village you've got at the top, it seems nicely laid out and uses various heights in an interesting way. I appreciate how everything is sectioned and compartmentalized, but also looks easy to navigate.

Some of the other ones share a trait of having long, open borders. It's usually better to have smaller "doors" between areas, but keep it up? Are you planning on making a game?

3
Development / Re: Solarus could use a UI framework
« on: October 27, 2018, 06:11:33 pm »
That's really gracious of you! I sent you a PM, and I'm planning on looking through your library later this weekend to learn as much as I can : )

4
Development / Re: Solarus could use a UI framework
« on: October 27, 2018, 05:10:37 am »
I'm amazing at everything and I'm currently in the process of solving everyone's problems.

Dude, this is great to hear. Menus are so hard, hahaha. Myself and @Vathox are trying to get an actual menu together to keep track of sidequests in Ocean's Heart (all my test players are like, I cannot keep track of all this, you need a sidequest log immediately.), and having a really tough time trying to figure it out. I haven't even really gotten a good grasp of the logic behind how you'd do something like that, so it's good to hear someone else is in favor of a little more support for developers in this area : )

But like, how much would you recommend against not using your old libraries? Is it like an "I wouldn't drive without insurance" recommendation, or an "I wouldn't jump off a cliff" kind of recommendation? Haha.

5
Your scripts / Enemy that runs away from you
« on: October 24, 2018, 02:02:18 am »
I don't know if this'd be handy for anyone else, but I'd been messing with getting an enemy that runs away from you to be fun, and I think I've finally got it.

This enemy will wader randomly until you get within its detection_distance, then it'll run in the opposite direction of the player. When it hits a wall, it will dash in a random direction for its dash_distance, then go back to running from the player.

I think it's pretty fun to chase, the random dashing when it hits a wall makes it pretty unpredictable and it a pretty good compromise to keep it from getting stuck in corners. There's also an element of danger to trying to corner it, because it very well might just dash through you and damage you. In my testing, it works best and a kind of joke-ier enemy that doesn't do much damage, because whenever it bumps into a wall it careens wildly and is going to smack into the player at some point.

Also, here's a gif of the behavior. It's more fun that it might look, haha:


Code: Lua
  1. local enemy = ...
  2. local game = enemy:get_game()
  3. local map = enemy:get_map()
  4. local hero = map:get_hero()
  5. local sprite
  6. local movement
  7. local dashing
  8. --adjustable stats
  9. local hp = 30
  10. local damage = 1
  11. local detection_distance = 65
  12. local walking_speed = 45
  13. local running_speed = 82
  14. local dash_distance = 80
  15. local dash_speed = 140
  16.  
  17.  
  18. function enemy:on_created()
  19.   sprite = enemy:create_sprite("enemies/" .. enemy:get_breed())
  20.   enemy:set_life(hp)
  21.   enemy:set_damage(damage)
  22. end
  23.  
  24. function enemy:on_movement_changed(movement)
  25.   local direction4 = movement:get_direction4()
  26.   sprite = self:get_sprite()
  27.   sprite:set_direction(direction4)
  28. end
  29.  
  30. function enemy:on_restarted()
  31.   if moement ~= nil then movement:stop() end
  32.   dashing = false
  33.   enemy:go_random()
  34.   enemy:check_hero()
  35. end
  36.  
  37. function enemy:check_hero()
  38.   local dist_hero = enemy:get_distance(hero)
  39.   local _,_,hero_layer = hero:get_position()
  40.   local _,_,enemy_layer = enemy:get_position()
  41.   if enemy_layer == hero_layer and dist_hero < detection_distance and not dashing then
  42.     enemy:run_away()
  43.   elseif not dashing then
  44.     enemy:go_random()
  45.   end
  46.  
  47.   sol.timer.start(enemy, 100, function() enemy:check_hero() end)
  48.  
  49. end
  50.  
  51. function enemy:run_away()
  52.   local angle = enemy:get_angle(hero)
  53.   angle = angle + math.pi
  54.   movement = sol.movement.create("straight")
  55.   movement:set_angle(angle)
  56.   movement:set_speed(running_speed)
  57.   movement:start(enemy)  
  58. end
  59.  
  60. function enemy:go_random()
  61.   movement = sol.movement.create("random_path")
  62.   movement:set_speed(walking_speed)
  63.   movement:start(enemy)
  64. end
  65.  
  66. function enemy:on_obstacle_reached()
  67.   enemy:dash()
  68. end
  69.  
  70. function enemy:dash()
  71.   dashing = true
  72.   movement = sol.movement.create("straight")
  73.   movement:set_angle(math.random(2*math.pi))
  74.   movement:set_speed(dash_speed)
  75.   movement:set_max_distance(dash_distance)
  76.   movement:start(enemy, function()
  77.     dashing = false
  78.     enemy:go_random()
  79.   end)
  80. end
  81.  
  82.  
  83.  

6
Development / Re: Stopping a sound effect
« on: October 22, 2018, 03:06:35 am »
Not sure if this is feasible, but the reason a vacuum sound sounds higher or lower is the speed of the rotation. Idk if it'd work, but if you decreased the time between each vacuum sample being played, the pitch would raise. But we're talking playing this sample every 1-3ms, which might likely break something. But it's worth a shot because you could increase the frequency of the sound kind of realistically. Maybe.

7
Your projects / Re: Ocean's Heart
« on: October 20, 2018, 06:35:07 pm »
Haha, post away. And yeah, I figured you weren't against selling anything.

So, to ask you the cliche "would you still be vegan even on a desert island" type question, what about the idea of someone taking your unprotected work and as a whole game, or a loosely reskinned one, and going and selling it? Maybe it's unlikely, but that is what copywrite protection is designed to prevent, and it does happen.

8
Development / Re: Multi-events as the default?
« on: October 18, 2018, 03:55:00 am »
I don't think the idea of a built-in multi-events script is bad- for a case where I can't think of a way to do it with an item, I wrote a script for saving the player's respawn location whenever a map is changed to make the game more forgiving. I have done the work you're dreading, of having the manually go in and delete or change every map's default events to keep them from overriding my functionality, and it is a pain.

For some reason, I've been assuming Solarus 1.6 is going to automatically include the multi-events script built in? I don't know if I have a reason for thinking that or if I'm mistaken, maybe someone working on it would know better, haha.

The only thing I can think of why the current system is better, is that you've got a kind of override of whatever you've defined in your metatable. For example, if you define some behaviour for every enemy in enemy:register_event(on_dead, function() ), and you want to override this for just some frog enemy, you can just define enemy:on_dead for the frog, and it'll override. If you built-in support for multi-events, I don't know if you'd have that override. But I suppose if you were building in support for multi-events, you could also just build in an override functionality?

If I'm mistaken about the changes in 1.6, you guys should consider at least not automatically defining events on map scripts. I found it very helpful for the first month of development, then annoying for the next two years, haha : )

9
Your projects / Re: Ocean's Heart
« on: October 18, 2018, 03:31:33 am »
Hahahaha, orange peel attached. CC-0.


I really like the way you think, Alex : )
I think the stance I've been taking in my head- that it's possible my game would do so well that the value of my assets would be considerable- is less optimistic, and honestly more egotistical. So thanks for bringing it up, because that attitude, even when not consciously embraced, hurts the potential value of what I create as a shared resource, so I'd like to let it go. Maybe the individualistic mindset of valuing one's own creations as personal brand assets above the value they have as a shared resource is probably symptomatic of undervaluing our community, and that's a shitty thing to realize about myself. But realizing it is necessary to addressing it! And will help me be more compassionate toward my community going forward.

Anyway, I've definitely gotten a wonderful dose of having to reassess my preconceptions from talking about you, so just know I appreciate that- and we agree about almost everything, but I enjoy talking to you, so I'm going to keep engaging on a couple points.

Quote from: alexgleason
The rooster statue is a meme. I don't think reusing it is uncreative, it's just a cultural reference.

The reason I think much of this kind of asset reusage is influenced more by asset availability than the real depths of creativity that amateur devs could be drawing on, is based on personal experience. When using some [stolen nintendo] assets, I've had the experience of being like, I've got all these tomb stones, I should make a graveyard, rather than coming up with some other area that might be more creative or fit my game better. Or even if I needed a graveyard, creating tombstones that reflected the culture of the fiction I've created. If I've got a statue of a rooster, maybe I should make this village have some special connection to roosters, rather than something more supportive of the story I'm trying to tell.

To take it more into an abstract discussion than one particularly about nintendo assets, I've found myself multiple times when creating a fictional world, devising some kind of forest of giant mushrooms. It's a cool idea, but isn't particularly creative- it's been done many times before. Were it not for the cultural abundance of giant mushrooms, would I have thought of some hitherto unexplored botanical fantasy? Maybe.

I guess, while I take your point and am inclining toward releasing all my graphics, I still think about the potential negative impacts of releasing assets designed around a specific scenario and setting. To be sure, it's a very minor point. The benefits of allowing someone who otherwise wouldn't be able to create for lack of assets, or wouldn't have time to develop other systems for hours poured into asset creation, or whose strength is in other fields, or who would be illegally stealing others' assets without free options, or any number of other things- the benefits to these people greatly outweigh the potential negative effects on creativity. And I'm not a teacher, trying to nourish and refine some creativity muscle. So I don't know where this thought fits in, but I think I've seen the effects of relying on cultural references stunt my creative growth in at least some small measure.

Quote from: alexgleason
These people are ignoring copyright anyway, so they have the whole world in their hands in terms of assets they could use.
Just a small point, with the wealth of artistic styles in video games, this isn't always feasible if you want your game to have a cohesive aesthetic. Added to that, I've seen a lot of sentiment in fan game communities that a consistent aesthetic is paramount, and if "your perspective isn't quite right" or you've got a couple assets with a different shading or outlining style, you need to learn all about pixel art to fix them or else you've made the wrong choice. Specifically in Zelda fangames, I've seen weirdly negative comments about mixing graphics from like, Link to the Past and Minish Cap. God forbid adding in something from Link's Awakening or you're a fashion criminal, lol. This further pushes amateur developers toward using the specific settings and scenarios provided for by their game's assets. Like I mentioned before, this isn't honestly a real big problem or worth keeping assets out of developers hands for, I just think about it.

Anyway, thanks for having a real discussion on the internet! You've actually changed my mind on a lot of things.

EDIT:
After eating some dinner and upping my blood sugar levels, I'm reconsidering this scenario: I'm a huge success. There's dozens of indie games using my assets. A full half of them have weird sidequest about finding a stolen orange with just the peel as a clue, or a specific NPC that only eats oranges. After some thought... this alternate timeline has almost no measurable downsides. The people of the alternate future have you to thank, Alex.




Side-note: I usually try to write my posts in fairly simple english, because I know there are a lot of non-native english speakers on this site. This one got a little complex, I'm sorry. But I really appreciate everyone who puts in the effort to speak a language other than your own! I know how difficult that is, and I really really appreciate that I can understand and participate in this community, even though I only speak one language fluently : )

10
Your projects / Re: Ocean's Heart
« on: October 17, 2018, 01:03:28 am »
Valid points, both of you! And yes Diarandor, thanks for point out my mistake. What I mean is I'm planning on freely licensing many of the graphics after release via CC-BY or whatever, but keeping a few out of public use.

Alex, I suppose I haven't given it as much thought as I ought to, so I appreciate you engaging me on it! : )

To clarify, I haven't been like, sorting assets into piles of "share" or "don't", but if I had been, the "don't" pile is fairly small. Basically just like, my game's main characters. My plan so far has been once I release, to create a kind of general assets pack. Tilesets of mountains and trees and cities and stuff are pretty useful to everyone. I might not include like, the graphic I recently made of a pile of orange peels, which is almost uselessly specific.

But, as far as keeping graphics private until after I release, I stand by that practice- with the small exception that I already did make most of the tiles I made during my first year of development available on this site already :p
But, it's kind of possible (although probably unlikely) that someone might use my graphics, beat me to release, and I'd be seen as a copycat, which would be hilariously frustrating. But you've got a great point, that there's very little to be lost after I've established whatever brand identity I might by CC-BY'ing the assets, and plenty to be gained. You're making me rethink a lot of this, which I love!


I guess I have two counter-counter arguments. Neither of them are good.

If I'm thinking about re-using assets in future games, and assuming the best case scenario where I release graphics freely and a whole damn genre sprouts out around them, my next game might get lost? Haha, that's probably a bit unlikely.

But part two, I feel like many developers who want to use an assets pack are likely newer developers, and while a large set of common assets can be great so they can focus on something other than asset creation, it has the potential to counter-intuitively limit creativity, kinda? So, say I hand someone a box of legos, and inside there's a ton of bricks specifically from Star Wars sets. Lightsabers and spaceship engines and cockpits and stuff- they're probably going to build a spaceship, because that's the best use of that particular box of legos, honestly, you'd be wasting the special space parts otherwise. But on the other hand, say I give them a smaller box of more general bricks. They might create anything!

I think that when a set of resources meant to encourage creativity contains many hyper-specific instances, it instead encourages one to design around those resources and in a way, stifles creativity. As a small point, look how many Zelda fan games include a rooster statue in their village's central square, just because it's a nice looking asset to take from Link to the Past. Or on a bigger scale, have an ice-themed area instead of a rainforest-themed area, just because that's the assets they have. If I want to encourage creativity, I don't think all my assets would benefit those who would use them. Again to the graphic of a pile or orange peels I mentioned earlier, if someone received that in their game-makin'-resource-pack, they'd at least think, "how can I use a pile of orange peels in my game", instead of "how can I make the best game".

So, obviously,  my logic isn't foolproof, but that's at least part of my rationale behind keeping a few assets out of any resource I create and share freely. I still am rethinking some things in light of your arguments though, and will probably release more than I had initially planned, but I'm interested to hear more of your thoughts on how to best leverage your game's resources for everyone's benefit.

11
Your projects / Re: Ocean's Heart
« on: October 16, 2018, 04:55:01 am »
Thanks! I'm not planning on licensing all the graphics, but I am going to release quite a few after I release the game.

The code though I'm definitely all about sharing : )
My reasoning is I'd like to be able to maintain some identity for my game visually that's unique and marketable, but I definitely want to make creating games easy for others because they're fun to play! If you're interested in any of my code let me know and I'll share it.

12
I've actually been planning on trying to figure out how to force the sword to complete its animation before the next attack, so your downside is my upside, haha. I think it can make an attack feel much weightier, and forces strategy if you lock the player into the animation.

13
Development / Re: Wait, I don't understand how "require" works
« on: October 08, 2018, 02:52:49 am »
Awesome, great advice from the both of you : )
I hadn't quite picked up on that subtlty, llamazing, and I can easily imagine myself trying to clean things up by exporting duplicate code to scripts and then being lost when it didn't work as expected. Thanks!

14
Development / Re: Wait, I don't understand how "require" works
« on: October 07, 2018, 08:49:37 pm »
I think I understand it all now! The require command will just run the script, which might return a table, if you tell it to. In this case, you should write the script to return a table. Got it! I messed around with this for a long time before I realized I wasn't returning the table, hahaha. All working now!

Thanks, llamazing!

15
Development / Wait, I don't understand how "require" works
« on: October 04, 2018, 04:10:21 am »
So, I've got a few towns in my games and I hate copying/pasting the blacksmiths' and shopkeepers' code from one place to another, because they all function the same. I think this is a situation I can make a script which all will use, but I'm not sure how the syntax for this works. Does the "require" syntax (is this an operator?) return... anything? I'm not quite sure how to use require properly.

But anyway, here's my (third) attempt:

In a town's map:
Code: Lua
  1. function blacksmith:on_interaction()
  2.   local shop = require("scripts/shops/blacksmith")
  3.   shop:blacksmith()
  4. end
  5.  

The blacksmith() function in the script is pretty simple and tested, just dialogues and choices which will take money and increase attack power, basically, but here is it anyway. I don't think this is where the problem is.
Code: Lua
  1. function blacksmith()
  2.  
  3.  game:start_dialog("_yarrowmouth.npcs.blacksmith", function(answer)
  4.     --sword
  5.     if answer == 2 then
  6.       --have required items
  7.       if game:has_item("sword") == true and game:get_item("coral_ore"):get_amount() >= 1 and game:get_money() >= 50 then
  8.         game:set_value("sword_damage", game:get_value("sword_damage") + 1)
  9.         game:remove_money(50)
  10.         game:get_item("coral_ore"):remove_amount(1)
  11.         game:start_dialog("_goatshead.npcs.palladio.sword_improved")
  12.       else --don't have required items
  13.         game:start_dialog("_game.insufficient_items")
  14.       end
  15.  
  16.     --bow
  17.     elseif answer == 3 then
  18.       --have required items
  19.       if game:has_item("bow") == true and game:get_item("coral_ore"):get_amount() >= 1 and game:get_money() >= 50 then
  20.         game:set_value("bow_damage", game:get_value("bow_damage") + 1)
  21.         game:remove_money(50)
  22.         game:get_item("coral_ore"):remove_amount(1)
  23.         game:start_dialog("_goatshead.npcs.palladio.bow_improved")
  24.       else --don't have required items
  25.         game:start_dialog("_game.insufficient_items")
  26.       end
  27.  
  28.     end -- which answer end
  29.  
  30.   end) --dialog end
  31.  
  32. end
  33.  

Pages: [1] 2 3 ... 12