Author Topic: My First Map- Trouble already!  (Read 44989 times)

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
My First Map- Trouble already!
« on: June 26, 2011, 12:15:09 PM »
Hello Everyone,
I've noticed that despite the enormous amount of generous help and knowledge available here, many beginning map-makers seem to just disappear- never to be heard from again. Are they intimidated by the incredible maps already made, or do they give up faced with the daunting learning curve? I've decided to give it a try, but have already come to an impasse with my very first attempt to create a map. My problem right now is that I can't seem to control the "send distance" of my asteroids. Some work, and some don't. I can't see a pattern and despite 3 full days of reading, reading, and tweaking variables, and more reading, I've had no luck in getting it to work. Maybe the learning curve for absolute neophytes is just too steep. Can someone take a look at the code and explain what the problem is? Map is attached.

Thank you!

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #1 on: June 26, 2011, 12:26:51 PM »
Just ask us :)

The sending distances is easier controlled in LevelLogic(), meaning that you can set them, and they stay. As far as I'm conserned... If you already have them there: we gotta figure out how to solve the problem :)

Welcome to the foum, and welcome as a map maker :D

Edit: looked at the map, how are the asteroids supposed to get contact?

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #2 on: June 26, 2011, 01:01:59 PM »
Contact? The middle asteroid is a dead-end asteroid purposely. The inner-most asteroids at the 4 inner-corners should make contact with the center asteroid. All the other outer asteroids should only make contact with their neighbors. For some reason some of the assigned send-distance values are not working properly. Right now at this stage I'm just trying to learn how to control some of these basic parameters. If you run the map and check the send-distances, you can see most are not consistent with the assigned values. I'd like to figure out why this is happening.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #3 on: June 26, 2011, 01:59:47 PM »
The reason why that happens is that once all the commands in function LevelSetup() have been run, the game auto-adjusts all the send distances of the asteroids to make sure all asteroids are reachable by each other.  This is a "feature".  :>

If you want to bypass this behaviour, declare your send distances in function LevelLogic() instead.  Then the send distances will be set after the auto-adjusting has already taken place.  :>


Also welcome aboard!!  It's so awesome when a new person starts.  :>  Yes I have noticed about the fact that people give up too, I had figured that was largely because there was only a beginners guide and people were getting a certain way in but where unable to make the leap to coding advanced behaviours, in the way that Aino, Pilchard and myself have been able to.  So now there is an intermediate guide... hopefully that will redress the situation a bit.. but new coders don't come along all that often, so I guess we will have to see.  :>

Great to have you, anyway.  :>  Please let us know if you need any help!

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #4 on: June 26, 2011, 07:29:19 PM »
To be honest, I can't really say much other than what others have said before me - set the send distances in LevelLogic(). Also, do you realise that your level will not be winnable as you have not written any win conditions? Still, nice to see someone new to coding here, hope you have a good time. If you want to make very simple maps (like just to see if they work or look right) there are a few basic level creators around. DAFT and EUCLiD, are a couple; I'm fairly sure there are others.

Annikk, do you ever sleep? Or are you in Dubai, or wherever you had to go before? I wouldn't say that I've made 'advanced' behaiviours, just added a few little glittery bits to it. Nothing like you or Aino, though thanks all the same.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #5 on: June 26, 2011, 07:45:15 PM »
The map looks amazing(I didn't get to see it yesterday)...

It kind of reminds me of a Quantum map, just saying :P

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #6 on: June 27, 2011, 03:33:11 AM »
I never sleep.  :P

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #7 on: June 27, 2011, 03:37:20 AM »
I never sleep.  :P

Whaaaat?

Guys, call Area 51... we got an alien here :o

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #8 on: June 27, 2011, 06:35:09 AM »
How is the map doing?

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #9 on: June 27, 2011, 09:33:27 AM »
Not well, but I'm not giving up! I tried declaring (per Annikk's advice) the send distances in the function LevelLogic() section using the same syntax I used in the function LevelSetup() without success. Thinking that they were not being overwritten as I expected them to be, I erased them in the Setup section and only declared them in the LevelLogic- still no luck. Was I using the wrong method of identifying individual asteroids? I wasn't sure if they were even being read in that section so I created a message box there which worked fine, so I know something was wrong with the way I was declaring the send distance values. So I've spent quite a bit of time examining and printing out other user-created maps to try to see how it is done. Unfortunately, I haven't found one that used the method I'm trying to use (giving them unique names initially for later reference) while then declaring senddistance in the LevelLogic() area. So then I tried adding seedlings to a an asteroid using the "GetAsteroid()" function. This worked but put them on an unexpected asteroid. After further research, I found out that the asteroids aren't counted from 1, but from "0". Well, that explained that! So I tried to use that function to change the senddistance, but that didn't work. I don't even know if those two functions are compatible with each other, but thought I'd give it a try.

Getting frustrated, I decided to try to play around with other functions as a way of getting more familiar with the arcane language of Lua, and computer and mathematical language generally - "bool", "nil", "void", "structure", "agents", "float", etc. I find lots of functions with a series of variables but it takes time to find out what the variables stand for and what the range of each variable is. For instance, I see the the "Drawline" command and wonder if I can actually draw a line on the screen. Alex gives an example of the code in one of his posts, but did not provide information on what the variables stood for. I finally found a reference to the variables in the script command thread and inserted it into a map but saw nothing. After numerous attempts at "drawing" something on the screen and failing it just reinforces my realization of how deep my ignorance goes.

Anyway, none of my experimentation and playing around has gotten me any closer to solving this very early and no doubt simple problem of fixing my send distances. I am determined to figure these things out on my own as much as possible, and only use this forum's human resources as a last resort. I have so many ideas I'd like to implement and actually have a pretty good idea of how to do it, but just need to get up to speed on the language structure and syntax in order to make them happen. 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.

Attached is one of my attempts to declare my send distances in function LevelLogic(). I'm doing something wrong but can'figure it out on my own as of yet.  If anyone can give me further insight maybe I can move on to the next of my 10,000 questions.     



Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #10 on: June 27, 2011, 09:48:23 AM »
I gotta ask, do you check the console for bugs?

Because there is an error occouring, it says that a2 is nil...

Theese errors are the most irritating this ever, and I'm sorry for you spending so long time trying to get this right...

I fixed the aa2 to a2 and it worked jsut fine for me :)

BTW: leveldraw() is written LevelDraw() else it won't work, lua is case snsitive :P

code:
Code: [Select]
-- 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

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #11 on: June 27, 2011, 02:09:27 PM »
I had no idea there WAS a console or how to activate it until I stumbled across a reference to it in one of Alex's posts from 2008 yesterday. Since I had no idea what I was really looking at I didn't play with it too much. At this stage, I'm not sure how useful it would be to me anyway.

Sorry about the aa2 vs a2 notation. I had changed that variable as an experiment in case "a2" was a reserved variable or something, just in case that was why it wasn't working. It didn't help, and I failed to change it back before you saw it.

Your confirmation that I was using the correct syntax all along opened my mind to something I suspected but did not pursue until now. When the game auto-adjusted the send-distances due to my desire to have one asteroid a "dead end" (as Annikk pointed out), it happened to adjust certain send-distances exactly as I visually intended, but others not. So when I looked at the map, it appeared some of my values were working. In actuality, they were twice what I was trying to input. An earlier version of my map was too small and compact, and I increased the size but failed to properly increase the send-distances by the correct ratio. So I was fooled into thinking my inputted values were what I wanted because the game was, by chance, making it appear most of my values were correct. So when you confirmed I was entering the correct syntax and the map still was not behaving correctly, I suspected what the problem was. By removing the "dead-end" asteroid from the map, I could see my initial values were indeed too small. I changed them and it is working perfectly now.


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. It seems to me this would make troubleshooting and map-design much easier. Something I missed in Annikk's Roid Forge was a real-time readout of the asteroids' coordinates as they were being placed. Unless it already exists in some form, I was thinking at some point in the future of creating such a feature using your awesome text-drawing function (far, far in the future).

Thanks to you and Annik I can now move on to trying some "intermediate" functions. I'm sure I'll be back here soon.

Oh yeah, i'm aware of case-sensitivity, but not everyone uses it in their posts, so it gets confusing sometimes.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #12 on: June 27, 2011, 04:18:18 PM »
Quote
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.

Sort of, yes.  :>  Enable developer mode in-game by pressing CTRL-D, then press F12 to open up the Asteroid Information View.  This shows you the coordinates and ID numbers of all the asteroids in play.

F4 is also very very useful, that lets you turn on vision of the other empires and allows you to zoom all the way out without having to explore everywhere first.  Very handy for developing levels.  :>
« Last Edit: June 27, 2011, 04:23:02 PM by annikk.exe »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #13 on: June 27, 2011, 04:33:17 PM »
Also, about the console.  When you're testing a level, it's always best to open the console and check if there is an error message there.
Sometimes an error message will get "stuck", so to test if there is a stuck message, try typing a full stop into the console and pressing enter.  If you only get an error message about the full stop, then there was no additional error message waiting.


To try to put your mind at rest about the send distance thing, here's some sample code showing how I would set the send distance of an asteroid in the situation you are facing.


Code: [Select]
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


Hope that makes sense.  :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #14 on: June 27, 2011, 05:07:04 PM »
A few other mysteries you talked about that I can hopefully dispel:

1.  If you declare send distances in function LevelSetup(), and then declare them again in function LevelLogic(), the values in LevelLogic() will overwrite those in LevelSetup() the moment the game starts.


2.  You identify individual asteroids either with a variable, or with their ID.

For example, consider this code:


Code: [Select]
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)


Now I can refer to the first asteroid as either "fluffy" or "GetAsteroid(0)", and I can refer to the second asteroid as either "battlefluffy" or "GetAsteroid(1)".

So for example, to continue from the above code, we could set the following send distances and radiuses:

Code: [Select]
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


You can mix and match variables and the GetAsteroid command in this way.  It's just two different methods of referring to an asteroid, and both are "compatible" with everything else.

As for the ID numbers, the order in which asteroids are created is what determines what their ID numbers shall be.  The first asteroid you create is asteroid ID 0, the second is ID 1, etc.




3.  Regarding the drawing of lines on the screen.  It's not obvious, because it is not covered in any tutorial (I'm saving it for an "Advanced" tutorial).  But since you talked about it in your post, I'll talk a little about how you draw things now.

First of all it's important to understand that you don't put DrawLine or DrawSprite commands in LevelSetup or LevelLogic.
Instead, they go in their very own function!  You have a choice, you can either draw to the level or to the screen - using either function LevelDraw() or function ScreenDraw().

Lets take a look at an example:

Code: [Select]
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

That would draw a line.

The way the DrawLine command works is it draws a line from Point 1, to Point 2.  You set the coordinates of Points 1 and 2, and various properties about them; you specify the colour of each end of the line, and the "alpha", which is how transparent it is.  That means you can create lines with cool crossfades of colour.  Finally, you set how thick the line should be.

Here's what all the parameters are:

DrawLine(X-Coord 1, Y-Coord 1, X-Coord 2, Y-Coord 2, Red 1, Green 1, Blue 1, Alpha 1, Red 2, Green 2, Blue 2, Alpha 2, Line Thickness)


Hope that explains it.  Let me know if you still can't get that to work, and I'll do a proper playable map.  :>



4.
Quote
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.

I realise it's frustrating with the initial problems, but right now you are going through an important process of learning how to analyse the code you've written and look for mistakes.  Some of the things you've talked about, the discovery that asteroid ID's start with 0 instead of 1, these are crucial lessons which will stand you in good stead for all of your coding going forward.  :>  It really doesn't take as long to get up to speed as you'd imagine.

We're here to help!  So if you get stuck or if you have a random question about something, just let us know.  :>
« Last Edit: June 27, 2011, 10:07:06 PM by annikk.exe »

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #15 on: June 28, 2011, 01:20:41 AM »
Good luck with the map, it looks like a good one so far. I would say, though, that you might want to not call your asteroids things like a1, as that's sometimes used for lines and stuff. It shouldn't be a major problem, but...

Using Annikk's DrawLine() example above, the 'official' definition of it is DrawLine(x1, y1, x2, y2, r1, g1, b1, a1, r2, g2, b2, a2, thickness). Consider the following code:

Code: [Select]
line = DrawLine(0,0,100,100,0,0,0,0.99,255,255,255,0.99)
line.a1 = 0.5

Unless I'm totally wrong (which I often am, sometimes very stupidly and badly) that would change the value of line 's    a1 value. Not much of a problem, but it could cause confusion in longer codes.

Sorry for being so pedantic, and I probably have hundreds of bad practices myself, but I just thought that mentioning little things like that would make it easier in the long run. Give's a hoi if I'm being too harsh.

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #16 on: June 28, 2011, 02:23:26 PM »
You guys are the best! I really appreciate all of your help and encouragement. I don't know how to do the fancy formatting in response to each comment, so I'll just cover them all here like this.

Pilchard, I agree my asteroid naming might not be too good in the long run, but for my learning purposes of how the grid system works, at this point, it helps me keep things organized in my head. I think there is probably a fine line between having too short a name and too long in having to type it out repeatedly later. I'll have to come up with some kind of nomenclature that works for me as I figure things out. 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.

Annikk, I don't know what you do for a living but you should be a teacher. You make things so clear and obviously have a lot of patience and enjoy passing along your knowledge. With each answer, though, you generate 10 more questions. I'm trying to answer them all myself through experimentation and it's very time-consuming. 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? I also have experienced quite a few error messages so far. 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?

A few questions for anyone-
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? If anyone understands what I'm trying to say and would care to try to educate me I'd appreciate it. Maybe as I get more code written  I can attach an example and explain myself better.

Attached is an update on my progress if you're interested. You can start to get an idea of where I'm headed...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #17 on: June 28, 2011, 05:55:25 PM »
Hey dude :>

Glad to hear things are going well!
Experimentation is the beginning of awesome things.. :>


Quote
Thanks for helping me warp-speed ahead in my understanding so far

No worries :>


Quote
When you said "type a full stop" into the console, what does that mean

I meant the "period" symbol (.) but really anything will do.  Go ahead and type in "fishcakes" if you prefer.  :>  The object of the exercise is to enter any old junk into the console, in case of a "stuck" error message.



Quote
Is the number I see in the error message the line number in the code?

Yes :D


Quote
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?

There is!  May I be the first to recommend the brilliant Notepad++.
As well as line numbers, it also colour-codes the code to highlight specific lua commands making it far easier to spot typos, and it's fully skinnable, has unlimited undo levels... and it's totally free.  :>
I personally use the "Deep Black" skin.  So much easier on the eyes than white notepad!



Quote
Is the player automatically assigned to Empire 1, "Greys" to Empire 0, and any other opponents 2 and above?

Yep that's correct.  :>
Also, GetEmpire(2) is the same thing as GetAI(2).  I tend to use Empire for everything, because you can also refer to Empire 1 (the player) and Empire 0 (the greys).


Quote
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?

You're correct that things run in a specific order.  Here's when each function is run:

LevelSetup()
This code is run when the level is loaded.

LevelLogic()
Once the level has loaded and is running, this code is what runs next.

LevelDraw()
This code runs continuously at a rate of 60 frames per second.  It runs "in between" Level Logic cycles.

ScreenDraw()
As above.

OnAsteroidTaken()
This code is run whenever an asteroid changes owner.

OnAsteroidRevealed()
This code is run whenever an asteroid is revealed to an empire.


Apart from that, what you say is correct - it starts at line 1 and works its way down.



I'll go check out your work in progress now.  I'll post back shortly.  :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #18 on: June 28, 2011, 06:11:57 PM »
This looks awesome by the way.. :>
Really nice design.  I love the cross thing in the middle, very cool.  :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #19 on: June 28, 2011, 06:19:46 PM »
The map is currently throwing up an error though, that's because of this line:

Code: [Select]
x[0] = math.cos(input) * scale
y[0] = math.sin(input) * scale

The reason why it produces an error is that you haven't specified what "scale" is!  You need a line, either at the very top of LevelLogic(), or anywhere in LevelSetup(), sometime like:

Code: [Select]
scale = 1
or..

Code: [Select]
scale = 0.5
or whatever you want to set it to.  :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #20 on: June 28, 2011, 06:21:03 PM »
Spotted one more query I can reply to:


Quote
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.

You're correct, they're reversed!  I had forgotten about that, but you're absolutely right.  I believe it's a bug.  :>

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #21 on: June 28, 2011, 07:07:49 PM »
AAAck! You know what? Before I posted that map I stripped it of most of the detritus of my experimentation to clean it up, and the Scale declaration got stripped out. It's there in my original map. I'm surprised it still worked.

I'll see if I can download that Notepad program right away. It will probably be a huge help!

Thanks for explaining the code execution. It's gradually making sense now. Some of the myriad ideas I have may actually come to fruition! It's getting very tricky now because I'm trying to do some scripting and I don't have my mind wrapped around the structure of the programming yet. I printed out your Intermediate Coding Guide and its getting a lot of use!

Well, back to the coding grindstone...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #22 on: June 28, 2011, 07:13:19 PM »
It certainly sounds like you are getting a handle on this pretty quickly.  :>
Looking forward to seeing what you come up with!

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #23 on: June 28, 2011, 08:25:31 PM »
Got the Notepad++. That's EXACTLY what I was picturing. I've already solved a problem thanks to it.

I've got quite a few really cool ideas in my head and am looking forward to making them work. Nothing like 3D Rotating Cubes or Gravity Engines, but maybe some useful things like your RoidForge or at least some twists on the game formats I've seen so far. I've got so much to learn I just worry I'll reach a plateau I can't overcome. One really good thing going for me is all the good people here on this site who are all so supportive of each other. That can make all the difference in the world. Like you pointed out somewhere, we all stand on the shoulders of giants and I certainly am going to take advantage of that!

Actually, since I'm here I have a question. In your list of operations, am I correct in thinking that LevelSetup() MUST be run first, but that the other sections can be put in any order? I was looking at a program where Screendraw came before LevelLogic(). I'm wondering because I put function ScreenDraw() above LevelDraw(), and now suddenly my LevelDraw() is not implementing. I haven't fooled around with it yet to find what is happening, but overall, is my thinking correct?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #24 on: June 28, 2011, 09:08:42 PM »
Hmm, I'm not sure if it matters what order the functions appear in... but by convention, I usually do LevelSetup() first, and all the other functions in whatever order pleases me.  Always worked fine so far!  :>

Glad you like Notepad++ :>  I wouldn't worry about reaching a limit where you just can't go any further, that's unlikely to happen.  :>

Making something crazy like gravity or a 3D engine is generally only as hard as understanding the concept behind it.  Once you can visualise what needs to be calculated, you can usually just go and google for the maths that is needed.

The two most-used maths rules I've found so far are Pythagoras and the Intersection of Two Lines.  Both those are generally covered in school, though most people soon forget them... but it turns out they are really really useful for coding :>  Anyway, the point is that the maths behind those two is not rocket science, and you can teach it to yourself in an afternoon if you wanted to.  :>

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #25 on: July 10, 2011, 05:35:19 PM »
A few questions for anyone:

No matter what I do, the "GetNumFactions()" Function Returns a value of "12". Anyone else have that problem or know of a cause or work-around?

What about GetNumInactiveFactions? How can a faction be "inactive"?

Is there any way for a player to be able to choose the number of factions, either directly or indirectly?

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.

Thanks for any responses...


Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #26 on: July 10, 2011, 06:01:02 PM »
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.

Yup, but I have never worked out how to prevent them. They just go after some stimulus that I don't know. That said, it may be a piece of your code. If you're making custom maps, comment out bits of code in a binary search pattern. That should narrow it down.

http://en.wikipedia.org/wiki/Binary_search_algorithm

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #27 on: July 10, 2011, 06:14:54 PM »
Let me begin:

    - GeNumFactions() return 12, because the game has the limit of 12, this is very useful for when you would like to have all the factions active at once.
    - A faction is automatically set to inactive when it has 0 asteroids and 0 seedlings, so you can actually use the GetNumInactiveFactions() function to create a win condition!
    - Yes, you can create alot of stuff that just creates new factions. For example: if you create a button with ScreenDraw() and then make a button out of it(make it react to clicks) and when clicked, the game create a new faction on a barren asteroid owned by the greys. changing the owner and adding atleat a dysontree of 10 seedlings. This way, you can change the amount of empires. I don't know if you can decrease it a secure way though.
    - VignetteAlpha I got no real idea of what does, ask Annikk, as it seems he knows more of it than I do :P
    - This is pretty normal, but local variables? But to prevent this, set the variable to a default value before even using it, this way, you don't need to be afraid of stuff changing.
    - Double-menus are nromal when messing around with ScreenDraw(), the most common way for it to appear, atleast for me, is that I change the window size in-game.
    - Have you tried the
Lua scripting reference? This leads directly to the post about globals, it tells you what the globals are(integer or floats), and you don't need to care about the limits very much, since if you go over the max, it will change it to the max(in-game, not directly on the code!)

Hope that was everything :)
[/list]

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #28 on: July 11, 2011, 01:04:55 PM »
Well I've given up on the GetNumFactions route and the player-choice route- after a great deal of experimentation I decided to just go the randomized way. For whatever reason I just couldn't get any game behavior to be altered with mouse clicks and buttons. I could make graphics changes but I only got crashes or no results at all linking to anything else. Maybe I'll incorporate that into a future map as my skills increase. Aino, I studied your CC map code and Annik's Roid Forge code but it's just too much work for my little map.

I've created a thick binder of all the information I could find here on the global variables, etc. If the default values are indeed the max values then that makes things somewhat easier. I've already gone through one ink cartridge!

I'm beginning to wrap up my map layout and features and am beginning to tweak the Global variables and other things in an effort to create a balanced game-play. 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. Maybe I should ask this in a new thread? 

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #29 on: July 11, 2011, 02:35:30 PM »
What specifically does the VignetteAlpha control? I can't see any difference when I enter different values (0 -255).

The vignette is is a darkening around the edges of the screen.
The "alpha" of the vignette is how dark the vignette is.

In Extreme Pwn Laz0rz, the vignette starts at maximum, and then descends to 0, in the opening moments of the game.  I did that as a little intro thingy.  :>  It means the focus starts out on the laser mine, and the edges are darkened... then gradually the surroundings becomes visible.


Quote
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?

Yes.  If you initialise your variables in LevelSetup() then it shouldn't cause you problems, though.  For this reason, be wary of using any conditional that checks if a value is nil!


Quote
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.

Yes I get that from time to time, usually when maximising the game window.  A restart usually clears it, and then I maximise the window while in the menus, and it's fine...


Quote
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.

If you look in your Eufloria\Resources folder, you'll find a file called default.xml.  This contains a list of all the default values for global variables.



Quote
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.

This is a good question and one we as level designers don't really spend enough time discussing.  What makes a map fun?
Here are my own thoughts on this:

1.  I think the level should be slightly unpredictable.  Grid-like levels are very predictable and unsatisfying to play on, for example.

2.  The level should be beatable within 1-5 attempts by most players.  Totally impossible maps are frustrating, ridiculously easy maps are unsatisfying.  Remember that you coded your map and you play it over and over during testing, so you know it very well - others will not have this advantage, so bear this in mind when setting the difficulty.  When you release a map, it's worth saying in your post how difficult the level is.  Casual levels are ok too - not all of us are 1337 gamers!

3.  You need to pay some attention to the pace of the level.  If you give the player 200 seedlings at the start, they will need to rush around grabbing lots of asteroids right at the beginning, leading to a stressful, fast-paced early game.  If you give them 10 seedlings, it will take ages for the game to get going.  Whereas if you gave them 45 seedlings, that's enough to colonise 1-2 asteroids and scout a couple more, which is a fairly nice pace imho.

4.  If the level has some crazy mechanics in it, the controls for it should be _completely_ intuitive.  If people can't work out how to play your level within a minute or two or without an instruction manual, it's not fun.

5.  Originality is good.  It's far from the only thing that makes a level good, but it's cool to see something totally new - the novelty is interesting to people.  However there is also a distinct lack of "normal" style maps these days, and I suspect a demand exists for those sorts of levels that don't try to bend the game into something totally crazy.

6.  Polish is important.  Check the spelling in your message boxes, make a nice banner image for your level when you release it, make sure you've not left lots of the asteroids exactly the same size/send distance..  ensure everything is nicely adjusted and balanced.

7.  Testing is crucial - if you release a level and then it turns out there's a bug in it that totally breaks things, this is not fun at all.  Get other people to test your level too, and listen to their feedback.

8.  The player must be able to win with different approaches.  They must have choices.  Linear levels are not fun.  Levels where you can only win with a single tactic are generally not so fun.
« Last Edit: July 11, 2011, 02:40:13 PM by annikk.exe »

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #30 on: July 13, 2011, 09:03:05 AM »
Thanks all for your answers and Annik's views on good map qualitiies. The XML file answered some of my questions.

I still can't understand the (relative) lack of user-made maps available- considering how long this game has been out. Maybe when it gains a wider audience more people will be interested.

Annik, if you ever actually get around to creating/re-writing your guide for complete beginners, I've got a lot of suggestions for you! My first suggestion would be to make a downloadable PDF or Microsoft Word document or something that would be easily printed or searchable for key words. I've been pasting every map code I can find into Word and typing up my own Excel sortable tables of commands, etc. so that I can easily find actual examples of what I'm looking for. It has taken a lot of time but there is nothing like looking at actual examples of things in use. Maybe some day I'll be knowledgable enough to make my own.

Anyway, here's a question for anyone--

I'm trying to find out how many asteroids an Empire owns. I don't want to know it's relation to another number- I want the actual number.

I typed "ownast =  GetEmpire(2):GetNumOwnedAsteroids()". It doesn't matter which empire I include.

But it's not returning anything other than what I declared ownast to be in the setup level. I know I could work around it through a process of elimination, but how can I just get the answer in one line?

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #31 on: July 13, 2011, 04:39:35 PM »
Now I have another problem. I'm trying to allow the game to randomly  choose number of empires, but it puts these empires randomly on the map, regardless of who "owns" the asteroid in setup. I want to control which asteroids the empires spawn on. As a solution, I figured I would just remove the seedlings from those asteroids and then put the number I want on the asteroids I've already assigned as the owner. It isn't working and I can't figure out why.

As a test- I already added 200 seedlings to asteroid 5, owned by Empire 2. Now, I want to remove some of them. I type:

if GetAsteroid(5):GetNumSeedlings(2) > 0 then
GetAsteroid(5):RemoveSeedlings(2,100)
end

At this point the game crashes and I'm never able to find an error code.

Is the format incorrect? If not, what else could be the problem? As soon as I remove the offending lines of code it runs perfectly.


annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #32 on: July 13, 2011, 06:05:36 PM »
Code: [Select]
ownast = GetEmpire(2):GetNumOwnedAsteroids()
This is correct.  If the value of "ownast" is not being set correctly, there are two possibilities why.  The first is that you are checking the wrong empire number.  The second is that this code is never being run.  Try adding a "MessageBox("Fish")" just below that line, and then run the map.  Do you get a fish?  If not, it's because this code is never being run!


With regard to removing seedlings, the command is bugged.  It's suggested to avoid using it until A&R get a chance to fix it.  :>

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #33 on: July 14, 2011, 03:23:28 PM »
Well, you're right! It wasn't running, but everything else around it was running. I moved it up a few lines and it ran fine. Don't know why. I'm getting very good at tracing errors, now. HA!

As for the RemoveSeedlings command, I saw you using it in Extreme PWN LAZORZ!!12 and thought I could get away with it, too! Foolish NOOB!!

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #34 on: July 14, 2011, 04:10:14 PM »
Hmm, I did use it there..

Seems like I did it this way:

(run as part of a continuous loop)
Code: [Select]
if GetAsteroid(69):GetNumSeedlings(0) > 0 then
GetAsteroid(69):RemoveSeedlings(0,1)
end

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map
« Reply #35 on: July 31, 2011, 03:36:38 PM »
Wanted: A few volunteers with time to play with my first map and make suggestions to get it ready for prime time. Each game lasts between 5 and 10 minutes (usually even less), and you'll randomly compete against 1 to 3 factions. Since I'm the only playtester I can't tell if it is too hard, too easy, fun, or boring. Any feedback at all would be most helpful.

zn00p

  • Seed
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
Re: My First Map- Trouble already!
« Reply #36 on: July 31, 2011, 04:59:25 PM »
i'd like to betatest ...

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #37 on: July 31, 2011, 07:56:48 PM »
Great! I sent you a PM.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #38 on: July 31, 2011, 07:57:27 PM »
Add me too, now I got two maps to beta test, but I dun' care :P

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #39 on: August 01, 2011, 04:36:17 AM »
I admire people making their first/second/third map :S

Why? They got the creativity I lack of. I'm doing more structured and pre-done things...

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #40 on: August 17, 2011, 06:13:44 AM »
Has anyone else encountered this problem or know of a solution?

On a map I'm working on, one asteroid refuses to allow seedlings to be sent to another asteroid that is well within sending range. SeedlingCap is not an issue and it will send to other asteroids. Other asteroids will send to this asteroid, but for some reason these two asteroids will not work together. When I drag the mouse over to it, the arrow disappears but the "number of seedlings" is still there. When I release the mouse button, the number flashes as if it accepted the transfer, but nothing ever happens. There is another pair of asteroids on the other side of the map with the same condition, but with no other similarities. I'm assuming the problem lies with the sending part and not the receiving part, but of course it could be anything.  Anyone else ever experienced this? Any ideas?

I'm thinking a solution will be to just put another, third, asteroid in the mix, but that is messy and doesn't answer the underlying question.

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #41 on: August 17, 2011, 07:58:30 AM »
I broke it! I tried adding another asteroid (number 31) and now I keep getting an error message that the system is "out of memory". So the third asteroid is not an option. Well, if I'm running that close to the memory limit of Eufloria at least now I know what I can and can't do. The game is running fine, otherwise, but I guess I just put too many goodies in the map. Could that be the cause of the sending problem? If so, why does it only affect those 2 pairs of asteroids?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #42 on: August 17, 2011, 01:13:08 PM »
Well, did you set the aster SendDistances in levellogic? 'cause it might do that asteroids that weren't in range will not be able to be sent to. I guess you prevent this by setting the senddistance REALLY BIG in LevelSetup and ur good to go. If thats not the problem, we'll have to work on it...

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #43 on: August 17, 2011, 02:45:03 PM »
Yes, the send distances were set in Level Logic. I really think it has something to do with reaching the memory limit imposed by Eufloria. This map uses a LOT of memory as noted, and I'm not sure I can reduce it and still have the features I want so I'll just have to live with it. I added the MIA and it was a very enjoyable game so it's not going to be a show-stopper if I can't get those asteroids to work with one another.

Just out of curiosity I'm going to disable the memory-hogging functions and see if that makes a difference...I'll let you know the result.

I sure wish I was a coding genius like you or Annikk or Hitman or all you other guys so I could make super-efficient algorithms!

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #44 on: August 17, 2011, 03:58:42 PM »
The amount of memory the game uses is determined by the size of send distances of all asteroids at the end of LevelSetup, after the game has made any automatic send distance adjustments so that all asteroids are reachable by others.

For a non-accurate example that should hopefully give you an idea of how it works..

If the furthest any asteroid can reach is X = 5000, Y = 5000 then the game might use 200 megs.
If it's X = 6000, Y = 6000, or X = 10000, Y = 10000, the game might use 400 megs (ie it doubles in size)
If it's X = 15000, Y = 15000, the game might use 800 megs.

And so on.


One trick to try to reduce the amount of memory the game uses, is to ensure your asteroids are overall centered around the origin (x = 0, y = 0).

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #45 on: August 17, 2011, 04:21:53 PM »
What about the sizes of arrays? I'm using several arrays for drawing and also doing a lot of reading/writing of the arrays. I think I read LUA can handle very large files but what about Eufloria?  Well, I'll try reducing the map scale, too. Right now, the largest send distance is slightly over 20,000. Fortunately, I have a scaling variable so I can easily adjust that.  The center of my map is very close to 0,0. I'll experiment and figure it out!

So, is there a limit on the amount of memory the game can use, or is that a limit of my hardware?

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #46 on: August 17, 2011, 04:30:44 PM »
You could try setting the priority for Eufloria to High/Realtime in taskmanager (You did say you have Windows?). That may have an effect, though...

"The threads of a real-time priority class process preempt the threads of all other processes, including operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive."

That may not have an effect on the memory usage though.

I think this function, if run after creating your asteroids, will shift every asteroid so that the center of your map is on (0,0).
Code: [Select]
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
« Last Edit: August 17, 2011, 05:04:34 PM by Pilchard123 »

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #47 on: August 17, 2011, 06:47:07 PM »
WELL! Using my map-scaling variable, I decreased the scale incrementally and finally was able to get one of the asteroid pairs working properly! After further reduction, I was able to get the other pair working as well. What a relief! Pilchard, my map was already centered so I didn't need to use your great solution. Now I need to see if I can duplicate the memory-error message by adding more asteroids. Funny, but I had resigned myself to the limitations and actually was starting to be satisfied with the balance, so I guess a lot more tweaking is now in order.

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!

Thanks to all for your continued knowledge-sharing. :D

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: My First Map- Trouble already!
« Reply #48 on: August 18, 2011, 12:39:05 AM »
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 know exactly what you mean!  It's incredibly exciting when you make a massive breakthrough..

Glad to hear things are going well.  :>

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #49 on: August 18, 2011, 12:50:21 AM »
Yeah, like when I solved the IO problem and my personal question of how to find the Angle difference between  two points, I was mega happy!

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #50 on: August 22, 2011, 12:29:47 PM »
I need someone to Beta-test a new map who is willing to provide more feedback than - "I won" or "nice map". At this point, I'm mainly interested in tweaking the difficulty level. Apparently, I am completely incompetent at judging map difficulty or am just plain terrible at this game. My last two maps I judged to be hard, but the Beta-tester says that they breezed through as if there was no opposition whatsoever. I find this astonishing, frankly. So, I am looking for more volunteers who can provide a meaningful evaluation and analyze strengths and weaknesses in the map layout, asteroid strengths, etc., or at least describe their play-through experience in a way which would allow me to determine what I need to do to make the map harder or easier as the case may be. Any map-designer or player willing to help out in this regard, or know of someone who fits that description?

Following those thoughts, it occurs to me that it would be nice if there were a cadre of volunteers willing to Beta-test new maps prior to public release- people who are able to articulate specifics dependent on what the map-designer is looking for. When someone develops a new map and would like it Beta-tested, they would have a list of committed testers available to choose from rather than depending on someone who only wants to try out something out of boredom, and who then fails to provide any feedback. I'd like to see a separate post consisting of a list of volunteers. Does anyone think that is possible, or a good idea? There seem to be a lot of members of this forum , but just a tiny percentage ever post any comments.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #51 on: August 22, 2011, 05:23:09 PM »
I won, nice map. :P

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #52 on: August 22, 2011, 05:51:31 PM »
Yeah! Alright...

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #53 on: September 25, 2011, 11:19:55 AM »
Is there any way to convert text in a table array into a string?

For example:


Starting array is :         a ={[1] = "x", [2] = "y", [3] = "z",}

then eventually apply a command like -

print(a)

with the result of

"xyz"

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #54 on: September 25, 2011, 04:42:02 PM »
I'd prolly use something like

a={"x", "y", "z", "1", "2", "3"}

for i in ipairs(a) do
    toprint = toprint + a[ i] --no space in index box, this is just to avoid bbcode fails
end

print(toprint)

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #55 on: September 26, 2011, 10:55:03 AM »
Hmmm. I may be in over my head on this one. However, you've given me an idea of another solution to try if I can't figure this out. I'll let you know. I'm still trying to make heads or tails of polyplates!

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #56 on: September 27, 2011, 04:19:59 AM »
Polyplates didn't really work, I don't think. I might go back and make it better, I might not.

The ipairs() thing is fairly simple; it just iterates over an array until it hits a nil element. It's not perfect, but it's plenty good enough for most things.

The example I posted up there will itreate of the array a until the first nil element. The output should be xyz123   .

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #57 on: September 27, 2011, 08:54:01 PM »
Well that is simple, then. It won't work for my needs, but you still gave me an idea to try as soon as I finish up elsewhere.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: My First Map- Trouble already!
« Reply #58 on: September 28, 2011, 04:21:01 AM »
You can also use table.getn(a) to iterate until the last element, regardless of whether there any nils.

for i = 0, table.getn(a) do
...
...
...
end

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #59 on: September 28, 2011, 07:49:22 PM »
Oh that looks promising. I test it out. Thanks.

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #60 on: January 09, 2012, 02:22:59 PM »
I'm having another problem I can't figure out:

Rather than assigning player seedlings to an asteroid, I'm allowing the game to randomly populate an asteroid at the start. For some reason, that asteroid is shrunken down to a tiny radius, and the asteroid stats revert to a straight 50% value. The assigned radius and stats in LevelSetup are being overridden on the player asteroid. . The send distance is still good, however. All other asteroids are normal. Does anyone know why this is happening or how to overcome it? I'd like the player to spawn on a random asteroid each time they play.

collapsoul

  • No Intel Inside
  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 54
Re: My First Map- Trouble already!
« Reply #61 on: January 09, 2012, 03:46:36 PM »
I'd like the player to spawn on a random asteroid each time they play.
What if you try to control it manually?

Function prototypereturn typeDescription
GetRandomAsteroid()AsteroidGet any asteroid in the current game, at random.
GetRandomRangeAsteroid(start, end)AsteroidGet 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()AsteroidGet 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)AsteroidGet an empty asteroid from the given range of asteroid IDs.

They should work at LevelSetup stage, at least first of them does

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #62 on: January 09, 2012, 06:29:42 PM »
I wasn't sure how to actually use these functions to solve my dilemma and was not having any success, so I checked to see if someone used one in a map. After searching a dozen or so I found Mihhaelo's Night Stalkers map where he used GetRandomRangeEmptyAsteroid. Copying that, I seem to have solved the problem. It works like a charm! Thanks for the suggestion- it's a great relief. Now I can move on to more fun parts of finishing a new map.

Lost Seedling

  • Shrub
  • ***
  • Thank You
  • -Given: 9
  • -Receive: 30
  • Posts: 205
Re: My First Map- Trouble already!
« Reply #63 on: July 13, 2012, 03:10:15 PM »
Since there is so little activity on the forum and I don't have time to make a new map, I thought I'd post my very first experimental map for those itching for something new. It was originally made primarily as a learning tool for myself so I could learn about LUA, and although I abandoned it's development long ago, it is playable.

Despite many attempts, I was never able to make the gameplay satisfactory. I wanted to make a "King of the Hill"-type map, but found it too difficult to overcome the game's innate desire to expand rather than hold a specific asteroid. I could artificially replicate that behavior, but then had trouble balancing the difficulty level so as not to be too easy or too difficult for the player. I also wanted to experiment with visual indicators the player could use to monitor the game's progress. I tried to make a map that could be played in a short period of time, and that would also be relatively fast-moving in it's gameplay.

Give it a whirl. It will randomly pit the player against 1 to 3 opponents. You may find it a challenge- or not.
« Last Edit: November 30, 2018, 10:16:10 AM by Lost Seedling »