I never sleep. :P
-- RoidForge-Generated Level - v1.01
function LevelSetup()
Globals.G.Asteroids=(25)
Globals.Asteroids.MinSendDistance=350
Globals.Asteroids.MaxSendDistance=9000
Globals.Mines.MinSpeed=200
Globals.Mines.MaxSpeed=400
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(1)
Globals.G.GreysProbability=0.1
Globals.G.StartingSeedlings=30
Globals.G.StartingSeedlingsPlayer=500
Globals.AI.GraceTimer=(10)
Globals.Structures.FlowerProbability=(0.05)
Globals.Asteroids.MinCoreHealth=150
Globals.Asteroids.MaxCoreHealth=500
Globals.Asteroids.SpawnCap=100
Globals.Asteroids.SeedlingCap=5000
Globals.Agents.MaxSpeed=1000
Globals.Agents.MinSpeed=400
Globals.Mines.MinHealth=75
Globals.Mines.MaxHealth=200
Globals.Structures.LevelTime1=20
Globals.Structures.LevelTime2=30
Globals.Structures.LevelTime3=35
Globals.Structures.LevelTime4=40
Globals.Mines.NumberOfLasers=5
SetBackdropColour(0,0,0)
-- Asteroid z0
z0 = AddAsteroidWithAttribs(0, 0, 0.5,0.5,0.5)
z0.Moveable = false
z0.radius = 100
--z0.SendDistance = 400
z0.Name = "Z0"
-- Asteroid a1
a1 = AddAsteroidWithAttribs(-3000, -3000, 0.5,0.5,0.5)
a1.Owner = 2
a1:addseedlings(300)
a1.Moveable = false
a1.radius = 150
a1.SendDistance = 350
a1.Name = "A1"
--a1:Reveal(1)
-- Asteroid a2
a2 = AddAsteroidWithAttribs(-4000, -4000, 0.5,0.5,0.5)
a2.Moveable = false
a2.radius = 100
--a2.SendDistance = 400
a2.Name = "A2"
-- Asteroid a3
a3 = AddAsteroidWithAttribs(-2000, -4000, 0.5,0.5,0.5)
a3.Moveable = false
a3.radius = 100
--a3.SendDistance = 400
a3.Name = "A3"
-- Asteroid a4
a4 = AddAsteroidWithAttribs(-4000, -2000, 0.5,0.5,0.5)
a4.Moveable = false
a4.radius = 100
--a4.SendDistance = 400
a4.Name = "A4"
-- Asteroid a5
a5 = AddAsteroidWithAttribs(-2000, -2000, 0.5,0.5,0.5)
a5.Moveable = false
a5.radius = 100
--a5.SendDistance = 1400
a5.Name = "A5"
-- Asteroid b1
b1 = AddAsteroidWithAttribs(3000, -3000, 0.5,0.5,0.5)
b1.Moveable = false
b1.radius = 150
--b1.SendDistance = 350
b1.Name = "B1"
--b1:Reveal(1)
-- Asteroid b2
b2 = AddAsteroidWithAttribs(2000, -4000, 0.5,0.5,0.5)
b2.Moveable = false
b2.radius = 100
--b2.SendDistance = 400
b2.Name = "B2"
-- Asteroid b3
b3 = AddAsteroidWithAttribs(4000, -4000, 0.5,0.5,0.5)
--a:addseedlings(300)
b3.Moveable = false
b3.radius = 100
--b3.SendDistance = 400
b3.Name = "B3"
-- Asteroid b4
b4 = AddAsteroidWithAttribs(2000, -2000, 0.5,0.5,0.5)
b4.Moveable = false
b4.radius = 100
--b4.SendDistance = 1400
b4.Name = "B4"
-- Asteroid b5
b5 = AddAsteroidWithAttribs(4000, -2000, 0.5,0.5,0.5)
b5.Moveable = false
b5.radius = 100
--b5.SendDistance = 400
b5.Name = "B5"
-- Asteroid c1
c1 = AddAsteroidWithAttribs(-3000, 3000, 0.5,0.5,0.5)
c1.Moveable = false
c1.radius = 150
--c1.SendDistance = 350
c1.Name = "C1"
--c1:Reveal(1)
-- Asteroid c2
c2 = AddAsteroidWithAttribs(-4000, 2000, 0.5,0.5,0.5)
c2.Moveable = false
c2.radius = 100
--c2.SendDistance = 400
c2.Name = "C2"
-- Asteroid c3
c3 = AddAsteroidWithAttribs(-2000, 2000, 0.5,0.5,0.5)
c3.Moveable = false
c3.radius = 100
--c3.SendDistance = 1400
c3.Name = "C3"
-- Asteroid c4
c4 = AddAsteroidWithAttribs(-4000, 4000, 0.5,0.5,0.5)
c4.Moveable = false
c4.radius = 100
--c4.SendDistance = 400
c4.Name = "C4"
-- Asteroid c5
c5 = AddAsteroidWithAttribs(-2000, 4000, 0.5,0.5,0.5)
c5.Moveable = false
c5.radius = 100
--c5.SendDistance = 1400
c5.Name = "C5"
-- Asteroid d1
d1 = AddAsteroidWithAttribs(3000, 3000, 0.5,0.5,0.5)
d1.Moveable = false
d1.radius = 150
--d1.SendDistance = 350
d1.Name = "D1"
--d1:Reveal(1)
-- Asteroid d2
d2 = AddAsteroidWithAttribs(2000, 2000, 0.5,0.5,0.5)
d2.Moveable = false
d2.radius = 100
--d2.SendDistance = 1400
d2.Name = "D2"
-- Asteroid d3
d3 = AddAsteroidWithAttribs(4000, 2000, 0.5,0.5,0.5)
d3.Moveable = false
d3.radius = 100
--d3.SendDistance = 400
d3.Name = "D3"
-- Asteroid d4
d4 = AddAsteroidWithAttribs(2000, 4000, 0.5,0.5,0.5)
d4.Moveable = false
d4.radius = 100
--d4.SendDistance = 400
d4.Name = "D4"
-- Asteroid d5
d5 = AddAsteroidWithAttribs(4000, 4000, 0.5,0.5,0.5)
d5.Moveable = false
d5.radius = 100
--d5.SendDistance = 400
d5.Name = "D5"
-- Asteroid 21
--a = AddAsteroidWithAttribs(4000, -2000, 0.5,0.5,0.5)
--a.Moveable = false
--a.radius = 200
--a.SendDistance = 800
-- Asteroid g1
g1 = AddAsteroidWithAttribs(0, 4000, 0.5,0.5,0.5)
g1.Moveable = false
g1.radius = 200
--g1.SendDistance = 800
g1.Name = "G1"
-- Asteroid 23
--a = AddAsteroidWithAttribs(0, 4000, 0.5,0.5,0.5)
--a.Moveable = false
--a.radius = 200
--a.SendDistance = 800
-- Asteroid e1
e1 = AddAsteroidWithAttribs(0, -4000, 0.5,0.5,0.5)
e1.Moveable = false
e1.radius = 200
--e1.SendDistance = 800
e1.Name = "E1"
-- Asteroid f1
f1 = AddAsteroidWithAttribs(-4000, 0, 0.5,0.5,0.5)
f1.Moveable = false
f1.radius = 200
--f1.SendDistance = 800
f1.Name = "F1"
-- Asteroid h1
h1 = AddAsteroidWithAttribs(4000, 0, 0.5,0.5,0.5)
h1.Moveable = false
h1.radius = 200
--h1.SendDistance = 800
h1.Name = "H1"
-- Asteroid x27 This asteroid is here just so I can see the whole map
x27 = AddAsteroidWithAttribs(2000, 0, 0.5,0.5,0.5)
x27.owner = 1
x27:addseedlings(600)
x27.Moveable = false
x27.radius = 200
x27.SendDistance = 8200
x27.Name = "X27"
end
function LevelLogic()
-- Am I referring to asteroids here or is this the wrong way to do it?
-- Are my global settings wrong? These commands worked in the first section.
z0.Senddistance = 400
a1.Senddistance = 350
a2.Senddistance = 400
a3.Senddistance = 400
a4.Senddistance = 400
a5.Senddistance = 1400
b1.Senddistance = 350
b2.Senddistance = 400
b3.Senddistance = 400
b4.Senddistance = 1400
b5.Senddistance = 400
c1.Senddistance = 350
c2.Senddistance = 400
c3.Senddistance = 400
c4.Senddistance = 400
c5.Senddistance = 1400
d1.Senddistance = 350
d2.Senddistance = 1400
d3.Senddistance = 400
d4.Senddistance = 400
d5.Senddistance = 400
e1.Senddistance = 800
f1.Senddistance = 800
g1.Senddistance = 800
h1.Senddistance = 800
x27.Senddistance = 8200
end
function leveldraw()
end
so you don't need to :D
This brings up another question. Is it possible to run a map, and somehow, maybe by mouse action, see the numerical values associated with each asteroid in a display somewhere? If this were possible, I could have detected my problem immediately.
function LevelSetup()
-- Bunch of Globals..
-- Declare Asteroids
MyAwesomeAsteroid = AddAsteroidWithAttribs(1000,1000,0.5,0.8,0.3)
MyAwesomeAsteroid.Radius = 300
MyAwesomeAsteroid.TreeCap = 3
MyAwesomeAsteroid.Owner = 1
MyAwesomeAsteroid:AddSeedlings(100)
end
function LevelLogic()
MyAwesomeAsteroid.SendDistance = 1000
end
function LevelSetup()
-- Bunch of globals..
-- Asteroid #0
fluffy = AddAsteroidWithAttribs(250,-350,0.5,0.5,0.3)
-- Asteroid #1
battlefluffy = AddAsteroidWithAttribs(250,-350,0.5,0.5,0.3)
function LevelSetup()
-- Bunch of globals..
-- Asteroid #0
fluffy = AddAsteroidWithAttribs(250,-350,0.5,0.5,0.3)
fluffy.SendDistance = 1200
GetAsteroid(0).radius = 300
-- Asteroid #1
battlefluffy = AddAsteroidWithAttribs(250,-350,0.5,0.5,0.3)
GetAsteroid(1).SendDistance = 1450
battlefluffy.radius = 375
function LevelSetup()
-- bunch of globals
-- Asteroid #0
a = AddAsteroidWithAttribs(0,0,0,0,0)
end
function LevelDraw()
DrawLine(50,50,200,200,0,1,0,1,0,0,1,0.5,5)
end
function LevelLogic()
end
I look forward to the time when I can concentrate on tweaking AI behaviour and working out elegant mathematical solutions to my codes, but it is frustrating at this point as that is something that seems to be far in my future.
line = DrawLine(0,0,100,100,0,0,0,0.99,255,255,255,0.99)
line.a1 = 0.5
Thanks for helping me warp-speed ahead in my understanding so far
When you said "type a full stop" into the console, what does that mean
Is the number I see in the error message the line number in the code?
I'm using notepad and of course there are no line numbers. Is there any alternative program that automatically shows line numbers off to the side or something?
Is the player automatically assigned to Empire 1, "Greys" to Empire 0, and any other opponents 2 and above?
Another question which is difficult to ask because I'm not sure how to word it- but I'm trying to figure out how the game processes the functions- specifically how they are ordered. I assume the processing starts at line 1, and then progresses sequentially through the code. But obviously there are things at the bottom of the code that the program knows, while it is working on things in the function level logic section. I get the impression that the entire code is read and any functions are processed, and then anything in the function logic section is run during the game. If a process requires some information from another part of the code, it will refer to it but the main routine is contained in the function level logic. The other functions act kind've like subroutines. Does that make any sense?
x[0] = math.cos(input) * scale
y[0] = math.sin(input) * scale
scale = 1
scale = 0.5
Regarding that Drawline function, I was playing with it and I could swear the "g" and the "b" are reversed. I know it makes more sense the other way but maybe I'm just generally confused.
Does anyone else ever experience double-menus, where an extra menu panel will appear mid-screen that can't be removed? It will usually disappear when restarting the game.
What specifically does the VignetteAlpha control? I can't see any difference when I enter different values (0 -255).
Is it normal for local variables to be held in memory after quitting a map to the menu screen and then immediately loading it againr?
Does anyone else ever experience double-menus, where an extra menu panel will appear mid-screen that can't be removed? It will usually disappear when restarting the game.
I've searched, but haven't been able to find a list of default game/global settings/variables. Is that information available in one place? The threads I've seen mostly do not give value ranges nor default values.
I'm very interested in hearing other's opinions and philosophies on what they think makes a good map and a challenging, yet fun, experience in the game. Since as a map-maker you are able to decide how easy or difficult the game-play will be, how do you judge if a map is too hard or too easy? Some maps are so easy and repetitive one play-through is enough. Others are so difficult and epic that you have to devote a couple of hours to it's completion. Granted, part of the attraction of this game is it's grand, epic campaign and stately progression of marshalling forces across the asteroid field, but can a map be too large and long for it's own good? As a player, do you like surprises, and sudden changes of fortune late in the game, or do prefer a more systematic approach?
How many seedlings should I give the player? Should I give them just enough to struggle to survive, attractive to a more-experienced player, or should I be more generous and make it easier to expand and conquer- more suitable for beginners? What's "difficult" for me may be easy for most- I don't know.
Of course I realize that there is no "correct" answer to these questions, but I'm interested in hearing other map-maker's thoughts on what they think is a reasonable level of difficulty to aim for.
ownast = GetEmpire(2):GetNumOwnedAsteroids()
if GetAsteroid(69):GetNumSeedlings(0) > 0 then
GetAsteroid(69):RemoveSeedlings(0,1)
end
function Centralise()
topID = -1
--Calculates highest asteroid ID
for i = 0,math.huge do
if GetAsteroid(i) ~= nil then
topID = topID + 1
else
break
end
coroutine.yield()
end
farR = 0
farL = 0
FarU = 0
farD = 0
for i=0,topID do
if GetAsteroid(i).position.x + GetAsteroid(i).SendDistance > farR then
farR = GetAsteroid(i).position.x + GetAsteroid(i).SendDistance
end
coroutine.yield()
end
for i=0,topID do
if GetAsteroid(i).position.x - GetAsteroid(i).SendDistance < farL then
farL = GetAsteroid(i).position.x - GetAsteroid(i).SendDistance
end
end
for i=0,topID do
if GetAsteroid(i).position.y + GetAsteroid(i).SendDistance < farU then
farU = GetAsteroid(i).position.y + GetAsteroid(i).SendDistance
end
end
for i=0,topID do
if GetAsteroid(i).position.y - GetAsteroid(i).SendDistance < farD then
farD = GetAsteroid(i).position.y - GetAsteroid(i).SendDistance
end
end
avgX = (farR - farL)/2
avgY = (farU - farD)/2
for i=0,topID do
GetAsteroid(i).position.x = GetAsteroid(i).position.x - avgX
GetAsteroid(i).position.y = GetAsteroid(i).position.y - avgY
end
farR = nil
farL = nil
farU = nil
farD = nil
avgX = nil
avgY = nil
topID = nil
end
This writing-code stuff and trouble-shooting is somewhat addictive. I'm starting to dream about it- when I can drag myself away and get to bed on time!
I'd like the player to spawn on a random asteroid each time they play.What if you try to control it manually?
Function prototype return type Description GetRandomAsteroid() Asteroid Get any asteroid in the current game, at random. GetRandomRangeAsteroid(start, end) Asteroid Get a random asteroid from the given range of IDs (start is inclusive, end is exclusive, so e.g. a range of (4, 10) would select a random asteroid from the asteroids with IDs of 4, 5, 6, 7, 8, and 9) GetRandomEmptyAsteroid() Asteroid Get a random asteroid in the game that is empty (that is, it has no trees or seedlings on it and is owned by the grey team) GetRandomRangeEmptyAsteroid(start, end) Asteroid Get an empty asteroid from the given range of asteroid IDs.