Adding AI?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Adding AI?

Post by Eamonn »

If I was making a game, how would I add AI to something like an enemy? I've never done it :P
In case AI means something else in LÖVE, I'm talking about artificial intelligence.

Also, would it be illegal to make a snake clone and put it on the LÖVE forums? I was thinking of making one but I'm not too sure... obviously not using a copyrighted soundtrack and just the concept itself!

Thanks! Any help is appreciated! :D
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: Adding AI?

Post by MadByte »

Link
Sorry but, try searching things on your own. You created ~20 topics in this short amount of time you are
registeried on this forum. Try harder finding what you wanna know. -.-*
User avatar
Hexenhammer
Party member
Posts: 175
Joined: Sun Feb 17, 2013 8:19 am

Re: Adding AI?

Post by Hexenhammer »

Eamonn wrote:If I was making a game, how would I add AI to something like an enemy? I've never done it :P
In case AI means something else in LÖVE, I'm talking about artificial intelligence.
That is a pretty general question. It depends on your engine design. The most basic AI would be some entity having an AI which causes it to chase the player. Assuming the entities in your game world have simple (x,y) positions it would look something like this

Code: Select all

if player.x < self.x then
  self.x = self.x - 1
end

if player.x > self.x then
  self.x = self.x +1
end

if player.y < self.y then
  self.y = self.y - 1
end

if player.y > self.y then
  self.y = self.y +1
end
self (your actor with AI) would now chase the player.. that's some - very basic - AI. There is nothing special about AI code really. Basic principle of a simple AI is that your AI code looks at the world state (here the current position of the player) and reacts to it e.g. by moving the actor the AI controls or making the actor do something else e.g. attack:

Code: Select all

if distance(self, player) == 1 then

 self:attack(player)

end
.. or something like that.
Also, would it be illegal to make a snake clone and put it on the LÖVE forums?
No, game mechanics aren't subject to copyright and there is no patent covering "snake" and there will never be one either (it would be easy to find "prior art").
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Adding AI?

Post by Eamonn »

Hexenhammer wrote:
Eamonn wrote:If I was making a game, how would I add AI to something like an enemy? I've never done it :P
In case AI means something else in LÖVE, I'm talking about artificial intelligence.
That is a pretty general question. It depends on your engine design. The most basic AI would be some entity having an AI which causes it to chase the player. Assuming the entities in your game world have simple (x,y) positions it would look something like this

Code: Select all

if player.x < self.x then
  self.x = self.x - 1
end

if player.x > self.x then
  self.x = self.x +1
end

if player.y < self.y then
  self.y = self.y - 1
end

if player.y > self.y then
  self.y = self.y +1
end
self (your actor with AI) would now chase the player.. that's some - very basic - AI. There is nothing special about AI code really. Basic principle of a simple AI is that your AI code looks at the world state (here the current position of the player) and reacts to it e.g. by moving the actor the AI controls or making the actor do something else e.g. attack:

Code: Select all

if distance(self, player) == 1 then

 self:attack(player)

end
.. or something like that.
Also, would it be illegal to make a snake clone and put it on the LÖVE forums?
No, game mechanics aren't subject to copyright and there is no patent covering "snake" and there will never be one either (it would be easy to find "prior art").
Thank you :)
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
Sheepolution
Party member
Posts: 264
Joined: Mon Mar 04, 2013 9:31 am
Location: The Netherlands
Contact:

Re: Adding AI?

Post by Sheepolution »

Eamonn wrote:In case AI means something else in LÖVE
Nope, it's called the same everywhere.
Eamonn wrote: Also, would it be illegal to make a snake clone and put it on the LÖVE forums? I was thinking of making one but I'm not too sure... obviously not using a copyrighted soundtrack and just the concept itself!
As long as you're not making money off of it, don't worry about copyright. Nintendo is not going to sue you when you're remaking the original Zelda and put it on the forums, unless you're actually selling it.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Adding AI?

Post by Robin »

Sheepolution wrote:Nintendo is not going to sue you when you're remaking the original Zelda and put it on the forums, unless you're actually selling it.
As long as you're not using Nintendo's image and sound assets, original reverse engineered code or things like that.
Help us help you: attach a .love.
User avatar
Sheepolution
Party member
Posts: 264
Joined: Mon Mar 04, 2013 9:31 am
Location: The Netherlands
Contact:

Re: Adding AI?

Post by Sheepolution »

Robin wrote:
Sheepolution wrote:Nintendo is not going to sue you when you're remaking the original Zelda and put it on the forums, unless you're actually selling it.
As long as you're not using Nintendo's image and sound assets, original reverse engineered code or things like that.
You can still get sued, even though you're not selling it? Oh because you're using and sharing something that's not yours right?

Still wondering how Mari0 got away with it..
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Adding AI?

Post by Robin »

Sheepolution wrote:You can still get sued, even though you're not selling it?
Copyright law as shaped by the Berne Convention is not about profit, but about the right of the author to control distribution of their work.
Sheepolution wrote:Still wondering how Mari0 got away with it..
Luck, relative obscurity and more luck.
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Adding AI?

Post by Jasoco »

As long as they aren't selling it, it's a fan game. Super Mario Crossover does the same thing with Mario and a bunch of other Nintendo, Capcom, Konami and other properties. But they do it for fun and not for profit.

Just don't try to charge anyone money or take donations to make the game and you most likely won't have a problem. There were projects in the early 2000s that tried to charge or otherwise take money and got shut down for good reason. If you're just making a silly fan game for people who love these games you should be fine.

I say should because this stuff could change at any time. Usually they're left alone because it's good publicity. But then again there is Nintendo taking advertising money from Nintendo LP's and Sega shutting down accounts that refused to remove LP's of an older game they had just released a sequel to.
Post Reply

Who is online

Users browsing this forum: slime and 1 guest