Menu

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.

Show posts Menu

Messages - Manuel345

#1
Development / Re: LuaSocket
August 28, 2016, 06:35:58 AM
I'll stick with my original idea and compile a custom version of the engine. That way it's guaranteed to work my way.

What would be an appropriate way to comply with the license? Would zipping the modified source and including it with the release be acceptable?
#2
Development / Re: LuaSocket
August 27, 2016, 01:39:17 PM
Thing is... LuaSocket requires a C++ back-end. I can't just add it to the scripts and require it... (I tried :P)
#3
Development / LuaSocket
August 27, 2016, 07:10:09 AM
I tried requiring "socket" but the editor just shouts an error saying socket isn't defined.

It's a shame because I was planning on making my game multiplayer.
It doesn't stop there, I won't be able to use any web functionality like leader-boards.

Since Solarus is open-source, I'd like to compile a version with LuaSocket included so that I would be able to do everything I wanted. However, I'm wondering how to do so...


If you could include it in a future build, it would be really appreciated as it it a must-have for any Lua interpreter.

http://w3.impa.br/~diego/software/luasocket/home.html
#4
Bugs & Feature requests / Re: Line of sight
August 23, 2016, 11:52:14 AM
Awesome, thanks a lot, I'll do a loop iterating through all positions from the enemy to the hero using test_obstacle!

Here's a mockup:


function line_of_sight(entity)
  local hasLOS = true
  local heroDistance = entity:get_distance(hero)
  local heroAngle = entity:get_angle(hero)

  for i=0, heroDistance do
    local dx, dy = math.cos(heroAngle)*i, -math.sin(heroAngle)*i
    if entity:test_obstacles(dx, dy) then
      hasLOS = false
      break
    end
  end

  return hasLOS
end


Edit It works, thank you so much!!! Also had to invert the Y for some reason, I guess Lua does its math in Cartesian coordinates (negative y towards the bottom)...

Included is the final script for anyone interested.
#5
Bugs & Feature requests / Re: Line of sight
August 23, 2016, 11:29:18 AM
Okay, thank you.

I'll try the invisible entity again, can't hurt to try a different approach.

One problem I had the first time is that the entity would sometimes pass through walls...
But the biggest problem is that I can't test for it on each update because the movement needs to move the entity...
#6
Bugs & Feature requests / Line of sight
August 23, 2016, 10:45:00 AM
I am trying to get a line-of-sight working for enemies to detect the hero.

I tried using an invisible custom entity going in a strait line towards the hero and stopping at any wall or impassable surface.
This unfortunately didn't go as planned.

I'm wondering if it would be possible to add a line-of-sight function, probably in sol.main alongside get_distance or maybe directly as a map entity method.


Here's a mockup of how I would use it:


function enemy:on_update()
  if self:get_line_of_sight(hero) then
    self.hasLOS = true
  else
    self.hasLOS = false
  end
end