Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Thanks so it's not in yet, I was kinda hoping it was. I just like to play a small galaxy game with a few factions and create an empire from scratch
  2. Is it possible yet to change the size ?
  3. I've learned that you can only do these kind of things on scripts attached to objects that exist client and server side at the same time with the same unique id. You can't just instance a class and expect it to be able to do this kind of communication. For future reference
  4. Hey, I want to create a script that when "a player" enters a sector he finds a ship waiting there to be killed, so he can get a reward. What I do NOT want is attach a script with callback to the Player() object. Logically I would attach it to When a player enters and it is for the first time, the ship to destroy gets created. Sound and simple design ... HOWEVER since sectors aren't all generated before hand. I need a way, when the mission gets created the sector gets loaded, the script attached to it and then the sector can be unloaded whatever ... I just want my script attached to it. In pseudo code that would become Mission mission = createMission("DestroyShip") Sector sector = mission.findSectorToKillShip() sector.attachScriptToLoadShipSpawner() - So first my logic to create a mission saving the data somewhere - Then finding an empty sector somewhere AND loading it into a variable - Attach my callback script to the sector that when "a player" enters no matter who, the ship to destroy gets spawned I've been browsing SectorSpecifics, the sectors folder and other scripts and usually Sector() is used but this implies probably the sector the player is in and that's not what I'm aiming for, that target could be in a sector nobody has ever visited
  5. You are not wrong, however, looking through the lua scripts code the game seems very tight coupled to them. Avorion is a great sandbox, with the right mechanics, where we could basically build any kind of gameplay in. So decouple all scripts that have to deal with the story from required to optional and moreover configurable and we come into all new terrain. Suppose you got the following directory setup Avorion Data Mods Official The official directory holds all the scripts and mechanics to play the current story in Avorion. However when I delete the Mods folder whole, avorion would still work. You can go to stations, mine, get attacked by pirates and aliens. Just the story won't be there. Then I can change the galaxy size however I like, cause you could still play the game in any size (within reason you need minimum sizes). If you then could setup the story with parameters, the story could adapt itself to any size as well. It's another kind of design. One that I think is possible within the constraints there are right now. However ... it's a LOOOOOT of work, pretty sure the lead developer doesn't have that time :(
  6. Can this be maintained further ? This is an interesting thing to have but it's outdated to version 0.10
  7. I did I'm using a Json library now http://dkolf.de/src/dkjson-lua.fsl/home It works but I lose some flexibility and some overhead decoding and encoding the json. We are devs we always find workarounds, doesn't mean we have to like them though. Not even fond on having to use globals ... it's not like they act as singletons ...
  8. Aaargh this is frustrating, you can't use an array as a global variable {}. This sucks , it's one of the most important things you want an associative array you can use as context to reach in your entire application. Think springbeans in the springcontext if you would talk java. Or just basic IOC design in any other programming language .... grmbl ... I guess I could work with tons of prefixed variables in the global array as string ... but that is just messy ...
  9. I added a setGlobal in one script that runs on server startup, then tried using that global in a script attached to a script with getGlobal. But its always nil Are those globals just global in one script run, or are they global over the game instance ? If they are just global in one script run, I'm so very very boned ....
  10. I like to be able to start a game with a different size galaxy between limits you can choose between x 1000 and X 250 Y 1000 and Y 250 I know this will be hard since you have some hard coded limits in the LUA scripts but can't you change those by calls to the Server().GetGalaxyDimensions or something ?
  11. Yeah I did the same at first to, hoping to find any kind of label in any of the lua files. I got the workaround working now. I just don't understand his design decision on this one. It makes sense to have different menu options for different kind of ships. So I get it why you would attach UI scripts to ship objects. But surely you want options available all the time. The API also doesn't allow to addScripts on the Server object which for me sucks since I wanted to have a persistant script running each five seconds server side. I had to workaround it with a coroutine and bootstrap it to server.lua ... which I'm not happy about, but ... it works.
  12. I got following class package.path = package.path .. ";data/scripts/lib/?.lua" package.path = package.path .. ";data/scripts/empirebuilder/?.lua" package.path = package.path .. ";data/scripts/empirebuilder/util/?.lua" package.path = package.path .. ";data/scripts/player/?.lua" require ("EmpireBuilderUtil") TaskManager = require ("TaskManager") local EmpireBuilderGameManager = {} EmpireBuilderGameManager.__index = EmpireBuilderGameManager local function new() logDebug("creating EmpireBuilderGameManager") local obj = setmetatable({}, EmpireBuilderGameManager) local taskManager = TaskManager() obj.taskManager = taskManager EmpireBuilderContext["GameManager"] = obj return obj end function EmpireBuilderGameManager:registerCallbacks(player) logDebug("begin TaskManager:registerCallbacks") player:registerCallback("onSectorEntered", "attachEmpireInformationWindowOnSectorChange") player:registerCallback("onShipChanged", "attachEmpireInformationWindowOnShipChange") logDebug("end TaskManager:registerCallbacks") end function attachEmpireInformationWindowOnSectorChange() logDebug("begin TaskManager:attachEmpireInformationWindowOnSectorChange") end function attachEmpireInformationWindowOnShipChange(playerIndex, craftIndex) logDebug("begin TaskManager:attachEmpireInformationWindowOnShipChange", playerIndex, " + ", craftIndex) local player = Player(playerIndex) logDebug("player ", player) invokeClientFunction(player, "addEmpireInformationWindowToShip") logDebug("end invoke addEmpireInformationWindowToShip") end function addEmpireInformationWindowToShip() logDebug("addEmpireInformationWindowToShip") local ship = Player().craft if not ship.isDrone then if not ship:hasScript("data/scripts/empirebuilder/ui/EmpireInformationWindow.lua") then ship:addScriptOnce("data/scripts/empirebuilder/ui/EmpireInformationWindow.lua") end end end function EmpireBuilderGameManager:executeGameLoop() logDebug("begin executeGameLoop") self.taskManager:executeTaskManager() logDebug("end executeGameLoop") end return setmetatable({new = new}, {__call = function(_, ...) return new(...) end}) There is an instance of it running serverside, but I want to add a script to the ship a player is flying after he changed ships. If you look at the method attachEmpireInformationWindowOnShipChange you see I do a clientInvokeFunction, but it never triggers and there is no error. not in server log or client log. However I do find logDebug("end invoke addEmpireInformationWindowToShip") in the server log, so the method has been triggered somehow, just never run. Without any logging I have no idea why. Except maybe that the instance of EmpireBuilderGameManager isn't know at client side ? Is there a better way for the server to call client methods ?
  13. Oh I know that though, I got it working by attaching it to the ship the player is flying, but well that is not really what I wanted. It's a workaround but a lot of code for something this simple. I had hoped there was an easy way to attach it to the player instead of an Entity Really hope there is a way or there will be one in the future
  14. Is it possible to add a new top right menu icon to a player ? In most of the current scripts they all get attached to a ship, but I want my icon to be present all the time. It made sense attaching it to the player but I just can't get it to work. Client side there is no addScript() option to Player. And I don't think the code belongs server side. Has anyone got some experience with it yet ?
  15. I was wondering if it is possible to mod the size of the galaxy ? One million sectors is nice and all but it's a bit much as well. So I was trying to figure out if the galaxy is hard coded in the exe or a a lua script. I found the galaxy.lua function Balancing_GetDimensions() return 1000 end but changing that didn't do much , so I guess this is only used to make calculations and not for the galaxy generation ?
  • Create New...