Notice: Home alone tonight?
Topic: Strategy/tactic game AI
+Anonymous A — 5.1 years ago #57,984
https://youtu.be/m9_6dY7RCVI
how does AI in game like this work
+Anonymous B — 5.1 years ago, 33 minutes later[T] [B] #602,709
Here is one approach (which this game more than likely uses, because it is incredibly simple to implement):
- The game keeps track of the player position's and each of the enemy's positions.
- If the player is within range of sight of the enemy (calculated using a simple distance formula), start moving the enemy towards the player.
- Otherwise move the enemy a random direction / distance.
- If the enemy is adjacent to the player, begin attacking.
- Player & enemy take turns to attack.
- health = health - hitpoints
- If enemy.health == 0 remove enemy
- If player.health == 0 game over
- Rinse and repeat
(Edited 55 seconds later.)
·Anonymous A (OP) — 5.1 years ago, 18 minutes later, 51 minutes after the original post[T] [B] #602,711
@previous (B)
wow.. this is very helpful! thanks alot. What is this simple distance formula though?
·Anonymous B — 5.1 years ago, 8 minutes later, 1 hour after the original post[T] [B] #602,712
@previous (A)
> wow.. this is very helpful! thanks alot. What is this simple distance formula though?
Simple distance: this game has everything aligned to a grid, so you simply count the number of squares between the player and the enemy (in both horizontal and vertical directions) and add them together:
distance = abs(px - ex) + abs(py - ey)
(where abs is the absolute value)
Actual distance: nowadays it's no longer necessary to avoid using square roots in calculations (because machines are much faster) so you'd calculate distances more accurately in modern games using Pythagoras:
distance = sqrt( (px - ex)^2 + (py - ey)^2) )
·Anonymous A (OP) — 5.1 years ago, 42 minutes later, 1 hour after the original post[T] [B] #602,715
@previous (B)
wow... this is cool. It make sense to me of sorts... How can you be so sure of this though?
you prototype games casually?
·Anonymous B — 5.1 years ago, 16 minutes later, 1 hour after the original post[T] [B] #602,716
@previous (A)
> How can you be so sure of this though?
Because it's basic high school maths and also common knowledge in games development. Have you even completed high school yet? If not, then relax, you have plenty of time ahead of you to learn all this stuff bit by bit.
(And you really shouldn't be on this website either, by the way - it's full of dodgy old men).
> you prototype games casually?
Yes, and professionally.
·Anonymous A (OP) — 5.1 years ago, 35 minutes later, 2 hours after the original post[T] [B] #602,718
@previous (B)
> basic, common
didnt have elaborate sciency math in highschool... i did some unity tutorial and its "basic" didnt involve game AI to make a functioning game.
> plenty time
not sure bout that, im trying to master it asap.
> dodgy old men
what s that
well anyway, i am very grateful of your knowledge so do you think there s any goodbook that contains line by line codes for sich games above and to make something that's "finished"?
+Anonymous C — 5.1 years ago, 2 hours later, 5 hours after the original post[T] [B] #602,728
@previous (A)
@previous (A)
> > basic, common
> didnt have elaborate sciency math in highschool... i did some unity tutorial and its "basic" didnt involve game AI to make a functioning game.
> > plenty time
> not sure bout that, im trying to master it asap.
>
>
> > dodgy old men
> what s that
>
> well anyway, i am very grateful of your knowledge so do you think there s any goodbook that contains line by line codes for sich games above and to make something that's "finished"?
@previous (A)
> > basic, common
> didnt have elaborate sciency math in highschool... i did some unity tutorial and its "basic" didnt involve game AI to make a functioning game.
> > plenty time
> not sure bout that, im trying to master it asap.
>
>
> > dodgy old men
>
> well anyway, i am very grateful of your knowledge so do you think there s any goodbook that contains line by line codes for sich games above and to make something that's "finished"?
IF you found something published it will have copyright. You don't want to end up in jail,unless you're gay and want man on man sex.
·Anonymous A (OP) — 5.1 years ago, 9 hours later, 14 hours after the original post[T] [B] #602,791
@previous (C)
what the hell?
·Anonymous A (OP) — 5.1 years ago, 33 minutes later, 15 hours after the original post[T] [B] #602,798
@602,728 (C)
u mean my pictures?
·Anonymous C — 5.1 years ago, 14 hours later, 1 day after the original post[T] [B] #602,818
@602,791 (A)
No. You wanted to find code already written that you could just steal.
·Anonymous A (OP) — 5.1 years ago, 7 hours later, 1 day after the original post[T] [B] #602,910
@previous (C)
huh? nono, more like books about gamedev... they usually contain finished codes and equations so i can know that it actually works...then i can just iterate the thing to my engine or write them one by one if it is the same language lol
maybe books like "game engine architecture" or "game programming gem"
but im looking specifically for AI or tetris so....
·Anonymous A (OP) — 5.1 years ago, 40 seconds later, 1 day after the original post[T] [B] #602,911
@602,818 (C)
basically, yeah, since i know books has written codes as basic references
·Anonymous C — 5.1 years ago, 2 minutes later, 1 day after the original post[T] [B] #602,912
@previous (A)
Yes alas nothing you can use to really make a video game.
I live close to a city with a huge team of video game designers. One if not the largest company. Based on the parking lot alone, it takes several 1000 coders to design one game and that is without AI at the moment.
·Anonymous A (OP) — 5.1 years ago, 31 minutes later, 1 day after the original post[T] [B] #602,913
@previous (C)
not even EA houses that big of a coder for fifa these days
internet has downsized most things
+Anonymous D — 5.1 years ago, 9 minutes later, 1 day after the original post[T] [B] #602,914
@previous (A)
EA 9800 Employees word wide. Nothing bigger than them. You can even see jobs that are open and there are a lot currently.
·Anonymous A (OP) — 5.1 years ago, 33 minutes later, 1 day after the original post[T] [B] #602,917
@previous (D)
yea well thats their entire games, including bioware.
bioware doesnt house that many people and they make mass effect
·Anonymous B — 5.1 years ago, 7 hours later, 1 day after the original post[T] [B] #602,936
@602,912 (C)
> it takes several 1000 coders to design one game and that is without AI at the moment.
No, not coders. Even triple A games normally have a small team of actual programmers (10 - 20) which is further subdivided into groups of 3 or 4 to handle various aspects of the code. The rest of the big team (more like 100s, not 1000s) is concerned with other aspects of the game, like level design, conceptual art, support, community management, marketing, accounting etc. Most games are created by very small teams of 2-4 people who do everything, and they almost always are forced to use an existing game engine (like Unity or Unreal) and 3D modelling software (Blender) to minimize complexity.
·Anonymous B — 5.1 years ago, 22 minutes later, 1 day after the original post[T] [B] #602,939
@602,718 (A)
> do you think there s any goodbook that contains line by line codes for sich games above and to make something that's "finished"?
There are plenty of good books and resources online that contain complete or near-complete demo source code. However you will struggle to find something that is "finished", because when people go that extra mile and invest a great deal of time and effort into producing a completed product which they can then sell, they tend to keep all the source closed, at least until a certain amount of time has elapsed, and they can no longer profit from it.
You're in luck though. id software, who wrote the Doom & Quake series, has published the source code for the first four of their engines. id Tech 1 can be found here:
https://github.com/id-Software/DOOM
It is well worth spending time (a few weeks) diving into if you want to learn how to structure a game engine, because it is extremely well written (John Carmack is a genius). But be warned, it is big and complex, and if you don't have a solid grounding in programming techniques (and mathematics) you will not be able to understand much. id Tech 4 - the engine for Doom 3 BFG - is here:
https://github.com/id-Software/DOOM-3-BFG - this is over 600,000 lines of dense C++ code. This website should help you unravel it:
https://fabiensanglard.net/doom3_bfg/index.php ... Good luck!
·Anonymous A (OP) — 5.1 years ago, 32 minutes later, 1 day after the original post[T] [B] #602,945
@previous (B)
yes. i know doom and carmack but those are too advanced. and not tactic/strategy as i said.
sorry if you could recommend something more in line i guess.
i appreciate the links v much
+Anonymous E — 5.1 years ago, 8 hours later, 2 days after the original post[T] [B] #602,966
@previous (A)
> yes. i know doom and carmack but those are too advanced. and not tactic/strategy as i said.
>
> sorry if you could recommend something more in line i guess.
> i appreciate the links v much
this cat you posted is a lolcat. i have seen them on the computer net.
·Anonymous A (OP) — 5.1 years ago, 5 hours later, 2 days after the original post[T] [B] #602,983
·Anonymous A (OP) — 5.1 years ago, 7 hours later, 2 days after the original post[T] [B] #603,022
@602,966 (E)
what r u trying to say
Start a new topic to continue this conversation.
Or browse the latest topics.