• Register

This member has provided no bio about themself...

RSS My Blogs

DuengonGainers Dev. Diary - BattleSystem and some improvements 24.04.2016

genaray Blog

Hey there !

Its sunday evening and time for another dev diary. First i wanna apologize that there wasnt any dev diary last sunday but i was busy and it was also a holiday ^^. Soo there somethings i changed and added into DuengonGainers this week. First i changed the camera, before it jumped to the players position, now it smoothly lerps to it. It looks much better now ^^ i also improved the autotiling system, there still a few bugs but less than before :) Local multiplayer is also added now, so you are able to play with your friends in your Lan :D. Anything else ? Yea i finally added some placeholder animations for the standard enemy and imrpoved his ai :) But the biggest change i made is the Battlesystem.

There tons of different battlesystems. Look at games like Minecraft or binding of isaac. For now i made a simple one without any perks or buffs or anything like that, later ill add that. Heres a simple demonstation how it works :

HitboxPic 1


So its very simple, both entitys got one hitbox. On each tick i check for a collision between both or an overlap, if theres one and the Player also presses the Left mouse key the life of the enemy is reduced. The player can also take damage, when his hitbox overlaps with the enemy one the enemy hits him every 2.5f seconds until the players hitbox isnt overlapping anymore. This also would work with bullets or magic attacks or something like that but i think its good for now :) Both (player and ai) got an attack animation too but both are currently placeholders for better ones ^^ Heres a little video about it (some bugs arent fixed yet) :

DuengonGainers Updated BattleSystem

So i think thats all for now ! Have a great week and thanks for your attention :D

DuengonGainers Dev.Diary - Little Video - 28.04.2016

genaray Blog

Hey there !

It isnt yet sunday i know and this isnt going to be a whole Dev. Diary, for those who interessts i made some nice changes and fixed some stuff heres a little video ^^

DuengonGainers Camera and Character Update

Thats all for today, see you sunday for the real Dev. Diary !! :D

DuengonGainers Dev. Diary - Basic enemy ai 24.04.2016

genaray Blog

Hey folks !

Its sunday evening and time for an little Dev. Diary ! So like i said last week this diary is about basic enemy ai's. But what is a artificial intelligence ? There isnt so much to explain about ai's. Short explained and ai is a computer operated player that someone has programmed into a game. The behavior and the decesions of an artificial intelligence depending on the programmer. It also is often associated with modern robotic technology.

But lets get back to a basic game ai. To illustrate the behavior of an ai, lets say our enemy is a little coackroach :

schabe


When you are going to program an little easy artificial intelligence you need to give something like a soul to it. With other words : you need to give it a behavior. And that depends on you ! If you want you can make this normally tiny and fast animal ot a real giant with enormous power. But lets say it should behave like a normal cockroach. So it is very tiny, fast, easy to kill and philoprogenitive and that are the behaviors of itself. And depending on the behaviors it makes decesions. Here is an example of the behavior tree :

behavior tree

I think the picture above is easy to understand. It all starts with being idle. When the player is far far way the cockroach is goind to sleep and if else the player is near it it runs around to find a good place for hiding. But when the player found and attacks the cockroach it makes new little cockroaches. That sounds easy right ? But when programming an artificial intelligence you cant draw little textboxes or even pictures and it works, no you need to code it.

A good way to make such a state behavior tree is using enums. If you dont know what a enum is, heres a link Enums in java. So you can define different states into one enum, that may look so :

public enum EnemyState implements State<Enemy>{
	
		MOVE_HOME(){
			
			@Override
			public void update(Enemy arg0) {
				
				float distanceToHome = arg0.calculateDistance(arg0.myHome.getPosition());
				
				if(distanceToHome <= 200){
					
					System.out.println("IM BACK HOME, HONEY!");
					
					arg0.stateMachine.changeState(SLEEP);
					
				}
				
			}
			
		},
	
	    RUN_AWAY() {
			@Override
			public void update(Enemy arg0) {
				
				if(arg0.distance > arg0.triggerDistance){
					
					int chanceOfGettingHome = ThreadLocalRandom.current().nextInt(0, 1 + 1);
					
					System.out.println("Awww he runs away, what to do now?");
					
					switch (chanceOfGettingHome) {
					
					case 0:
						
						arg0.stateMachine.changeState(SLEEP);
						
						break;
					case 1 :
						
						arg0.stateMachine.changeState(MOVE_HOME);
						
						break;

					}
									
				}
				
			}
	    },
	    
	    ATTACK(){	    		    	
	    	@Override
			public void update(Enemy arg0) {
				
				System.out.println("ATTACKING");
				
			}	    	
	    },

	    SLEEP() {

			@Override
			public void update(Enemy arg0) {
				
				if (arg0.distance < arg0.triggerDistance) {
					
					System.out.println("Awake, im running now!!");

					arg0.stateMachine.changeState(RUN_AWAY);
					
				}
	
			}
	    };
	    
	    @Override
	    public void enter(final Enemy enemy) {
	    	
	    	System.out.println("ENTER NEW STATE : "+enemy.stateMachine.getCurrentState());
	    	
	    	if(enemy.stateMachine.getCurrentState().equals(EnemyState.SLEEP)){
	    		
	    		System.out.println("Sleeping Now!");
	    		
	    		enemy.setBehavior(null);
	    		enemy.steeringOutput.linear.setZero();
	    		enemy.steeringOutput.setZero();
	    		enemy.body.setLinearVelocity(0f,0f);
	    		enemy.body.setAngularVelocity(0f);
	    		enemy.body.resetMassData();
	    		
	    	}
	    	else if(enemy.stateMachine.getCurrentState().equals(EnemyState.RUN_AWAY)){
	    		
	    		System.out.println("Running away!");
	    		
	    		enemy.setUpBehaviors(enemy.gameScreen.target);
	    		
	    		enemy.setBehavior(enemy.letsGoThere);
	    		
	    	}
	    	else if(enemy.stateMachine.getCurrentState().equals(EnemyState.MOVE_HOME)){
	    		
	    		System.out.println("Moving Home now...");
	    		
	    		enemy.setUpBehaviors(enemy.myHome);
	    		
	    		enemy.setBehavior(enemy.letsGoThere);
	    		

	    		enemy.timer.scheduleTask(new Task() {
					
					@Override
					public void run() {
						
						enemy.stateMachine.changeState(EnemyState.SLEEP);
						
						System.out.println("Time over");
						
					}
					
				}, 6f);
	    		
	    	
	    	
	    	}
	    }

	    @Override
	    public void exit(Enemy enemy) {
	    	
	    	System.out.println("EXIT OLD STATE");
	    	
	    }

	    @Override
	    public boolean onMessage(Enemy enemy, Telegram telegram) {
	        // We don't use messaging in this example
	        return false;
	    }
}

Thats the whole enemy state enum of my little ai i made this week. But only the enum wont do much. You also need an class contains the behavior of the enemy, like movement, speed and so on. Depending on the situation you easily can change the state of the enemy. And that works great ! The basic enemy of DuengonGainers is using this code snippet above. It allows him to move move if the player is 500 pixel near him, sleeps if hes far way and also go to his startposition if the player runs away.

I really would like to show it ingame, but currently i havent any image or animations for this tiny basic ai so instead of showing ingame footage i made a little guide this week. Until next sunday i try to make some animations for the ai, local server connections and also first try to port this game to mobile phones ^^

I hope you understood and enjoyed it, if you have any question just ask and by the way i would be happy about feedback ! Thanks for your attention and have a great week ! See you next week :D






DuengonGainers Dev. Diary - Whats Autotiling ? And how to do that- 17.04.2016

genaray Blog

Hey guys !

Its sunday evening, the sun is shining, its beautiful weather outside and what im doing ? I just thought its time for my first dev-diary. So what did i do in this whole week ? I personally expected more from me, but i hadnt that much time, it was a busy week :/.

But lets talk about what i fixed, changed, added or just improved since last sunday. What does the most good 2d "top down" games need ? Collisions, right ! And what do you need for level collisions ? Walls, or obstacles ! Right again :) But thats not all, if you only use some "blocks" for collisions its gonna work fine, but what about the graphics ? I mean whats prettier ? A "Wall" in a 2d game, that everwhere looks the same like this one here :

1

Just a few green boxes, that symbolizes "Walls" arent that hard to make and it looks awefull. Or this here :

AutoTiling

Where the different "Wall tiles" adapt to each other ?

I really prefer the second picture here and i think the most one will agree with me. Maybe you are think know : "Why is this guy showing us that ??". Thats because, this is what i did on Monday... more or less. Actually i searched the whole day until Wednesday for the best "Autotiling" method. There are many different and all differ from each other. First i tried a method called "Bitmasking" for all who dont know what this is : Heres a link Bitmasking

Or a short explanation, for each tile that symbolizes a wall, you are checking the right,left,above,under neighbour. Just after that you are doing that for the corners too, right top, right bottom, left top and left bottom. And if theres one neighbour than add a certain number to the value of the wall. Im not a good explainer, so heres a code example :


 int tileID = 0;
 
 // 0 = up, 1 = left, 2 = down, 3 = right
 boolean[] directions = new boolean[4];
 // 0 = right top corner, 1 = right bottom corner, 2 = left top corner, 3 = left bottom corner
 boolean[] corners = new boolean[4];
 
 // got an under neighbour
 directions[2] = copyOfMap[((int) y)-1][(int) x] == 2; 
 
 // got an upper neighbour
 directions[0] = copyOfMap[((int) y)+1][(int) x] == 2;
 
 // got an left neighbour
 directions[1] = copyOfMap[((int) y)][(int) x-1] == 2;
 
 // got an right neighbour
 directions[3] = copyOfMap[((int) y)][(int) x+1] == 2;
 
 corners[0] = copyOfMap[y-1][x+1] == 2;
 
 corners[2] = copyOfMap[y-1][x-1] == 2;
 
 corners[3] = copyOfMap[y+1][x-1] == 2;
 
 corners[1] = copyOfMap[y+1][x+1] == 2;
 
 
 
 //--------------------------------------------------------------
 //--------------------------------------------------------------
 //--------------------------------------------------------------
 
 //when theres a above neighbour add 1 to the value
 if(directions[0]){ tileID += 1; }
 //when theres a left neighbour add 2 to the value
 if(directions[1]){ tileID += 2; }
 //when theres a under neighbour add 4 to the value
 if(directions[2]){ tileID += 4; }
 //when theres a under neighbour add 8 to the value
 if(directions[3]){ tileID += 8; }
 
 //when theres a right top neighbour add 16 to the value
 if(corners[0]){ tileID += 16; }
//when theres a right bottom neighbour add 32 to the value
 if(corners[1]){ tileID += 32; }
//when theres a left top neighbour add 64 to the value
 if(corners[2]){ tileID += 64; }
//when theres a right bottom neighbour add 128 to the value
 if(corners[3]){ tileID += 128; }
 
 //set the value of the tile, to the new tile id
 transformGrid[y][x] = (byte) tileID;

But how to check the "wall" tiles for corners now ? Thats pretty easy, in the code above we assign a value of 8, if the tile got an right neigbour and a value of 1 if theres a above neighbour. Lets say we have this corner here :

BitmaskExplain

If the tile got an right neighbour, we add 8 and if theres a above neighbour too, we add 1. 8+1 = 9 So the id for the tiles,which only got a right and an above neighbour is 9. And if thats true, than you found that corner and if you want, place a corner image there ! You are sad because you havent got a spritesheet ? Heres one i made, its free to use :D Each tile is 32x32 pixels width and height.

Duengon WallSet


Sounds easy right ?It tooks hours for me to implement that and it worked great. But it was loooooots of code about 2000 lines... and i also forgot to document my code so i strayed ever and ever again. After hours of headache and eye pain. Finally i deleted all the useless code and worked on an easier tiling system. Instead of checking all the walls for different neighbours i check the "floor" tiles for only direct neighbours like left,right,above and down. Thats more effective for duengon rooms, because the most tiles only got 1-4 direct neighbours. So i ended with about 400 lines of code instead of 2000, i think thats better now ^^. Does it works ? Yes it does and it looks very pretty !

DuengonGainersShowcase4

But there are still some "bugs" left. When theres a wall side comming from underneath that happens :

WallProblem2

Its not so bad, but it looks kind of strange... So i really need to find this iusse and thats my goal for tommorow ^^ So im comming to the end of this dev diary here... I could tell you what are my plans for the next week. There rooms, theres nice raycasting light, there walls but no enemys in there :/ Im going to study the basics of Libgdx AI and trying to create a little enemy, which is going to follow you if you are in a radius of 500 pixels and if you run away, hes going home. I hope you enjoyed this article ! And if you need some help or if you got some questions, just message me ! :) I also would be very happy about some feedback !

See ya next week :D


DuengonGainers Development Diary

genaray Blog

Hello there !

Its been a while, since my last post on IndieDB and im here still a "newbie", but that does not stop me from posting my Development Diary here.

So first i wanna tell you that this is my FIRST Development Diary ever, so i didnt ever posted one before. If you got any improvements just tell it me :) Im very happy about feedback!


So im interrested in game development and programming languages for years now and since that im trying to learn everyday a little bit more about it. A few weeks ago i came to the conclusion to make my first own "bigger" game, called "DuengonGainers". You may guess it, but its about duengons ^^, but thats not all im trying to make it a duengon crawler rpg. So there will be crawler, rpg and rouge like elements in it, a mix of it. Also i want to mention, that there wont be a story, only singleplayer and local multiplayer. This game should be endless playable, like the most games out of these genres. There will be tons of different enemys and charackters, weopens too.

Im currently working since 2-3 months on it, so im not even in my dreams done with it yet, thats because im posting this diary. But theres a problem, i just said i workde since 2-3 months on it, thats right. The problem is, that i havent made any diary in this time, because i never thought about posting a Development Diary... So i only can tell and show you what i made since today till the future :)


Theres currently no demo avaible, not even a video about that, but later when the game starts to be playable there will be some videos and demos. But for the first impression, here are some early early early alpha screenshots :

DuengonGainersShowcase

DuengonGainersShowcase3


By the way, you may see this little "thing" there, thats currently the player, he will later be replaced with a much better one ^^.


What do you think about it? Let me know :) The first real development diary is coming soon!