디시인사이드 갤러리

마이너 갤러리 이슈박스, 최근방문 갤러리

갤러리 본문 영역

[모드] 모드 제작 참고용 문서들

아이작존스갤로그로 이동합니다. 2019.09.30 12:50:11
조회 59 추천 0 댓글 1
														

CUSTOM VEK AI

Difficulty - MID (Pulling apart base game code required)

Often, the game’s default AI can be improved upon in the case of your particular custom Vek. Fortunately, adding a new AI for your custom Vek is relatively simple. There are two functions which compose Vek AI - scoring for movement and scoring for attacking.

Movement scoring occurs when it is due for the Vek to move. The method will be run for every tile which it is possible for the Vek to move to. It returns a numeric value. The highest value tile will be selected to move to

Attack scoring occurs after the Vek move. The method will be run for every possible tile which the vek can target. Again, it returns a numeric value and the highest value tile will be selected to be attacked.

The vanilla game’s AI scoring functions are very generic, which has benefits and issues. If you do not want to code a complex AI for your enemy, the base game’s standard AI should work fine for most people. However, the downside to this is that enemies with complex attack patterns will likely not attack very effectively. To get a good idea of how the game handles AI functions, check out global.lua lines 340-470, which contains the vanilla scoring functions.


Please note: writing AIs is relatively complex in comparison to other elements such as simply adding pawns. The details of the lua are thin on the ground in this tutorial as they are probably too extensive to effectively cover here. You should be comfortable with figuring out how to do things from the vanilla code before embarking on this. As always, the variable reference list linked at the top of the document is a useful resource.

MOVEMENT AI

Firstly, let’s add this function, which will override the vanilla functions for us, to one of your lua scripts loaded in your mod, probably pawns.lua or wherever you put your pawn declarations.


local originalScorePositioning = ScorePositioning
function ScorePositioning(point, pawn)
local pawnClass = _G[pawn:GetType()]
if (pawnClass.ScorePositioning) then
return pawnClass:ScorePositioning(point, pawn)
end
return originalScorePositioning(point, pawn)
end


This code does not need to be changed, and should be copied and pasted directly into your code.

Now under each enemy where we want our custom AI, we should add a new function called ScorePositioning after the AddPawn() function call. This will be our position scoring function.


function ExampleEnemy:ScorePositioning(point, pawn)
-- lua code
end


You are given two variables in this function - one is point which can be used in Board methods to get details about the tile candidate, and pawn, a C++ pawn instance (NOT a lua Pawn class - to access the Pawn class use _G[pawn:GetType()]) which is the pawn about to be used in movement. I won’t go into too much detail here about the actual coding - just that anything can be contained in here which will be used to calculate the numeric value. Nor will I go into much detail about what is important in an AI, and how to make good ones. Some general things to consider: Accessibility of enemies/buildings from the target tile, if the tile poses a threat to the pawn, whether it’s a corner or edge (generally to be avoided). A lot of useful functions can be found in the vanilla AI methods.

Let’s make a very simple AI for a theoretical pawn called “Magpie”. Its sole purpose is to move to where time pods are on the map. NB this pawn will likely not work at all in a practical game - this is just to illustrate the kind of thing AIs can do.


function Magpie:ScorePositioning(point, pawn)
if Board:IsPod(point) then return 100

else return -100 end
end


All this method will do is check if the tile has a time pod on it - if so it will return a very high number (almost guaranteed to move there), and if not it will return a very low negative number (almost guaranteed to not move there)

TARGETING AI

Targeting AI acts slightly differently, in that it is a subroutine of the weapon it acts upon and not a global method like movement AI is. But we can utilise it fairly similarly. We won’t need to add an override function like we did to the top of pawn.lua for our movement function as we can just override it on a weapon by weapon basis. The function we are going to want to override is called ScoreList(). We will do it like so, after your weapon declaration.


function ExampleWeapon:ScoreList(list, queued)
-- lua code
end


We are given two variables here again. This time it is list, a SkillEffect object of the weapon, and queued, a boolean value defining whether the weapon does queued damage (true) or instant damage (false). The first thing we are going to do is iterate through list, which will allow us to get and evaluate each spaceDamage object in the SkillEffect object.


function ExampleWeapon:ScoreList(list, queued)
local score = 0

for i = 1, list:size() do

local spaceDamage = list:index(i)

-- do something to score it

end

return score

end


Please note that you should obviously keep a score count outside of the loop, so it won’t be overwritten with each spaceDamage object iterated through. The target of the attack can be ascertained using spaceDamage.loc. Another useful variable that can be used is Pawn - A C++ pawn instance of the pawn which is currently using the weapon.


Some things which should be considered in writing a good targeting AI: how strong the targeted pawn is, what team the targeted pawn is on, will the shot kill or just wound?



====

이거는 VEK AI 관련한 내용.

이거 좀 읽어보고 더 적어줄까 했는데 어디 좀 나가봐야해서 다음에.


출처.

https://docs.google.com/document/d/1BPB9nB4hK1k3RAKns0j8rvLA6GIW3_m4Z7LpUelfMcM/edit#

추천 비추천

0

고정닉 0

0

댓글 영역

전체 댓글 0
등록순정렬 기준선택
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 말머리 제목 글쓴이 작성일 조회 추천
2853 설문 연인과 헤어지고 뒤끝 작렬할 것 같은 스타는? 운영자 24/04/22 - -
2855 AD [나이트 크로우] 1주년 기념 역대급 이벤트 진행 중 운영자 24/04/25 - -
1274 공지 세이브 관리 프로그램 [1.1v 2019.12.31] [6] 사슬새갤로그로 이동합니다. 19.12.29 1740 15
418 공지 공략모음집 [2] 아이작존스갤로그로 이동합니다. 18.10.25 5643 6
244 공지 파일럿 티어표. [19] 아이작존스(49.142) 18.06.19 10559 24
3 공지 인투 더 브리치 관련 사진과 내용을 올려주시기 바랍니다. 아이_시스갤로그로 이동합니다. 18.03.03 631 5
3389 일반 언페어 플레이 사상 최악의 억까 [1] 인갤러(211.192) 04.22 25 0
3388 일반 첫턴부터 뭐 이런 억까가 인갤러(211.192) 04.17 27 0
3387 일반 1섬 퍼펙트는 하겠는데 2섬은 못하겠음 불건전유니갤로그로 이동합니다. 04.10 42 0
3386 일반 야짤 달린다 ㅇㅇ(39.116) 04.09 51 3
3385 일반 용암타일 살아있는 유닛을 불태웁니다. 이거 용암타일 위에 있으면 즉사냐? [1] 인갤러(121.167) 04.04 36 0
3384 일반 "묘수"의 기준이 뭘까 [1] 인갤러(211.192) 03.26 70 0
3382 일반 초보인데 이거 피해없이가능한가요? 인갤러(59.86) 02.25 109 0
3381 일반 하드-언페어 제니스/블리츠 중 누가 더 최약체냐 [1] 인갤러(222.109) 02.05 103 0
3380 일반 최신버전 1.2.88애 호환되는 한글패치가 없네 [2] ㅇㅇ갤로그로 이동합니다. 01.16 186 0
3379 일반 언페어 깼뜨아아 [1] 인갤러(119.203) 01.10 158 3
3378 일반 언페어 첫섬 1라운드 역대급 운 ㅇㅇ갤로그로 이동합니다. 01.06 117 0
3377 일반 와 꿀잼 ㅇㅇ(222.114) 23.12.15 122 4
3376 일반 이거 언페어 깰 수 있음? [1] ㅇㅅㅇ(210.221) 23.12.08 177 0
3375 일반 와 이거 어떻게 못깨냐 인갤러(122.202) 23.12.08 129 0
3373 일반 노랑해파리 이거 씹 호로벡이네 ㅇㅅㅇ(210.221) 23.12.04 90 0
3372 일반 스틸 유도카 왤캐 구림? 인갤러(175.196) 23.12.03 87 0
3371 일반 폭탄 건물취급 안하네 ㅇㅅㅇ(210.221) 23.12.02 53 0
3370 일반 씨발 형님들 제가 너무 생각없이 하나요 [5] ㅇㅇ(220.80) 23.12.01 187 0
3369 일반 스틸 주도카 어려울거 각오했는데도 빡세네 [1] ㅇㅇ(119.201) 23.11.27 110 0
3368 일반 점수라는게 [1] ㅇㅇ(115.95) 23.11.15 73 0
3367 정보 시간여행자 스킬작 생략하는 법 (PC) [1] 빗소리P갤로그로 이동합니다. 23.11.13 449 7
3364 일반 초반에만 그런진 모르겠는데 게임이 좀 좆같네 [3] 아서스메네실갤로그로 이동합니다. 23.11.07 225 0
3363 일반 씹뉴비인데 분대 미스트이터 열어봤는데 구리냐 [3] ㅇㅇ(121.134) 23.11.05 175 0
3362 일반 이거 어케함 [2] 인갤러(182.231) 23.10.30 108 0
3360 일반 나오기만 하면 이거보다 강한 장비가 없는듯 (+버그 찾음) 아이린쟝갤로그로 이동합니다. 23.10.21 218 0
3359 일반 부스트 중첩 됨? [2] ㅇㅇ(61.43) 23.10.20 118 0
3358 일반 해일 억까ㄷㄷ 인갤러(121.176) 23.10.18 97 0
3357 일반 혹시 모르는 사람 있을지 모르는데 인갤러(221.167) 23.10.18 116 1
3356 일반 엄청 잘 풀렸네 1턴만에 보스잡음 ㅇㅇ(218.237) 23.10.17 78 0
3355 정보 수리 플랫폼 소환(?) 유닛으로도 임무 달성 됨 [3] ㅇㅇ(121.176) 23.10.14 129 2
3354 일반 이지는 진짜로 이지였네;; 아이린쟝갤로그로 이동합니다. 23.10.14 140 0
3353 일반 최종섬 2페이즈 왜 시작하자마자 8턴됨? 버그임? [1] 인갤러(218.237) 23.10.13 92 0
3352 일반 1시간 15분으로 쉬움 클리어 인갤러(39.125) 23.10.12 60 0
3351 일반 모바일은 클라우드 안됨??? 아이린쟝갤로그로 이동합니다. 23.10.09 45 0
3350 일반 게임 존잼인데 이제 하는사람 별로없는건가 [3] 인갤러(218.235) 23.10.04 257 0
3349 일반 에픽판 클라우드 저장 안됨? 인갤러(220.119) 23.09.19 49 0
3348 일반 아 클라우드 없음 Twosolve갤로그로 이동합니다. 23.09.19 73 0
3347 일반 이거 아직도 넷플 있어야 모바일 가능임? [2] ㅇㅇ(116.123) 23.09.18 301 0
3346 일반 아 시발 ㅇㅇ(124.57) 23.09.09 78 0
3345 묘수풀 도움!!!! 김다울갤로그로 이동합니다. 23.09.08 117 0
3344 일반 이겜 코인은 어캐 모음? [2] 인갤러(39.122) 23.09.05 142 0
3343 일반 제니스가드 이거 깨는법좀 제발 [3] 인갤러(210.110) 23.08.30 298 0
3342 일반 뉴비 처음으로 클리어함 [1] 인갤러(182.215) 23.08.19 127 2
3341 일반 늒비 이 대사 왤케 슬픔 [2] 인갤러(182.215) 23.08.15 374 1
3340 일반 시발 망할 첫턴겜 인갤러(58.143) 23.08.11 131 1
3339 일반 이번에 모바일 시작한 뉴비인데 [4] ㅇㅇ(106.101) 23.08.11 411 0
3337 일반 이런뭔 시발 [3] ㅇㅇ(112.149) 23.07.28 233 5
3336 일반 이겜제작회사 요새 모하나요? [1] 니지노사키미라이갤로그로 이동합니다. 23.07.27 294 0
3335 일반 시작 메크가 공중이냐 아니냐 꽤 큰듯 [3] ㅇㅇ(112.149) 23.07.27 215 0
3334 일반 언페어는 솔직히 실력보단 분대빨 and/or 운빨인듯 ㅇㅇ(221.167) 23.07.09 175 0
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2