Jump to content

  • Log In with Google      Sign In   
  • Create Account


Scorpie

Member Since 05 Apr 2006
Online Last Active Today, 04:14 AM

#5158070 Function that takes unknown amount of strings, how do i vector?

Posted by Scorpie on 04 June 2014 - 05:37 AM

 

 

Possible i don't have latest c++11?

I'm guessing you're using Visual Studio. VS <2013 doesn't have initializer lists.

 

I am out dated blink.png...  99$ for 2013 upgrade, too broke ATM for that.

I will make do with horrible syntax.

 

 

You can get the Visual Studio 2013 Expess edition for free if it fits your needs. You only have to register your email after 30 days to continue free usage for unlimited period.




#4991391 Enemy only shoots once. Help

Posted by Scorpie on 18 October 2012 - 04:34 AM

First of all, i notice that you use a lot of " = " operators in your if-statements (line 69, 120, 127), this is wrong and should be replaced with the compare operator " == " like you use in other places (line 36, 44). Check the rest of your code for this mistake also because when you use it here, chances are you use it in other places too.

I don't have time to check everything in your code at the moment (@work) but there might be some more problems, for example comment in lines 67,68 state:
//if the enemy dies remove it
//Need to delete the current one and make a new enemy
There is no enemy deletion going on there so i have no idea why it is there

Anyways, for your shooting problem:
the scope of the while-loop in this code is wrong:
if(health = p1.x)
	    {
		    while(readyToFire)
		    {
			    shot = true;
			    readyToFire = false;
			    bullet = new Rectangle (enemy.x+45, enemy.y+65);
			    by = enemy.y+65;
			    bx = enemy.x+45;
			    bullet = new Rectangle(bx, by, 3 , 15);
			    System.out.println("Hi");
			
		    if(bullet.y >= 595)
		    {
			    bullet = new Rectangle(0, 0, 0, 0);
			    shot = false;
			    readyToFire = true;
				
		    }
	    }
	    }

You need to move the if-statement outside the while in order for it to be checked (after all, you set readyToFire to false inside the while)
Change it to:
if(health == p1.x)
	    {
		    while(readyToFire)
		    {
			    shot = true;
			    readyToFire = false;
			    bullet = new Rectangle (enemy.x+45, enemy.y+65);
			    by = enemy.y+65;
			    bx = enemy.x+45;
			    bullet = new Rectangle(bx, by, 3 , 15);
			    System.out.println("Hi");
			 }
		    if(bullet.y >= 595)
		    {
			    bullet = new Rectangle(0, 0, 0, 0);
			    shot = false;
			    readyToFire = true;
				
		    }
	    }

ps. i changed the " = " to " == " in that code but i have no idea what is going on there so you might need to move the pieces around some more there are some weird things going on in your code (why are you comparing health with the x coordinate of the player??? )


#4986548 How to get ping times for large server lists

Posted by Scorpie on 03 October 2012 - 03:30 PM

Here is an idea i came up with while reading this topic, it's a variant on the geocoding i guess:

How about dividing servers into groups depeding on the ping time between them?
When a new server connects to the lobby to identify itself, it will receive a list of the other servers and ping them (or just two or three per existing group). The result is then returned to the lobby server which assigns this server to a group. If a group exceeds a certain size, for example 30, split them into two new groups using for example the two servers which have the longest ping between them and then divide the rest equally and depending on the ping time to these two "outer" servers.
You can assing a "master / reference" server per group, the one with smallest sum of pings to others in group which can be pinged by a user. If the ping is ok, the user is presented with all servers in the group and can ping these assuming decent ping times.

There are still a few things that need thought, among which:
- Depending on server lifespan this might not give good performance.
- Ping time between servers needs to be updated periodically because it may change depending on the network / internet structure which might cause frequent rearanging of groups (however i think this won't be that bad, else normally you would have varying ping times all the time)
- Merging of groups when they become small

Ok please note, i have no practical experience in this field, this is just a random thought that popped up in my head so it might be either a bad idea, a lot of overhead or contain some assumptions which make this idea just not work but i figured i'd share and see what you guys think.

I hope at least the idea is clear, i don't really feel like writing a two page essay atm but wanted to share it nonetheless, might expand on this later :)


#4985515 render obj file with bad shapes

Posted by Scorpie on 30 September 2012 - 04:33 PM

Your imagehosting does not allow hotlinking so its hard to view your picture, i had to get the url from the source, better use another one next time to make it easier for other users to view your image. Link: http://img4.pixhost.org/images/1667/14252342_fuuu.png

Anyways, enabling depth testing should solve your problem
glEnable( GL_DEPTH_TEST );

ps. you might also want to enable back face culling if your model is set up properly


PARTNERS