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

Pages: [1]
1
Development / Re: Will reflections be possible in 1.6
« on: November 12, 2018, 05:49:50 pm »
Hi Starlock,

Yes it will be possible.  8)

Basically, pretty much any effect that you could do, say on GIMP, will be doable with the shader system.  :D

Greg

2
Development / Re: Has anyone tried compiling Solarus for the web?
« on: November 04, 2018, 09:41:42 am »
Hello AlexGleason,

I looked at emscripten a lot of time and finally choosed to do the android port first.

The difficulty is the fairly high amount of solarus dependencies that need to be met. The second problem is that solarus uses some secondary threads to do some work like music playback and background loading. And emscripten does not support multithreading well... (nor does EScript).

I'm also really looking forward to it but it's not as simple as
Code: [Select]
CXX=emscripten make. But there huge probability that this will be done next year or in few months... When I or another team member finds the time.

Greg

3
Your scripts / Re: [Big Layer] Solarus-online
« on: April 24, 2018, 10:40:16 am »
Wow, I haven't been on here for a while so I've only just seen this...this is amazing! I haven't tested it or anything but it started my imagination going crazy with new types of quest that can be made....new modes and types of gameplay....

can the users interact with eachother? so that you could make something like...zelda bomberman for example? or a battle arena? Not what I intend to use it for, just wondered.

Hi ponderitus,

Yes the users can interact with each other. The library will be cleaned for the release of Solarus 1.6 and proper documentation/tutorials/demo will be made.

No release date is scheduled for 1.6 tough, so stay tuned!

stdgregwar

4
Your scripts / Re: [Big Layer] Solarus-online
« on: January 21, 2018, 02:15:37 am »
Quote
A small remark: LuaJIT is needed because of ffi stuff in Vector.lua. I don't know if you were aware of that but it might be a limitation on some systems. It should be mentioned in the readme if this is normal.

Yes i knew this... and in fact this is not needed... that's a bit silly from me, I took this vector class from another project and forgot that it was LuaJiT only. I will certainly revert it to a plain lua version.

Quote
Anyway… this is a big step for Solarus :D

Glad that you take it this way! ;D

Oh wow so lan multiplayer is now a thing

Not only lan actually, it works quite well across the internet. There is still solutions to be found to smooth the movements when ping increase but this is not a priority.

This is awesomly awesome!!!  ;D

Thanks

What excites me the most is the new ways that it opens in terms of crazy puzzles and quests. Running through dungeons with a squad of 4-8 players, with epic boss fights at the end.

5
Your scripts / [Big Layer] Solarus-online
« on: January 20, 2018, 04:50:20 pm »
Hello everyone!

As I promised to Christopho and others during his live on Monday. I'm unveiling my work of the few past months: Solarus-online.  8)



Demo footage : https://www.youtube.com/watch?v=PTfFjHSJ7Ho&feature=youtu.be

This is basically a set of lua scripts that uses luasocket and a small server to synchronise clients across the network.

Features

  • server
  • fully working 'async' networking
  • asymetric mob simulation
  • symetric map,object simulation
  • movement replication primitives
  • api adaptation for multiplayer aware ennemies
  • network synchronised states and actions

In practice the following engine entities are synchronisable :

  • hero
  • ennemies
  • npcs
  • destructibles
  • maps

But this require light to heavy modifications in the enemy,map,object code!

Code is not bigger, thank to a reconstruction of an api similar to solarus one. But it's different.

Demo

A small demo serve as template on my github:
https://github.com/stdgregwar/solarus-online

You can launch it as any solarus quest, provided that you have 'luasocket' and 'luajson' in your lua5.1 path. and Solarus 1.6 (dev version)

The save selection screen serve as a server selection screen. You can edit data/scripts/serverlist.lua to replace the three default servers.

There is more details in the readme.

Demo server opened h24 for a while

A demo server is open from know on at gregwar.duckdns.org:1337, the server is already in the provided serverlist.

I strongly encourage you to test this on this server. As it is not very demonstrative if there is no other one on screen.

It is also more fun if you use a proper pseudo (not like on the screen  ::) ).

Be aware the server might crash, after all this is an alpha and I never tested all of this with more than two clients, so it's probable that everything breaks. If
this is the case, put a message here or ping me on github.

I might post some video footage in a week or so

Future

If enough people are interested in this I could make a tutorial on how to use it. Or at least develop a nice wiki to explain what it implies in terms of code.

Improvements

There is still plenty to do to really make this usable. The movement replication part is still in a very early stage and suffer when ping is too high.

Please contact me if you want to contribute.

AMA

You can ask me anything about the way this works and what are the limitations. As well as proposing any improvement, ideas.

Conclusion

I don't know if this is really the multiplayer mode that everyone was waiting for. But it's a light solution in terms of engine modification (2 pull-request) and
can be extended to make anything.

6
Development / Re: Custom movement. Way to go?
« on: February 01, 2017, 01:03:07 pm »
Hello Again,

I managed to find that the 'target' movement was perfectly suited for this.

I still have a problem with the animations of the npcs. They don't switch well from 'stopped' to 'walking'.

Here is the full entity script, it is already usable and could easily be modified to create enemy crowds.

Code: [Select]
-- Lua script of custom entity npc_crowd.
-- This script is executed every time a custom entity with this model is created.

--Emulate a crowd of npc following a random path
--Avoiding themselves and the hero

local entity = ...

local Vector = require("scripts/Vector")
local random = math.random

local game = entity:get_game()
local map = entity:get_map()
local hero = map:get_hero()

--physics constants
local dt = 1.0/60
local rep = 9000
local coh = 3
local mrep = 16000
local hrep = 128000

--all npcs of the crowd
local ents = {}

-- Event called when the custom entity is initialized.
function entity:on_created()

  -- Initialize the properties of your custom entity here,
  -- like the sprite, the size, and whether it can traverse other
  -- entities and be traversed by them.

  local sx,sy = entity:get_size()
  --entity count based on custom entity size if not provided
  local n = entity.mob_count or (sx*sy)/64 

  --take default sprites if not given
  local sprites = entity.sprites or {"npc/villager1","npc/villager2","npc/villager3"}

  --set phantom mode to crowd 'core'
  self:set_can_traverse(true)
  self:set_traversable_by(true)
  self:set_size(8,8)

  --params of the generated npcs
  local w, h = 8,8
  local x, y,layer = entity:get_position()
  local sq = math.ceil(math.sqrt(n))

  for i=1,n do
    local ex = x+(i%sq)*w
    local ey = y+(i/sq)*h
    local ent = map:create_npc({
      name = "crowd" .. i,
      layer = layer,
      direction=3,
      subtype=1,
      x = ex,
      y = ey,
      width=w,
      height=h,
      sprite= sprites[random(1,#sprites)],
      model = "extended_npc"
    })
    local pos = Vector(ex,ey)
    local mov = sol.movement.create("target")
    mov:set_target(entity)
    mov:start(ent)
    ents[i] = { --crowd character table
      ent = ent,
      pos = pos,
      speed=Vector(0,0),
      mov = mov,
      f = Vector.new(0,0)
    }
  end

  --set random movement to crowd core
  local mov = sol.movement.create("random_path")
  mov:set_speed(48)
  mov:start(entity)
end



function entity:on_pre_draw()
  local epos = Vector(entity:get_position())
  local hpos = Vector(hero:get_position())

  --compute all forces
  for i,ent in ipairs(ents) do
    ent.f = Vector(0,0)
    --reset position to effective position
    ent.pos = Vector(ent.ent:get_position())
    --compute pairs repulsive forces
    for j,ont in ipairs(ents) do
      local r = ent.pos - ont.pos
      if r:lenSq() > 0.00001 then --if force not huge
        ent.f = ent.f + rep * (1/r:lenSq()) * r:normalized()
      end
    end
    local re = ent.pos - epos
    local rh = ent.pos - hpos
    --cohesive force (to the center of crowd)
    ent.f = ent.f - coh * re
    --repulsion from crowd center
    ent.f = ent.f + mrep * (1/re:lenSq()) * re:normalized()
    --repulsion from the hero
    ent.f = ent.f + hrep * (1/rh:lenSq()) * rh:normalized()
    --speed damping
    ent.f = ent.f - 1*ent.speed
  end

  for i,ent in ipairs(ents) do
    --integrate forces
    ent.speed = ent.speed + dt*ent.f
    ent.speed:truncate(64)
    ent.pos = ent.pos + dt*ent.speed
 
    --update target movement
    ent.mov:set_target(ent.pos:unpack())
    ent.mov:set_speed(ent.speed:len())
  end
end

The simulation could be optimized by updating the pairs forces at a smaller rate with a timer. But this already works for small crowds of like 40 npcs.

Greg

7
Development / Custom movement. Way to go?
« on: January 29, 2017, 09:27:17 pm »
Hello,

I was experimenting with the engine and tried to make NPC "crowds". i.e. Many entities that moves together.

My question here is:

How do I take advantage of the existing collisions detections features while implementing a new kind of movement? Is there a way to do this cleanly?

I didn't see anything about this in the lua API.

What I tried:

  • Setting the positions of the entities manually. But without suprise the NPCs move in walls.
  • Using a path movement where I redefine the path every 200 frames. This works but is not very smoothly.

Here is code from the 'path' movement solution:
Code: [Select]
for i,ent in ipairs(ents) do
    --deduce entity direction from boids force
    local dir = utils.dir_from_xy(ent.f:unpack())
    --check deduced direction
    print(dir)
    --update movement path
    ent.mov:set_path{dir}
  end

Thanks.

Gregwar

Pages: [1]