Post links to projects that have decent Artificial Intelligence here (


#1

If anyone has made a project/game that has impressive code for characters that can detect and dodge attacks or find their way out of traps/rooms or other impressive Ai could you please post a link to your project here with a brief description. I'm sure myself and a few others would be very interested to see the projects and code.

If no one has posted a link after a week, I will have to start making demo projects to show how to make enemies in games that can avoid attacks and other types of behaviour.

@oio @Rawrbear Words of support or wisdom on this topic would be appreciated .


#2

I like your ideas and questions like those of few, if any, others, @Stradyvarious, for the challenges they contain and for the abstract beauty that draws you to them, just the same. You've definitely got a coder's mind like some of the others I've had the pleasure of speaking with from a distance. I hope you'll never lose this habit. That is my most sincere support.

My opinion, for what it's worth, is that this is worth spending some time on. You have seen my rudimentary swarm-follower code by now, I assume. I have been contemplating giving those little guys a touch of AI. What do you think? First of all, is that idea germane to what you're after? Would it be interesting? Worth it?


#3

I'd be very interested in seeing what AI you can give to an individual clone. Like avoiding attacks or finding a way around an obstacle. You remember the problem with the "touches" code I made for the 4 rectangle sensors around a square that already started causing lag with nothing else happening. I'd like to see code from someone that doesn't involve cheating by checking an enemies x-y position wherever it is and make decisions from that data, but makes decisions using a method of detection at close range and have multiple decisions/solutions to the problem.

I'll post some cheating(and non cheating) AI code after a week that could easily be used in projects that have been on Featured which have no discernable AI.


#4

Yeah, I wouldn't probably touch "touches" with a ten-foot pole. It's just too computationally expensive, as Hopscotch is currently coded.

I envision using discrete attractors as the guiding "AI" component. The critters that follow the attractor would still be mindless. That way, you get more of what I'll call... um... maybe an "AI field". What one would probably have to do in the scenario that I envision is guide the unseen attraction/repulsion center or centers around using some kind of heuristic. You have, in that setup, an opportunity both to soft-attract and soft-repel, but you can also enforce hard-masking of regions using positional information, which is, yes, a little tedious, but might be doable. In general, I find that testing for distances of locations is (surprisingly) a LOT faster than using a "touches" block. Am I making any sense? It's just a loose concept, at this point.


#5

I imagine your swarm being used for a hoard of zombies marching around a city until they find some humans to eat/attack. If the player has a long range weapon-value, the zombies can split into 2 groups and use a pincer movement to attack from 2 sides at once. The zombies can be 2 sizes and the group that splinters will be a separate size that can be controlled with size as a %.
Just some vain ideas I have for you.


#6

Cool. You just caused me to think of something... Perhaps, building on the idea of classes of clones, some could be the scouts and signal to the remainder the "come hither". Like... ants! :smile:


#7

You both do long posts!!!!! Now back on topic (sorry)


#8

I'll try to contribute to this topic as much as possible! :wink:


#9

I currently am working on some AI code in a game of mine, but it's not done yet. What would be really interesting and cool is if someone made an AI that would learn, such as what researchers in Japan have done. It would take "experience" from past tasks and it would make educated guesses to preform something it was never programmed to do. Extraordinarily fascinating.


#10

@Stradyvarious
I have been making a turn based fighting game, I have been thinking about a semi random AI but mostly reacting to the players moves (e.g enemy dodges most attacks, but sometimes misses, does not shoot most of the time when you dodge, etc.) but it does have a semi consistent pattern, while still making it possible to out smart it :wink:.

@oio
There is a game on Scratch called "Griffpatch's Tower Defense" and I think form what you are describing that the code could be used for a game like that, if you made one oio style that would look really cool!

I am in oio-long-paragraph-mode :P


#11

Defense* :wink:


#12

Fixed :wink:.


#13

I had an idea a few months ago about a way to make an AI that would make decisions based on patterns of actions by the player on Hopscotch.
Like in a 2d platform-fighting game where each time the player jumps a value increases by 5 and lowers by 1 each second. If that value ever reaches 50 or higher this would show the player likes to jump around allot as their playing style and the NPC AI could focus more on ranged,aerial attacks and not running and attacking on the ground.

When your games ready please post a link. I'm interested in seeing what your AI code has resulted in.


#14

Thats cool that you are interested in coding AI for your turn based game.
When you say the NPC reacts, do you mean like cheating by instantly knowing what button has been pressed or option chosen by the player or detecting when an attack like a fireball is coming close and jump to avoid it. For a turn based game thats entertaining,coding to randomly decide to avoid an attack or not will give the player a sense of achievement and not frustrate the player by never letting them win.:wink:


#15

Yeah, all true points :wink:. Here is a example of the mechanics:
If Player attacks
The enemy has a 3 in 5 chance of dodging an attack
Next turn
Enemy may heal or may attack.

Repeat :smirk:


#16

I made a wall of 3 rectangles on the left side of the screen. I just finished coding "when bumps anything" for two of the walls and lag started with everything slowing down. On the Tynker app I can have 100 ball sprites bouncing realistically with code for Gravity,restitution,friction,torque,density,angular velocity, and linear velocity. Colliding with each other and the edges of the screen with no lag at all.

I feel like giving up when using Hopscotch.
I can't do anything with it lately without the app acting like the world's ending.


#17

You are talking about one of my biggest challenges - especially on an older iPad like mine. And it's not only my trouble. I mean, look at most "games" in Hopscotch! They are rarely quick enough to be on par with most games we like to play. Evidently, Hopscotch is just not optimized for speed. And the only constructive attitude I can take is to look at working with Hopscotch as half being the idea and the code and the other half being optimization for speed. Tediuous, but it really only redefines the puzzle. I reckon, if you can do something in Hopscotch, you're super-resourceful and can probably do it in anything. :slightly_smiling:


#18

Thanks to all the members who liked this topic.
But the topic is asking for links to projects you've made and a brief description of the code for the AI.
So far no one has managed to do this.
@everyone


#19

Mmm I have not coded the AI yet, but I think the code will have very few on-screen detections, mostly off screen values :wink:.


#20

I decided if i'm going to do drawings on Hopscotch i'm going to code organic algorithms. Something like artificial life.
Like the roots of a plant generating or 2 viruses competing with eachother to fill the screen.