Author Topic: What are you working on? :D  (Read 36380 times)

0 Members and 1 Guest are viewing this topic.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: What are you working on? :D
« Reply #285 on: June 28, 2011, 10:13:50 AM »
IAIv3 will appear eventually, but I'm lacking motivation for that right now, partly because I'm knee-deep in the 3D engine, but mainly because nobody has programmed an AI that can beat it yet.  :P

If someone makes an AI that can take on IAI in a fair fight, I would have to do something about that!

Still, noted... next IAI must be more efficient with clock cycles.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #286 on: June 28, 2011, 03:08:20 PM »
Ok, I'll build an AI I hope can give your AI a kicak in the back :P

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #287 on: June 28, 2011, 05:04:55 PM »
I wonder:

How do you create a function that can be changed in-game... or I mean that has changeable fields, like for example GetAsteroid(id).Radius = 1000. The GetAsteroid is the function and after the dot comes the field I change, but how do you set up your own changeable function? So I make a function called Something() with arguments x,y and then how do I set up the function to change the x and y in-game?

dragoonreas

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #288 on: June 28, 2011, 05:35:38 PM »
I think what you're looking for might be the Lua equivalent of a class.

I actually used the page linked above and this page when I was figuring out how to re-writing annikk's Gravity Template into a class. You can download it from this post and have a look if you want. The 400 something line function called DynamicGravityEngine at the bottom is the class, and there's actually also a nested class (a class within a class) called GravityAsteroid in there too.
« Last Edit: June 28, 2011, 05:40:07 PM by dragoonreas »

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #289 on: June 28, 2011, 06:10:33 PM »
Thanks, I'll be reading it, but first I'm going to play TF2 :D

Bonobo

  • Achiever
  • Old Oak
  • ****
  • Thank You
  • -Given: 79
  • -Receive: 8
  • Posts: 630
  • Was born, still alive.
    • German Mac Mailing Lists
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #290 on: June 28, 2011, 07:51:45 PM »
@dragoonreas: You’re BACK?! How nice to see you veteran mapper again here :)
Google+
Do you play Go? (aka iGo aka Baduk aka Weiqi)

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #291 on: June 28, 2011, 07:59:27 PM »
The text is surprisingly long, so I forget one part before I start reading another one D:

EDIT:



THERES ANOTHER LINK :O

EDIT 2:

I have... Alot to learn! :D
« Last Edit: June 28, 2011, 08:13:57 PM by Aino »

dragoonreas

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #292 on: June 28, 2011, 08:17:30 PM »
@dragoonreas: You’re BACK?! How nice to see you veteran mapper again here :)
Thanks :)

To be honest though I never really left, I was just in lurker mode due to how much Uni work I've been getting… and being introduced to World of Warcraft probably didn't help either.

The text is surprisingly long, so I forget one part before I start reading another one D:
It's probably going to take more than one read through to understand, especially if you haven't read any of the previous sections. I think looking at the code in the second link may actually be prove more helpful than reading all the stuff in the first link (at least it was when I first came across it).

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #293 on: June 28, 2011, 08:26:54 PM »
Hmm, gotta ask you:

Does this work:

Code: [Select]
Units = {}{}
?

But I do use:

Code: [Select]
Units = {}
Units[NumberofBases] = {}
for i = 1,NumEnemies+1 do
Units[NumberofBases][i] = 0
end

though inside of the self array:

Code: [Select]
local self = {

BaseNumber = NumberofBases
Position = {

X = x
Y = y

}
Owner = 0
Units = {}
Units[NumberofBases] = {}
for i = 1,NumEnemies+1 do
Units[NumberofBases][i] = 0
end

}
:)
« Last Edit: June 28, 2011, 08:32:19 PM by Aino »

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 904
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #294 on: June 28, 2011, 08:55:34 PM »
DR, did you know that according to massiveonlinegamer, in October last year, Azeroth had a population of approx. 12mil? That's somewhere betwwen the population of Chad and Zimbabwe, or Ohio and Pensylvania states. (data according to mog, from Activision and Wikipedia)
« Last Edit: June 28, 2011, 09:05:18 PM by Pilchard123 »

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #295 on: June 28, 2011, 10:27:26 PM »
Hmm, when I try to run this:

Code: [Select]
function LevelSetup()
Globals.G.Asteroids=0
Globals.G.EnemyFactionsMin=0
Globals.G.EnemyFactionsMax=0
SetBackdropColour(0,0,0)
AddAsteroid(0,0)
Globals.Flowers.Available = 0
Initialization()
BasicSaveFolder = "C:\\EufloriaSaves\\"
end

function LevelLogic()
GetAsteroid(0).Radius = 0
GetAsteroid(0):Hide(1)
GetAsteroid(0):SetVisible(1,false)
end

function Initialization()

NumberofBases = 0
Data = {}

end

--[[function AddBase(x,y)

NumberofBases = NumberofBases + 1

Data[NumberofBases] = {

ID = NumberofBases
Position = {

X = x
Y = y

}
Owner = 0
Units = {}
Units[NumberofBases] = {}
for i = 1,NumEnemies+1 do
Units[NumberofBases][i] = 0
end
Draw = true
Production = math.random()

}

end

function GetBase(id)

local self = {

ID = Data[NumberofBases].ID
Position = {

X = Data[NumberofBases].Position.X
Y = Data[NumberofBases].Position.Y

}
Data[NumberofBases].Owner = 0
Data[NumberofBases].Units = {}
for i = 1,NumEnemies+1 do
Data[NumberofBases].Units[NumberofBases][i] = 0
end
Data[NumberofBases].Draw = true
Data[NumberofBases].Production = math.random()
}

end

function LevelDraw()

if NumberofBases > 0 then

for i = 1,NumberofBases do

DrawSprite(7,GetBase(i).Position.X,GetBase(i).Position.Y,1,1,1,1,50)

end

end

end

function ScreenDraw()

end]]

Uncommented, it crashes D:

EDIT:

Here, fixed the calling in GetBase(), but still crashing :/

Code: [Select]
function LevelSetup()
Globals.G.Asteroids=0
Globals.G.EnemyFactionsMin=0
Globals.G.EnemyFactionsMax=0
SetBackdropColour(0,0,0)
AddAsteroid(0,0)
Globals.Flowers.Available = 0
Initialization()
BasicSaveFolder = "C:\\EufloriaSaves\\"
end

function LevelLogic()
GetAsteroid(0).Radius = 0
GetAsteroid(0):Hide(1)
GetAsteroid(0):SetVisible(1,false)
end

function Initialization()

NumberofBases = 0
Data = {}

end

function AddBase(x,y)

NumberofBases = NumberofBases + 1

Data[NumberofBases] = {

ID = NumberofBases
Position = {

X = x
Y = y

}
Owner = 0
Units = {}
Units[NumberofBases] = {}
for i = 1,NumEnemies+1 do
Units[NumberofBases][i] = 0
end
Draw = true
Production = math.random()

}

end

function GetBase(id)

local self = {

ID = Data[id].ID
Position = {

X = Data[id].Position.X
Y = Data[id].Position.Y

}
Data[id].Owner = 0
Data[id].Units = {}
for i = 1,NumEnemies+1 do
Data[id].Units[id][i] = 0
end
Data[id].Draw = true
Data[id].Production = math.random()
}

end

function LevelDraw()

if NumberofBases > 0 then

for i = 1,NumberofBases do

DrawSprite(7,GetBase(i).Position.X,GetBase(i).Position.Y,1,1,1,1,50)

end

end

end

function ScreenDraw()

end
« Last Edit: June 28, 2011, 10:30:30 PM by Aino »

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #296 on: June 28, 2011, 10:53:55 PM »
I think I'll make this a little better after I'm done with what I'm going to work on :)

dragoonreas

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #297 on: June 29, 2011, 12:04:40 AM »
Hmm, gotta ask you:

Does this work:

Code: [Select]
Units = {}{}
?
That piece of code looks like you're trying to assign two empty tables to the variable Units. If you had a coma between to two pairs of brackets I know that Units would get assigned the first empty table and the second would be discarded (as described here), but as you've got it I would have to guess it's syntactically incorrect and would throw and error.

But I do use:

(click to show/hide)

though inside of the self array:

(click to show/hide)
:)
That's almost right. Here's the section on Matrices and Multi-Dimensional Arrays… and HERE is the contents page for the Lua site I seem to like spamming links for (go forth and explore! I'm sure you'll learn heaps of stuff, I know I did. ;)).


DR, did you know that according to massiveonlinegamer, in October last year, Azeroth had a population of approx. 12mil? That's somewhere betwwen the population of Chad and Zimbabwe, or Ohio and Pensylvania states. (data according to mog, from Activision and Wikipedia)
I didn't know that, but I'm not surprised :P


Hmm, when I try to run this:

(click to show/hide)

Uncommented, it crashes D:

EDIT:

Here, fixed the calling in GetBase(), but still crashing :/

(click to show/hide)

I'm a bit busy at the moment, but after just glancing over it I'd suggest you try implementing some accessor and mutator methods (also know as getters and setters), rather than trying to use the variables directly. That second link in my original post on privacy should tell you about these kind of methods and why it's good to use them. ;)

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #298 on: June 29, 2011, 12:18:19 AM »
Thanks, you're lots of help :D

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 21
  • Posts: 1,492
  • They'll eat you next!
  • Eufloria: Yes
Re: What are you working on? :D
« Reply #299 on: June 29, 2011, 12:43:46 AM »
God damnit, I question MYSELF more questions which I can't answer before looking at a code for 5 mins, then after I leave the code I'll probably ask myself the same question, which takes me 5 mins to solve while looking at the same code...

I wondered how I could add and get a base information, I can just do newBase() and inside have a local function that is named getBase, but how do I make it return the stuf I want. Like in Eufloria, you have GetAsteroid(id).Owner, this is an example... you also have Radius and SedDistance and Position and Attributes... How do you do it, mind explaining me when you're not busy? I can wait :)