Author Topic: Level design/ Code questions from a beginner  (Read 16061 times)

0 Members and 1 Guest are viewing this topic.

AWS

  • Achiever
  • Arboreal Being
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 274
Re: Level design/ Code questions from a beginner
« Reply #60 on: June 21, 2010, 09:32:54 PM »
to anyone who knows, alex, annikk, ???

may i ask a question?

sometimes when i start a custom map of mine, it decides to give the player and the enemy very similar colours. 9 times out of 10, it will give, say a medium blue for me and a slightly lighter blue for the enemy, making identification that much harder. its not a super big deal, BUT, after a while , i begin to wonder why it does this, why only sometimes do i get a nice lime green pitched against a scary red, and how the code for such things is done?

any ideas anyone??? i could really do with having a greater team colour differentiation.


AWS

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #61 on: June 22, 2010, 08:12:08 AM »
Colour assignments for enemy empires are random.
The player can choose their own colour from the main menu.

Controlling the colours of enemy empires is on my wish list for new scripting commands... :>

AWS

  • Achiever
  • Arboreal Being
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 274
Re: Level design/ Code questions from a beginner
« Reply #62 on: June 22, 2010, 03:34:56 PM »
oh excellent. then it is also now on my list.
i also had a thought that it might be worth exploring howto mae the send distance not radial, but rather eliptical. it might make for a more narrative style of level design. not personally my cup of tea, heavy narrative levels, but it crossed my mind about having say, an oval shaped radius rather than a purely circular one.
?

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 13
  • Posts: 1,035
Re: Level design/ Code questions from a beginner
« Reply #63 on: June 24, 2010, 09:39:53 AM »
Sorry - unlikely to happen! Empire colours is much more likely though.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #64 on: June 24, 2010, 10:52:41 AM »
Eliptical send distances would make some of the maths for the AI engine a lot more complicated.. :p

Here's hoping for specifiable empire colours.. :>

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: Level design/ Code questions from a beginner
« Reply #65 on: June 29, 2010, 08:52:40 PM »
Hello every body  :D

I wonder how it's done
We have a number 1 and number 10 and
I want that he between that numbers choose a number
and put in to Z or something
but it must always on a time of 10sec or more..... be change or something
with that output Z

i hope it will work xD

then put you the z on a energy, strength or speed
AddAsteroidWithAttribs(x, y, energy, strength, speed)

and that is a idea as for the fun " a unstable asteroid"

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: Level design/ Code questions from a beginner
« Reply #66 on: June 30, 2010, 12:19:18 PM »
Yeah, that should be possible...

1. Create an asteroid.
2. Pick a time interval.
3.Every 10 secs. or whatever, change the attributes of the asteroid.

(click to show/hide)

EDIT AGAIN :Code works now.

PROS: This code can be used for all your asteroids, can have any interval and can destabilize all of the asteroids attributes at once, or none, or whatever.
CONS: The timing is a little unreliable, because the block to change the attributes are not always checked at exactly the right time, hence checking >=, not ==. Higher intervals will make the discrepancy less obvious.

EDIT YET AGAIN: math.random() must have arguments that are integers. If you want it to randomize between 0-1, then use math.random(), otherwise use math.random(lower number multiplied by a power of ten to make it an integer, higher number multiplied by a power of ten to make it an integer)/the power of ten that you used. EG - math.random(50, 75)/100 would output between 0.5 and 0.75. math.random(500, 755)/1000 would output between 0.5 and 0.755.
« Last Edit: June 30, 2010, 01:05:48 PM by Pilchard123 »

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: Level design/ Code questions from a beginner
« Reply #67 on: June 30, 2010, 07:06:46 PM »
hmmm it dont work something i forgotten
can you help my?

(click to show/hide)

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: Level design/ Code questions from a beginner
« Reply #68 on: July 01, 2010, 01:03:55 PM »
Yeah, there's a few things wrong there.

Your LevelSetup() code:
(click to show/hide)

LevelSetup() is perfectly ok, although you might want to add globals to it, like your how many asteroids and empires you want, so I'd change your LevelSteup() to be:
(click to show/hide)

LevelLogic() is a little more broken.
Your code:
(click to show/hide)

This should really be something like:

(click to show/hide)

An explanation:
GetGameTime() cannot have anything in the brackets. In your code GetGameTime(10) was invalid. Assuming you want to have asteroid 0 change every 10 seconds, you would use Roid0UnstableTimer = GetGameTime() + 10.
In the if...then statement, you would also use Roid0UnstableTimer = GetGameTime() + 10.

Also, you wrote it so that there was nothing to say when to check if the time should be checked. Eufloria would never evaluate if GetGameTime >=10, so the asteroid would not change. Placing it in a while GameRunning() do block meant that it would be checking nearly all the time.


In case that doesn't make sense, I'll make a template thingy and post it.

EDIT: HERE IT IS[/code]
« Last Edit: July 01, 2010, 02:02:48 PM by Pilchard123 »

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: Level design/ Code questions from a beginner
« Reply #69 on: July 01, 2010, 06:10:52 PM »
XD i am a men if 21years xD

hmmm i do understand but somethings go wrong, i have a rerror
can not load "(0)"
resoures/maps/totall.lau:9: unexpect symbol near')'

but i see its not working also?
can you send a lua file?

(click to show/hide)
« Last Edit: July 01, 2010, 06:16:50 PM by w4tc »

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: Level design/ Code questions from a beginner
« Reply #70 on: July 01, 2010, 08:27:33 PM »
Globals.G.Asteroids=() is wrong. It should be Globals.G.Asteroids=(4) because there are 4 asteroids in your map. If there was a different number of asteroids, for instance 21, then you would use Globals.G.Asteroids=(21).

That's the only thing I can see wrong with it, but when I fix that, either my game crashes, or I get a message complaining about a zero-length vector, and I don't know what they are.

So, I'd ask annikk, Alex or Rudolf. They'll understand how the unstable asteroids work, and might be able to help you.

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: Level design/ Code questions from a beginner
« Reply #71 on: July 01, 2010, 08:58:50 PM »
I change it to to four
and also here a game crashs
I hope that annikk, Alex or Rudolf can help us

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Level design/ Code questions from a beginner
« Reply #72 on: July 02, 2010, 08:49:37 AM »
You need a coroutine.yield() to close off your While loop.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: Level design/ Code questions from a beginner
« Reply #73 on: July 02, 2010, 01:52:15 PM »
Oh yeah...I'll just go and add that to the template...

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: Level design/ Code questions from a beginner
« Reply #74 on: July 02, 2010, 05:15:06 PM »
but i dont see the change???
I think that AddAsteroidWithAttribs(3000,0, 0.3,0.3,0.3) takes priority over the othere code of change of unstable asteroids level logic?

or must the output code putting in the value of energy speed or strength
and how??
« Last Edit: July 02, 2010, 08:57:21 PM by w4tc »