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

Pages: [1] 2 3 ... 63
Bug reports / Re: Too many Heap sections crash!
« on: December 27, 2017, 09:26:11 am »
Great to hear!
I'm afraid you will be unable to release it yet as it might require some API improvements which are available only in the server preview build I've sent to you. Better to check with the vanilla server build from Steam Client.


Bug reports / Re: Too many Heap sections crash!
« on: December 26, 2017, 07:05:13 am »
This is just the client crash (server detected the client is not running anymore and also stopped).
I'm quite sure this is just a memory leak at the NVorbis plugin we're using for music decoding/streaming. Will check for the next VE patch. With the last patch we didn't check the game stability after many hours in idle and nobody reported this issue before (most players run it just for a few hours max).
Thanks for reporting!


You're right, the prices are modified (and their statuses too). The price for cargo is calculated by SetResourceBasePrice method at Station.js. This is implemented this way to adjust prices randomly with 10% deviation. Yeah, that's really overcomplicated. Each station generates items/cargo for sale and calls this method for each of them to calculate the price, then this price is stored on server, but players receive another price which is calculated by CalculateBuyPriceOfCargo and CalculateSellPriceOfCargo (or same methods for items).
The only solution will be to implement new API methods for getting the final price of item/cargo by providing player's ship ID and station ID.

I verified the C# code and can definitely say that it calling Station.js file, methods CalculateBuyPriceOfCargo and CalculateSellPriceOfCargo, to calculate the prices. Have you tried to add the console logging to these two methods?
The game calculates the prices for a player during docking, when the items are added/removed from the shop items list (such as during stock items regeneration) and when a player tries to buy/sell to calculate the current price.

"args.cargo_price" is the price of cargo/resource from the XML file.
It seems there is no API for getting the price by cargo/resource XML ID so you're stuck with this for now, alas.


The price is adjusted for every player as you think. It's not clear from the scripting as this code is called from C#.
Here are methods which we're calling:
Station.js - CalculateBuyPriceOfItemModifi er and CalculateSellPriceOfItemModif ier - for calculation of item price.
Station.js - CalculateBuyPriceOfCargo and CalculateSellPriceOfCargo - for calculation of cargo price.

Unfortunately, these methods require quite a complex argument structure. For items:
Code: [Select]
int base_id;
int faction_relation; // this is a pre-calculated relation between the player's ship and the station faction
int item_id;
int ship_id;

For cargo it's more complicated:
Code: [Select]

string base_faction; // station faction ID
int base_id; // station ID
string cargo_id; // XML ID of the cargo
double cargo_price; // base price of cargo (from XML, I'm very unsure if this can be get from scripting API now - we might need an update to the game server for this API)
int faction_relation; // relation between the player's ship and the station faction
string ship_faction; // player ship faction ID
int ship_id; // player ship
int status; // cargo status

Alas, it's really complicated. Maybe a better approach would be to implement new scripting API methods accepting ship ID, station ID and item ID or cargo XML ID and returning the calculated price (by reusing the C# code).


Modding info / Re: Problem with script
« on: October 29, 2017, 10:09:01 pm »
@Teerawut, ok, post it here and we will try to help!

Development discussion / Re: CryoFall - Visual effects research (VFX)
« on: September 05, 2017, 04:14:11 am »
Tchey, we too, honestly.
Most of the post-effects we want to implement will improve the visual feedback of the game. When you receive serious damage or accumulating radiation it will be much more obvious than the simple status effects icons in the corner of the screen, and much more immersive too.
Most of these effects will be configurable (by the way, we recently finished the options system and menu, adding new options is very easy).
Though, some of the post effects will be forced (such as color grading for day-night cycle; I think everyone will agree it's not really good when the (vanilla) game allows to "turn of the night" in the options). But still, the modders are free to customize the existing post effects and even implement their own (yes, everything is implemented in the scriptable part of the game, including shaders code!). So we can expect a lot of crazy stuff and customization for every kind of player.

Development discussion / Re: CryoFall - new screenshots & news
« on: August 31, 2017, 11:51:44 pm »
I hope Linux is still a thing.
Sure, and .NET Core 2.0 was just released so it will be much easier. But there are still many obstacles as I wrote here

Modding info / Re: Problem with script
« on: August 23, 2017, 05:35:37 am »

it always returns an array of IDs (weapon items IDs).
If there are no ballistic weapons, the array will be empty.
So you can simply check the array length: if (ballisticWeapons.length == 0)...


Ok, sent you the build with new scripting API methods.

Ok, I will send you a build with this new API method later.

So, you need just an API method to get the crate containers nearby your ship - something like npc.GetAsteroidsByDistanceToN PC() but for crate containers?

Let me clarify how scripting works in VE.
All the JS files are loaded into isolated script engine instances. It means each script in the game (including topics) has independent global space. There are no shared global variables between script instances.
When you import another JS file into your JS file, its code is loaded separately into the same instance. But the global state is still not shared. So when you import another JS file, in fact, you're simply injecting its content into the importing JS file (it's totally different from C# "namespaces" concept, as you see). So that's why we also don't recommend importing huge JS files everywhere - only where you're really need.

Why is scripting in VE so limited? Because it was much easier for us to implement it this way. It allowed us to avoid many future problems. And we also using some global variables per-script/topic (from example, PLAYER_SHIP - when you're inside the topic script).

Another problem with global variables - we cannot serialize them easily and write into the savegame. So even if we had global variables (shared across all the scripts), it will be very easy to write bad code (which will prevent the game from properly saving the game state). So, we have storage scripting API instead. It's also very limited, but for the most cases, it was enough to get the things done.

Help section / Re: How to use ship.SetEquipmentCacheValue?
« on: August 02, 2017, 12:04:54 am »
Well it's not that simple... CalculateShip.js itself subscribing to OnCalculateNpcLeveledCache event:
Code: [Select]
actions.Bind("OnCalculateNpcLeveledCache", "CalculateNpcLeveledCache");I think the easiest way for you will be to modify CalculateShip.js (yes, it's hacky way...).

Another way is to create a new script, also bind to "OnCalculateNpcLeveledCache" and have your custom callback method for it (just copy CalculateNpcLeveledCache code from CalculateShip.js and modify for your needs). But it will work properly only in the case if OnCalculateNpcLeveledCache first handled by CalculateShip.js and then by your script. We don't have any API to setup callbacks priority, so you can try it and see if your method called after CalculateShip.js.

Help section / Re: How to use ship.SetEquipmentCacheValue?
« on: August 01, 2017, 11:11:34 pm »
unfortunately, for NPCs weapons are mapped directly from NPC XML, there is no way to change NPC weapons from scripting.
So, it makes sense to make a few NPC XMLs with particular weapons (per weapon type, multiple tiers). Giving too much choice to the player is something I would recommend to avoid as it might easily overwhelm the player. Consider having only a few presets for drones, the code generation for it is overcomplication and simply abusing the idea of XML's.

But you can modify NPC shield stats/properties, such as damage - as you found out, with the IMCache.
It's not recommended for mods to call ship.SetEquipmentCacheValue() - this method is intended to be used only by IMCache when it calculates "ship cache" (it combines stat values and bonuses from various sources and then applies them with ship.SetEquipmentCacheValue()). If you call this method directly you will overwrite the value set by IMCache (and if IMCache calculated any time later, it will overwrite your custom value). It's better to simply provide these values to IMCache instead. As you wrote, there is the CalculateShip.js script - and I think modifying it is the best way to do this.

Pages: [1] 2 3 ... 63