Jump to content

Lukas Sedlak

Community Newbie
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Lukas Sedlak

  • Rank
    Tiro

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello everyone, I am developing my own AI based on distribution functions, thus I would like to create and use big array of 8 GB. I already have 16 GB of RAM, thus HW is not problem. I was able to create empty AI skeleton from PetraBot and run it inside 0ad (the AI does nothing, all units just stand there, no errors displayed in F9 console). However, I am unable to create a 8 GB array. When I try using following code in the CustomInit() function this.myArray = []; this.myArray.length = 8000000000; for (var i = 0; i < 8000000000; i++) { this.myArray[i] = 1; } I get error in F9 console error: JavaScript error: simulation/ai/waiting/_waitingbot.js line 47 error: RangeError: invalid array length error: m.WaitingBot.prototype.CustomInit@simulation/ai/waiting/_waitingbot.js:47:9 error: m.BaseAI.prototype.Init@simulation/ai/common-api/baseAI.js:45:2 error: m.InitGame@simulation/helpers/InitGame.js:80:2 I asked uncle Google and it looks like there is memory limit in JavaScript interpreters. Indeed, if I lower the array size to 1GB, no error happens in the F9 console. The JavaScript interpreters allow to set the memory limit on command line, for example node --max-old-space-size=8000 yourScript.js but since 0ad is written in C++ and runs a JavaScript interpreter internally, I can NOT configure it. Thus the question: How to increase memory limit for 0ad's JavaScript interpreter? I am using Ubuntu 16.04 LTS. I compiled 0ad from SVN successfully. I already read official documentation about AI development under 0ad and I also tried to search this forum, but no luck. I would be really grateful for any advice.
×