Euflorium: The Eufloria Community

Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: Alex on December 08, 2008, 05:21:01 AM

Title: Level design demystification / scripting guide - XML
Post by: Alex on December 08, 2008, 05:21:01 AM
This thread pertains to the old XML level design functionality - all still present, just completely superceded.

Here is a breakdown of the current level design abilities given to levellers :)
Currently supported tokens (some are overloaded and have the same function, just choose a word and stick with it):
[/li]
[li]Conditions
These are pretty complicated already. The conditions set winning and losing conditions for the game. They are designated by the tags "win" and "lose" and have one attribute, "if", which contains a script that tells the game about the condition.
Conditions have a source team, a target team, a noun, a verb, and a comparison.
Currently supported tokens:
These are fairly intuitive to mix and match. Mostly you can just write what you feel. The game will be won if all win conditions are satisfied. The game is similarly lost if all lose conditions are satisfied. If you don't specify any conditions, the game defaults to having the player's team win if all other races are defeated and lose if no asteroids are owned.

[/li]
[li]Teams
Use the "empire" tag to specify a team:
Code: [Select]
 <empire team="2" grace="99000" />
Title: Re: Level design demystification / scripting guide
Post by: Alex on December 08, 2008, 05:38:52 AM
OK, and if you want to debug your scripting...

WARNING: READING THIS AND ACTING ON THE CONTENTS MAY COMPLETELY RUIN THE GAME EXPERIENCE FOR YOU
or enhance it - hehe

[spoiler:mlfanmmo]Press left Ctrl and D to enter developer mode.

While in debug mode:
Press D to cycle through debug information layers. The conditions should appear in the top right. Also the game will list the log of the level parsing, so maybe you can tell what went wrong if it doesn't work.[/spoiler:mlfanmmo]

[spoiler:mlfanmmo]Not had enough yet huh? Okay.
The +/- keys on the number pad will accelerate and decelerate the passage of time in the game.[/spoiler:mlfanmmo]

[spoiler:mlfanmmo]I can see you want the whole deal. Okay.

Press F2 to open the variable directory. This contains a list of variables sorted into directories. You can change stuff here and load/save them to settings files and level files. It's usually better to edit the levels by hand. Remember to back up your stuff. You can always just reinstall the game if you want to restore defaults.

Press F3 to open the graph window. This will show you various graphs for different things in the game - it's intended to give an idea of how certain elements of the game change with respect to attributes.

Press F4 to open the debug window. This lets you turn off/on visibility of different teams, and lets you spy on entities by clicking on them with the middle mouse button. You can also deactivate the camera limit and the sending limit here.

Some windows are resizable - just drag the edges like you would in other GUIs.[/spoiler:mlfanmmo]
Title: Re: Level design demystification / scripting guide
Post by: metarinka on December 08, 2008, 01:39:11 PM
thanks soooo much!

this gives me the motivation to kick out those remaining levels I've got stored away!
Title: Re: Level design demystification / scripting guide
Post by: dbltnk on January 09, 2009, 11:05:32 PM
I removed the write protection both on the game folder, the ressources folder and all files in them. There level files should be editable now. Still, both edit++ and the windows editor tell me that I can't write there. Using Vista x64. Any suggestions?
Title: Re: Level design demystification / scripting guide
Post by: Alex on January 10, 2009, 04:38:01 AM
That's really odd - and I've had other people note that Dyson crashes or has other bad behaviour on Vista owing to write permission. I've not become familiar with Vista so I don't know where it's appropriate for games to store their data. I'll look it up. Thanks for the info.
Title: Re: Level design demystification / scripting guide
Post by: dbltnk on January 10, 2009, 05:39:02 AM
Somehow the write protection on the folder doesn't get removed, even if Vista says so. I can save the edited level file in another spot with no problems. Maybe you should just get rid of that write protection for your next release.
Title: Re: Level design demystification / scripting guide
Post by: crazeh.monkeh on January 10, 2009, 12:28:17 PM
Quote from: "dbltnk"
I removed the write protection both on the game folder, the ressources folder and all files in them. There level files should be editable now. Still, both edit++ and the windows editor tell me that I can't write there. Using Vista x64. Any suggestions?

Hey, I'm running Vista too. It crashes for me sometimes if it is saved in the C: drive (where most apps get installed) because it tries to write or modify files inside of it's folder, and vista won't let it. Alex had me move the folder to my desktop and that fixed it, but your documents folder should be fine, too. I just installed mine on a thumb drive and it is fine. I can even edit levels and everything.

On a side note, I think if you set the planet to static the planet starts exactly there, but the swarm and trees don't. They start slightly off of the planet, and you have the roots of the plants growing off in space, but the trees themselves are on the planet. I THINK it is because they are on static. I could have messed something else up, but I think that is what it was. Yup. I just switched to not static and it fixed it. Idk. Maybe it just happens to me.

Anyway, Alex, you get to see my level soon, lol.

*Edit: also, is there a way to start some kind of a timer? Like "after this event, wait such and such time, them do this". I can think of a few ways that I could use it, but if not, I'll live.
Title: Re: Level design demystification / scripting guide
Post by: Alex on January 11, 2009, 02:44:18 AM
Quote from: "crazeh.monkeh"
Quote from: "dbltnk"
I removed the write protection both on the game folder, the ressources folder and all files in them. There level files should be editable now. Still, both edit++ and the windows editor tell me that I can't write there. Using Vista x64. Any suggestions?

Hey, I'm running Vista too. It crashes for me sometimes if it is saved in the C: drive (where most apps get installed) because it tries to write or modify files inside of it's folder, and vista won't let it. Alex had me move the folder to my desktop and that fixed it, but your documents folder should be fine, too. I just installed mine on a thumb drive and it is fine. I can even edit levels and everything.

On a side note, I think if you set the planet to static the planet starts exactly there, but the swarm and trees don't. They start slightly off of the planet, and you have the roots of the plants growing off in space, but the trees themselves are on the planet. I THINK it is because they are on static. I could have messed something else up, but I think that is what it was. Yup. I just switched to not static and it fixed it. Idk. Maybe it just happens to me.

Anyway, Alex, you get to see my level soon, lol.

*Edit: also, is there a way to start some kind of a timer? Like "after this event, wait such and such time, them do this". I can think of a few ways that I could use it, but if not, I'll live.
That sounds like a pretty serious bug - I didn't know that was happening. Could you email me the XML of the file that's showing that happen? Cheers!

There are timers in there, but their only current function is to start spawning seedlings at random. Hopefully we'll expand on this as we add new stuff and get level editing more integral.
Title: Re: Level design demystification / scripting guide
Post by: ccjav on January 11, 2009, 06:17:57 AM
Ya im also running this on vista, and having the write problem... the main issue for me is when you try to change the options and hit done, it crashes the game. A way to get around the fact you cant save scripts than save them, save them somewhere else (desktop perhaps?) and then drag and drop the file to replace it.
Title: Re: Level design demystification / scripting guide
Post by: Alex on January 11, 2009, 03:31:59 PM
Vista sounds like it sucks :D

OK, will have to fix this. Cheers guys.
Title: Re: Level design demystification / scripting guide
Post by: sfericz on January 11, 2009, 04:44:14 PM
First, let me say congrats on the IGF submission! I have only played one level and I can say it is well deserved. I also want to thank the developers for this unique game. Having the ability to create community member levels will keep this game alive for awhile I believe.

This thread is a great resource, thanks! Once I get to finish the game :P

I'm glad I found this community before you guys hit big (because you will) I find the best resources to a game can be found in the community members. In example.... metarinka has already made seven new levels?? wOw... People like that are great to have with a new gaming company.

Quote from: "Alex"
Vista sounds like it sucks :D

OK, will have to fix this. Cheers guys.
I will try to reproduce these errors on my vista O/S....I have only been able to reproduce the (Start-up, Maximizing before loading elements) bug. But I think I read where you know what causes that already.

I think these errors might have something to do with the UAC on Vista, I have mine (plus a lot of other stuff) turned off and can not reproduce the Write to folder/file error.
Title: Re: Level design demystification / scripting guide
Post by: wogan on February 14, 2009, 08:39:15 AM
Yeah, Vista. Lovely OS.

You can solve all those write problems by running the game as Administrator (right-click the executable). This means that you'll have to explicity launch it this way every time you run Dyson, which isn't preferable.

But in C#:

(http://arcane.co.za/dyson-res/solveproblem2.jpg)

I'm not sure what OS you're coding on, but you should be able to explicitly set IO permissions. This will require user authorization when installing on Vista, but that's preferable to having to launch as admin each time. And it shouldn't affect other OSes at all.
Title: Re: Level design demystification / scripting guide
Post by: Alex on February 14, 2009, 07:30:05 PM
Ah cheers Wogan, I didn't know about that!

What I've done currently is get the game to move the user-editable files into My Documents/Game data/Dyson (on windows only), but the jury's now out on whether that's preferable to the method you've just described.
Title: Re: Level design demystification / scripting guide
Post by: crazeh.monkeh on February 15, 2009, 02:45:42 AM
I'm voting on Wogan's idea if you can get it to work. I like having all of my programs either in Program Files or on a Flash Drive (Which is what I'm doing with it now. It keeps it nice and portable. Lol)
Title: Re: Level design demystification / scripting guide
Post by: Alex on February 15, 2009, 06:19:00 AM
I'm inclined to agree, c.m!
Title: Re: Level design demystification / scripting guide
Post by: raincloud on March 04, 2009, 02:08:13 PM
How are you guys making new levels? Is there a level editor, or is it just a matter of editing the .level files in Notepad?
Title: Re: Level design demystification / scripting guide
Post by: topmo3 on March 04, 2009, 02:42:00 PM
Alex, can you cast light on "AI" section of .level? i mean MINTICK, MAXTICK... and may be there are other parameters.
thanx
Title: Re: Level design demystification / scripting guide
Post by: smokinjoe18 on March 04, 2009, 04:20:44 PM
Could you also shed light on the min/max figures you can input as i noticed when you set the cost for a tree to 30 for eg the seedlings disappear but you dont get the dyson tree ending up with no seedlings and no trees ....

So some of the settings people are putting in might be having a negative affect ???
Title: Re: Level design demystification / scripting guide
Post by: Alex on March 04, 2009, 04:57:58 PM
How are you guys making new levels? Is there a level editor, or is it just a matter of editing the .level files in Notepad?

At the moment yes - we're planning an editor though.

Alex, can you cast light on "AI" section of .level? i mean MINTICK, MAXTICK... and may be there are other parameters.
thanx

Min and max tick affect how often the AI makes decisions. If you reduce these to something quite small, in thoery the game should get more difficult. Make them big to make the AI very slow to 'think'. Not that it really thinks that hard at all.

Could you also shed light on the min/max figures you can input as i noticed when you set the cost for a tree to 30 for eg the seedlings disappear but you dont get the dyson tree ending up with no seedlings and no trees ....

So some of the settings people are putting in might be having a negative affect ???

That sounds like a bug to me. I'll check it out. Cheers. But yes - editing these level files could easily break the game when you play them, so you will currently need to thoroughly test your levels! :)
Title: Re: Level design demystification / scripting guide
Post by: raincloud on March 07, 2009, 10:14:57 AM
Is there a way to set how big the attack radius is for a particular asteroid? I'm messing around with these levels in Notepad, and I've figured out how to put asteroids in particular places, and I know how to change the energy, strength, and speed of the seedlings they produce, but I don't know how to choose the farthest possible distance that seedlings can be sent from an asteroid.

For example, I could make a large asteroid with strong seedlings, but maybe I want those seedlings to only be able to travel a short distance. (it might be difficult to escape the strong gravity of a big asteroid, after all.)
Title: Re: Level design demystification / scripting guide
Post by: Alex on March 10, 2009, 08:33:08 PM
This is a function of a number of variables.

There is a minimum asteroid size. The additional radius for an asteroid is the sum of each of the products of each attribute with the size boost given for that attribute. This is then fed through a power rule to give the final size for an asteroid.

so it's (IIRC):

added radius = strength * size from strength + speed * size from speed + energy * size from energy

proportion of max radius = added radius / (size from strength + size from speed + size from health)

asteroid radius = minimum radius + power(proportion, asteroid radius power value) * added radius
Title: Couple of Questions
Post by: Unre9istered on March 11, 2009, 10:20:14 PM
Is it possible to make set all of the asteroids stats somehow?  I want to make a level where all of the planets produce fast seedlings, (mostly out of impatience).  I've tried changing the "minspeed" stat but that seems to cause an error. 

Also, is there a way to make more of the neutral asteroids have the gray (team 0) units on them?  I want to make a harder level where all the asteroids are defended.
Title: Another Question
Post by: Unre9istered on March 11, 2009, 10:23:41 PM
One more question:  Is there a reason the AI teams have no limit on how far their seeds can travel?  It's really annoying to have to defend asteroids that are 6 asteroids away from my borders...
Title: Re: Level design demystification / scripting guide
Post by: raincloud on March 12, 2009, 05:22:39 AM
Wow, that's really complicated, why didn't the developers just set up a function where you could set attack radius to 1000 or 500 or whatever you want? It seems so unintuitive to choose attack radii in such a complex way.
Title: Re: Couple of Questions
Post by: Alex on March 12, 2009, 05:56:42 PM
Is it possible to make set all of the asteroids stats somehow?  I want to make a level where all of the planets produce fast seedlings, (mostly out of impatience).  I've tried changing the "minspeed" stat but that seems to cause an error. 
At the moment the stats are equally randomly generated. You can set individual asteroid stats in a level:
Code: [Select]
<asteroid pos="-2500,0" attribs="0.7,0.2,0.3" owner="2" trees="3,1" seedlings="40" static="false"/>change the attribs field.

Also, is there a way to make more of the neutral asteroids have the gray (team 0) units on them?  I want to make a harder level where all the asteroids are defended.
You can do this procedurally by modifying the following variables:
Code: [Select]
  <dir name="GAME">
    <dir name="GREYSPROBABILITY" type="int" value="15" />
    <dir name="GREYSMIN" type="int" value="5" />
    <dir name="GREYSMAX" type="int" value="10" />
  </dir>
Probability is 0 -> 100% chance of greys being created on an asteroid at the start of the game.
min/max are limits on the number of generated enemies.

One more question:  Is there a reason the AI teams have no limit on how far their seeds can travel?  It's really annoying to have to defend asteroids that are 6 asteroids away from my borders...
The reason is that the AI teams are a filthy hack that needs rewriting.

Wow, that's really complicated, why didn't the developers just set up a function where you could set attack radius to 1000 or 500 or whatever you want? It seems so unintuitive to choose attack radii in such a complex way.
We made it like this so that there could be a difference in value between smaller and larger asteroids. I don't think it's unintuitive that larger asteroids allow you to send farther, but it does result in bugs which we do need to address. If you want to set the radius, change the following values:
Code: [Select]
  <dir name="ASTEROIDS">
    <dir name="MINSENDDISTANCE" type="int" value="1000" />
    <dir name="MAXSENDDISTANCE" type="int" value="1000" />
  </dir>
and set them to the same desired value as shown. That should work.
Title: levels I want to build
Post by: Unre9istered on March 14, 2009, 03:23:12 AM
I'm trying to build a level where each time you take an asteroid, more seedlings are added to the remaining enemy asteroids. 
Anyone know if this is possible and if so what the scripting would be for that?

Another idea is an array of asteroids where you need to take a specific asteroid, but if you attack one of the 3 or 4 that you can reach the goal from the rest of the enemy asteroids suddenly become active rather than passive and start to attack you.  Is this possible?
Title: Re: Level design demystification / scripting guide
Post by: raincloud on March 14, 2009, 03:37:16 AM
Thanks Alex! I will try that!
Title: Re: levels I want to build
Post by: Alex on March 15, 2009, 06:33:58 PM
I'm trying to build a level where each time you take an asteroid, more seedlings are added to the remaining enemy asteroids. 
Anyone know if this is possible and if so what the scripting would be for that?

Another idea is an array of asteroids where you need to take a specific asteroid, but if you attack one of the 3 or 4 that you can reach the goal from the rest of the enemy asteroids suddenly become active rather than passive and start to attack you.  Is this possible?
Sadly we don't have enough functionality to do this at the moment. Sorry.
Title: question about grace stat
Post by: Unre9istered on March 18, 2009, 03:28:56 AM
I'm having some problems with the AI stat "GRACE".  I have a level set up where I've created a large number of asteroids with a large number of maxed out enemy seeds on them that I want to go active after a certain period of time.  I tried setting the grace stat to 1000 assuming that gave me a grace period of 1000 seconds to try and take them out.  Instead they are active almost right away.  (I've watched them with the debug mode).  I've now set the grace stat to 99000 and they are still active right away.  I've even put in the "<empire team="2" grace="99000" />" to specifically make them inactive.  Nothing seems to be working...

Any ideas?
Title: Re: Level design demystification / scripting guide
Post by: Alex on March 19, 2009, 05:45:46 PM
Examine the XML for level 3, which has a team with a grace period set. If it's still not working, let me know.
Title: Re: Level design demystification / scripting guide
Post by: Unre9istered on March 19, 2009, 10:24:02 PM
Do you mean this line: " <empire team="2" grace="99000" />"?
I've tried it.  Do I need to specify it for every asteroid I give that team or something?
Title: Re: Level design demystification / scripting guide
Post by: Alex on March 19, 2009, 10:38:47 PM
No, should be for each team... can you post your xml in a new thread?
Title: Re: Level design demystification / scripting guide
Post by: Unre9istered on March 19, 2009, 11:08:36 PM
By XML do you mean the text of the .level file?
Title: Re: Level design demystification / scripting guide
Post by: Alex on March 20, 2009, 01:05:28 AM
yeppers
Title: Re: Level design demystification / scripting guide
Post by: Unre9istered on March 20, 2009, 02:28:53 AM
It's been posted here (http://www.dyson-game.com/smf/index.php?topic=103.0).
Title: Re: Level design demystification / scripting guide
Post by: zero on April 26, 2009, 08:16:12 PM
ctrl (or in my case strg) + D , doesn't show me something in the upper right corner :/
Title: Re: Level design demystification / scripting guide
Post by: Alex on April 27, 2009, 07:37:43 AM
I think I changed the debug mode info button to f12. Try that. After pressing ctrl-d.
Title: Re: Level design demystification / scripting guide
Post by: AUSisp*cry* on May 09, 2009, 05:38:24 PM
1) Is there a way to set the starting view to be of the planet that you control?

2) Is there an E.T.A. of a patch that fixes the comps ability to 'fly' beyond set range?

3) Is there some way i can change the max number of trees for all but certain planets?

4) Is  there a way i can change the cost of defense trees?

5) How would i put in the xml to add seeds to a specific planet without dyson trees every x seconds?

6) Is there a way to set it so that you can only build dyson trees?

7) Is there some way i can set it so that when you cap a asteroid, the tree that you destroyed grows back as the same tree? (e.g. i destroy a defense tree, cap the asteroid, and then have the defense tree start to grow back)

8 ) What do these things do:
     -Checktimer (missiles)
     -anything to do with volume (asteroids)
     -asteroids (game)

Thanks

   -AUSisp*cry*
Title: Re: Level design demystification / scripting guide
Post by: Alex on May 11, 2009, 03:05:36 AM
1) Is there a way to set the starting view to be of the planet that you control?

2) Is there an E.T.A. of a patch that fixes the comps ability to 'fly' beyond set range?

3) Is there some way i can change the max number of trees for all but certain planets?

4) Is  there a way i can change the cost of defense trees?

5) How would i put in the xml to add seeds to a specific planet without dyson trees every x seconds?

6) Is there a way to set it so that you can only build dyson trees?

7) Is there some way i can set it so that when you cap a asteroid, the tree that you destroyed grows back as the same tree? (e.g. i destroy a defense tree, cap the asteroid, and then have the defense tree start to grow back)

8 ) What do these things do:
     -Checktimer (missiles)
     -anything to do with volume (asteroids)
     -asteroids (game)

Thanks

   -AUSisp*cry*

1) If it doesn't, that sounds like a bug. Possibly the camera is just focusing on the first asteroid in the level file - try swapping hte player asteroid with that and see if that fixes it.

2) Not yet - It'll be fixed by the time we release though.

3) Not yet. It's on the list though.

4) Yeah. It should be in the defense structures area of your level xml or default.xml - change the cost value and it should update accordingly.

5) There is a level design feature for this at the moment, but it's not quite what you want. This doesn't work too well at the moment and is just an event for one level. It just makes seedlings pop out of a team's trees every X seconds. I don't recommend using it. We will put stuff like this in later though.

6) No, but if you were to set the cost of a defense tree to like a million seedlings, then that should do it :)

7) Not at the moment.

8) a) how often missiles check for enemies to strike.
b) There are a few sound effects in there that these control - "VOLUME" controls the maximum volume of the ambient asteroid sounds (the radio noises); "CONQUERVOLUME" controls the volume of the sound made when an asteroid is captured; "SENDVOLUME" controls the volume of the noise made when you send seedlings from one place to another.
c) This is the number of asteroids in the belt, which is usually overridden by the levels xml.
Title: Re: Level design demystification / scripting guide
Post by: Vanger on July 21, 2009, 04:50:08 AM
Important!

Do not use "more than" or "less then". The former is always true, the latter is always false.
Use "morethan/lessthan" or "more/less" instead!
Title: Level design demystification / scripting guide
Post by: FemHeink73 on October 16, 2009, 07:15:51 PM
Thank you, I remember making my design for Eggspert and then realising later that I could have made it Champ, after seeing your design
You seem to be able to solve levels that I would deem impossible after seeing them once, I guess I need to take some tips from you
Title: Re: Level design demystification / scripting guide
Post by: Imagamer on October 23, 2009, 07:37:09 AM
I've familiarized myself with xml levels, but as of yet, i can't find a lua level guide. Do you plan on making one soon?

Thanks

Edit: Nevermind, I discovered that you're working on it.
Title: Re: Level design demystification / scripting guide - XML
Post by: ________ on December 22, 2009, 09:15:58 PM
Sorry, is there any way to spawn random asteroids with trees on them? Specifically defense trees.
Title: Re: Level design demystification / scripting guide - XML
Post by: w4tc on January 03, 2010, 01:18:42 AM
how can I move asteroid's?
Title: Re: Level design demystification / scripting guide - XML
Post by: Alex on January 08, 2010, 10:48:02 PM
Moving asteroids in Lua after the setup is potentially dodgy and I've never tried it but could be pretty funny if it worked. I'd have to have a look and don't have time right now.

random asteroids with trees on is no problem ______, start a new thread and i'll post a script later
Title: Re: Level design demystification / scripting guide - XML
Post by: annikk.exe on January 26, 2010, 12:23:01 AM
If there's LUA code to move asteroids, I haven't found it - and believe me I've been looking !

It does seem to be possible to change an asteroid's radius and send distance in Function Level Logic, though.  Send distance works for sure as I have this working in the level I'm working on.  Haven't tried asteroid radius yet, but with the mathematical functions included in the LUA language it should mean it's possible to create asteroids that grow and shrink over time, or depending on how many seeds or trees are on them.  The idea of having "pulsating" asteroids seems pretty cool, and not something I've seen in any levels so far.. :>
Title: Re: Level design demystification / scripting guide - XML
Post by: Rudolf on January 26, 2010, 05:25:25 PM
You can also change the level bakground colour which allows you for example to slowly brighten or darken a level :-)
You could make it conditional on events and let the level colourcode how well you are doing. CRAZY TALK!!!
Title: Re: Level design demystification / scripting guide - XML
Post by: annikk.exe on January 26, 2010, 06:03:22 PM
Yep, you could do a sort of day/night type thing as well.  :>
Haven't tried scripting background colour changes yet, but it's cool to know that this works !  ^_^