Jump to content

  • Log In with Google      Sign In   
  • Create Account


bluwind

Member Since 17 Jul 2007
Offline Last Active Jul 17 2013 12:03 AM

#5072666 Fleet Limit

Posted by bluwind on 25 June 2013 - 01:12 AM

There is a space empire consisting of 100 planets, these planets generate 1,000 recruits that can be used as ships CREW.

You build SHIPS, there is no limit on number of constructed ships but the number of ACTIVE SHIPS (fleet) is limited by crew available.

 

Now, the question is how to handle the crew and ships relationship?

 

Typically in such games crew is used as a hard limit for building ships (you can't build more ships that crew allows) but I can't do it, I need a pool of obsolete/unused ships that are not manned at the moment. My system is supposed to be highly automated (the AI manages which ships are active and which are waiting in reserve, send them to repairs and move older ships to reserve when better ones are built), that part is easy.

 

But what to do if:

- a ship is destoyed (so the crew capacity is freed) - should the crew immediatelly man the next best unmanned ship OR is the crew "dead" and you need to wait till the planets regenerate their pool of recruits?

- a ship is damaged and is sent for repairs - should the crew be able to just switch to a fully operational unmanned ship from reserve (which could be quite unbalancing in case you have a large pool of older unmanned ships, it could make wars quite long; also what to do if their original (better) ship is repaired, should they switch back again)?

 

 

regarding -"a ship is destroyed", I would personally assign different 'escape pod' values to each type of ship (if your using different types of ship). so say a cruiser may be able to save 20 % of its crew while a science vessel my save 50%. if your, that way your saving some of the crew but still giving the player a reason to not letting his ships die.

 

-"a ship is damaged", this depends entirely on how realistic your making this. it would be one idea to make the crew move to new ships regardless of if the older ship is damaged - after all you don't see the navy still putting out wooden sailing ships. Then again you could have a crew experience field - which increases the ships capability the longer it has served on a vessel. which would mean you would want the crew to return to the older ship once it has been repaired. again my preference would be to have the crew make a permanent move to a new ship every third generation of ship and a temp move while repairs are being made before that, I would also put in the experience field.




#5072286 GO home viking raiders "your drunk"

Posted by bluwind on 23 June 2013 - 01:05 PM

Ok, so this is my first C++ code, I am not making any excuses though because I have been programming off and on in VB for a few years so I am aware of a number of bad practises I committed here.

So here is some code for you to feast your eyes upon, you can see how I jumped from one preferred grid referencing method to another, Coordsx, VX, GridRefx... that's what happens when you don't have a clear plan though.

I am currently restarting the project in a much more manageable way because even I have lost track of what is going on in may sections.

I posted the game running (or at least doing a good imitation of running) on youtube here http://www.youtube.com/watch?v=Hp5wsjfUNjY

The game is a Viking raiders (spectrum) remake.

int Player1::Check_Collision(int Directions)
{
	int i;
	switch (Directions)
	{
	case 1:
		//Bottom Left
		if (Coordsx - vx <= -30 || Coordsy + vy >= (SCREEN_HEIGHT - 90) || Map[GridRefx - 1][GridRefy + 1].style == 1 || Map[GridRefx - 1][GridRefy + 1].Occupied == 1)
		{
			
			if (Map[GridRefx - 1][GridRefy + 1].Occupied == 1)
			{
				Fighting = true;	
				Stepinto = 2;
			
				AnimOverlord = 0;
				
			
			}
			
			LockPSel = false;
			Active = false;
			Direction = 0;
			return 1;
			
		}
		break;
		//Down
	case 2:
		if (Coordsy + vy >= (SCREEN_HEIGHT - 90) || Map[GridRefx][GridRefy + 1].style == 1 || Map[GridRefx][GridRefy + 1].Occupied == 1) 
		{
			if (Map[GridRefx][GridRefy + 1].Occupied == 1)
			{
				Fighting = true;	
				Stepinto = 2;
				
				AnimOverlord = 0;
				
			}
			Direction = 0;
			LockPSel = false;
			Active = false;
			return 1;
		}
		break;
	case 3:
		//Bottom Right
		if (Coordsx + vx >= SCREEN_WIDTH || Coordsy + vy >= (SCREEN_HEIGHT - 90) || Map[GridRefx + 1][GridRefy + 1].style == 1 || Map[GridRefx + 1][GridRefy + 1].Occupied == 1)
		{ 
			if (Map[GridRefx + 1][GridRefy + 1].Occupied == 1)
			{
				Fighting = true;	
				Stepinto = 2;
			
				AnimOverlord = 0;
				
			}
			Direction = 0;
			LockPSel = false;
			Active = false;
			return 1;
		}
		break;
	case 4:
		//left
		if (Coordsx - vx <= -30 || Map[GridRefx - 1][GridRefy].style == 1 || Map[GridRefx - 1][GridRefy].Occupied == 1)
		{ 
			if (Map[GridRefx - 1][GridRefy].Occupied == 1)
			{
				Fighting = true;	
				Stepinto = 2;
				
				AnimOverlord = 0;
			
			}
			Direction = 0;
			LockPSel = false;
			Active = false;
			return 1;
			
		}
		break;
	case 6:
		//right
		if (Coordsx + vx >= SCREEN_WIDTH || Map[GridRefx + 1][GridRefy].style == 1 || Map[GridRefx + 1][GridRefy].Occupied == 1 )
		{ 
			if (Map[GridRefx + 1][GridRefy].Occupied == 1)
			{
				Fighting = true;	
				Stepinto = 2;
			
				AnimOverlord = 0;
			

			}
			Direction = 0;
			LockPSel = false;
			Active = false;
			return 1;
			
		}
		break;
	case 7:
		//top left
		if (Coordsx - vx <= -30 || Coordsy - vy <= -30 || Map[GridRefx - 1][GridRefy - 1].style == 1 || Map[GridRefx - 1][GridRefy - 1].Occupied == 1)
		{ 
			if (Map[GridRefx - 1][GridRefy - 1].Occupied == 1)
			{
				Fighting = true;	
				Stepinto = 2;
			
				AnimOverlord = 0;
			
			}
			Direction = 0;
			LockPSel = false;
			Active = false;
			return 1;
		}
		break;
	case 8:
		//up
		if (Coordsy - vy <= -30 || Map[GridRefx][GridRefy - 1].style == 1 || Map[GridRefx][GridRefy - 1].Occupied == 1 )
		{ 
			if (Map[GridRefx][GridRefy - 1].Occupied == 1)
			{
				Fighting = true;
				Stepinto = 2;
				AnimationCycle = true;
				AnimOverlord = 0;
			
			}
			Direction = 0;
			LockPSel = false;
			Active = false;
			return 1;
			
		}
		break;
	case 9:
		//top right
		if (Coordsx +vx >= SCREEN_WIDTH || Coordsy - vy <= -30 || Map[GridRefx + 1][GridRefy - 1].style == 1 || Map[GridRefx + 1][GridRefy - 1].Occupied == 1)
		{ 
			
			if (Map[GridRefx + 1][GridRefy - 1].Occupied == 1)
			{
				Fighting = true;
				Stepinto = 2;
				AnimationCycle = true;
				AnimOverlord = 0;
			}
			
				Direction = 0;
				LockPSel = false;
				Active = false;
			 return 1;

			
		}
		break;
	}
	return 0;
}



#5070417 Artifictial Society Simulation

Posted by bluwind on 17 June 2013 - 08:01 AM

This is defiantly feasible, seeing as u don't ever plan on releasing the project u can start by thinking small.
If it was me I would forgo the graphics for the time being and begin by displaying each agent as a coloured dot on he screen. Also start with the basics, hunger, fatigue and lifespan. Make food readily available and then slowly add extra avenues and routines.


Sounds really fun though.


#5068838 C++ Problem with loop

Posted by bluwind on 11 June 2013 - 04:19 AM

don't worry, I have sorted it.. guess I woke up :D

replaced

Map[hor][ver].x = (hor * 30);
Map[hor][ver].y = (ver * 30);

with:

Map[hor][ver].x = ((hor - 1) * 30);
Map[hor][ver].y = ((ver - 1) * 30);

 

 

Thank you for taking the time to look and I wouldn't have sorted it if I didn't change to a for loop. so cheers again




#4824435 How to handle tracks in a 2D racing game?

Posted by bluwind on 17 June 2011 - 06:13 AM

Well to do a bridge u just need to add a height variable to ur car. Starts at height 1 and when he passes a hidden marker it's height changes to 2. When the height is 2 the car can drive over the bridge and when height is 1 he can drive under it, u just need to make the Walls on the bridge collision detection based on the height of the car and also change the cars z-order so he appears under or above the bridge.


#4824363 How to handle tracks in a 2D racing game?

Posted by bluwind on 17 June 2011 - 12:07 AM

Hiya, i did a very similar thing in VB6 a few years back. What i did was create a 2 dimensional array like "map(800,600)" then when the screen loads i get the pixel colour of each pixel and load it into the array following a quick case statement, i would use a slightly off black colour as collisional walls so if th pixel is off black the number "10" would be loaded into the array at that pixels coords, grass could be entered in as "5", tarmac as "0" and the actual players position would be entered as "1" so when a player moves you check hisnext coords on the map array - empty space would be "1+0" (allow to run normal), if you hit a wall "1+10 = 11" (collision detected, dont allow move) .




The benefit of doing it this way is that anything that could possibly cause you lag is done on loading, you can also easily change the map at runtime too without any slowdown. i know i didnt explain that very well and i think i made it sound alot more confusing than it actually is.. I would write you a little example in XNA but my laptop wont let me run it.. something about pixel shaders not being able to handle it.


Rob


PARTNERS