[GameMaker Studio] Neural Network in Game Maker Studio – part 1

After studying the basic concepts, it’s our time to create our own neural network. We will be using Game Maker Studio to make a neural net for target tracking.

The task is to make the V-shaped arrows learn whether to turn left or right depending on its direction (degrees) to the yellow square. Simple, right?


Before you continue reading, please do take in mind that I am not an ML expert. This tutorial is my personal approach to machine learning. This guide aims to help you to get started in creating your own ML algorithm in game maker studio faster.


You can also download the project on github by pressing the button below:


Without further ado, let’s jump into creating our neural network.


The first thing we have to do is to set up our neural network! To make it simple, the neural network we will create will have one hidden layer with one input and output nodes, and the training method that we will be using will be genetic algorithm.

It’s now time to create our neural net. First thing’s first, create a new project. Create a new script and we’ll call it scr_nn_create, we are going to set up our neural network using arrays like so:

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

///scr_nn_create()

il = 1; //How many input nodes
hl = 4; //How many hidden layer neuron
ol = 1; //How many output layer neuron
    
//Input Layer
    for(var i=0; i<il; i++){
        inputs[i] = 0;
    }
    
//Hidden Layer    
    for(var i=0; i<hl; i++){    
        neurons[i] = 0;
        for(var j=0; j<il; j++){
            weights[i, j] = 0;
        }
    }
    
//Output Layer    
    for(var i=0; i<ol; i++){
        outputs[i] = 0;
        for(var j=0; j<hl; j++){
            output_weights[i, j] = 0;
        }
    }
Where:
  • inputs – the input value that we are going to feed our neural network.
  • neurons – holds the computed value of a neuron
  • weights – the weight of a neuron in the hidden layer. These are the knobs that will be modified later on through training process to produce our desired results.
  • outputs – output values of the neural network
  • output_weights – the weight of a neuron in the output layer

We’ll create another script, we’ll call it scr_nn_initialize. This script will set a random value for each weights.

///scr_nn_initialize()

//Weights for hidden layer
    for(var i=0; i<hl; i++){       
        for(var j=0; j<il; j++){
            weights[i, j] = random_range(-1.0, 1.0);
        }
    }
    
//Weights for output
    for(var i=0; i<ol; i++){      
        for(var j=0; j<hl; j++){
            output_weights[i, j] = random_range(-1.0, 1.0);
        }
    }  

The main structure for the neural net is complete!

But wait! We are not done yet. We still have a lot to do. Now that we have successfully set up our neural network. We will now create objects that will serve as the body for the brain. See you on the next post!

[출처] https://highleapstudios.wordpress.com/2019/09/24/neural-network-in-game-maker-studio-1/

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
151 [flutter (플루터 앱 개발)] flutter pocketbase 사용법 2탄(회원가입) file 졸리운_곰 2024.06.10 272
150 [flutter (플루터 앱 개발)] flutter pocketbase 사용방법 1탄(초기설정) file 졸리운_곰 2024.06.10 242
149 [게임 일반] 카드 덱 이미지 (트럼프 카드) 졸리운_곰 2024.05.27 224
148 [flutter (플루터 앱 개발)]Flutter - InAppWebview Communication (인앱웹뷰로 웹과 앱 양방향 통신하기, 자바스크립트 커뮤니케이션) file 졸리운_곰 2024.04.13 274
147 [flutter (플루터 앱 개발)] flutter - fvm 적용하기 (Futter Version Management) file 졸리운_곰 2024.04.11 189
146 [flutter (플루터 앱 개발)]Using Flutter FVM in Windows & MacOS file 졸리운_곰 2024.04.10 294
145 [flutter (플루터 앱 개발)] Flutter version management in Visual Studio Code with FVM 졸리운_곰 2024.04.10 231
144 [flutter (플루터 앱 개발)] pHp backend with flutter file 졸리운_곰 2024.03.18 350
143 [flutter (플루터 앱 개발)] [Flutter] fvm으로 Flutter 버전 관리 졸리운_곰 2024.03.17 203
142 [firebase v9] 파이어베이스 버전9 시작하기 - firebase v9 file 졸리운_곰 2023.12.24 309
141 [ Firebase ] v9부터 크게 달라진 사용법들 모아보기 file 졸리운_곰 2023.12.24 268
140 [게임 개발 일반] 콘솔은 어려울수록, 모바일은 쉬울수록 '돈' 쓴다 file 졸리운_곰 2023.10.30 264
139 [Unity] How to Create a Metaverse dApp with Unity : Unity로 Metaverse dApp을 만드는 방법 file 졸리운_곰 2023.09.13 397
138 [게임 개발 일반] 게임 초기 기획서 작성 방법 졸리운_곰 2023.07.16 250
137 [GameMaker Studio] Neural Network in Game Maker Studio – part 4 file 졸리운_곰 2023.07.07 462
136 [GameMaker Studio] Neural Network in Game Maker Studio – part 3 file 졸리운_곰 2023.07.07 413
135 [GameMaker Studio] Neural Network in Game Maker Studio – part 2 file 졸리운_곰 2023.07.07 506
» [GameMaker Studio] Neural Network in Game Maker Studio – part 1 file 졸리운_곰 2023.07.07 378
133 [construct2] HOW TO REMOVE THE SCREEN POWERED BY CONSTRUCT 2? file 졸리운_곰 2023.03.24 266
132 [flutter (플루터 앱 개발)] How to use Flutter’s Rest API file 졸리운_곰 2023.03.21 349
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED