Jump to content

Shadowing

Members
  • Posts

    722
  • Joined

  • Last visited

Everything posted by Shadowing

  1. Actually the zero probably affects if the vakue is negative or not
  2. Actually this is for unity game engine. Atm center is 0,0 So I'm dealing with negative numbers
  3. Ahh OK. Thanks now I know how to find theta. I can just ignore cy and CX right since that's always going to be 0,0?
  4. Thanks for thee responses guys. Ya I meant spaced around its circumference. So together all 20 objects forms a circle. I think this is the formula I saw when I was trying to google it Barand. I'm confused about the theta part Do I use pie for that? Also not sure how this would give me 20 spaced out. But I guess the theta would determine that. so really I need 20 slices of pie and a object in the middle of each slice on the circumference. Maybe I need to find the circumference first then divide it out by 20. Then find what each one would be spaced out on the circumference. Then some how use that number with a formula to find my x and y?
  5. Every year I run into some math that is over my head lol. Say I have a circle with a radius of 600 and I want to place 20 objects around the circle perfectly spaced. I need to figure out what the x and y would be for each object.
  6. That's an amazing idea Barand on generating the array. Didn't consider taking a new percentage of the stars left on each level when building the array. cheers
  7. A new idea has arose. $planets = 10,000; $rate_pool = array( 25 => .01, 24 => .02, ); $level_pool = array( 25 => $planets * $rate_pool[25], 24 => $planets * $rate_pool[24] ); I'll random pull a key from $level_pool then i'll subtract from $level_pool and when one of them are empty I remove the element;
  8. Actually that idea doesn't work either. Cause then there will be like 20 level 10's close together in the galaxy. So I guess on that principal alone it has to be done with random functionsfunctions I'll just do that I guess. Unless someone has another idea
  9. I figured out a solution. Using the last 3 digits of every Id I can say every 100 is level 25 planets Every number between 99 and 97 is level 24 planets So 1% of planets would be lvl 25 and 2% would be lvl 24 etc Whatever I want set each level too. That's a simple solution. Idk why it took me so long to think that idea up
  10. The only real solution I came up with is using 25 random functions with stops so its as efficient as possible.
  11. If I can come up with a solution that doesn't use random functions that be best. Wouldn't even need to assign it to the row. One kinda idea is using the first digits of a number with a T chart but idk.
  12. Thanks for the reply requinix The problem I'm having isn't how to edit a MySQL data base It's figuring out a level of a planet so when I generate 10,000 planets or more each planet is given a level (1-25) After all 10,000 planets are inserted into the database. The end result will be that there is fewer level 2's than level 1's and so forth.
  13. Hey guys I have a script I need to build and I'm trying to figure out the most efficient way to do it. Say I have 1000 rows in mysql (planets). Each row has an auto increment id I need to cycle through each row and add what level the planet is(1-25). I also need the more higher level a planet is to be more rare in the Galaxy. After coming up with two ideas both not efficient enough. I woke up today with a new idea but I need some help in completing the idea of it. Since each row has its own Id. I'm thinking that can be used to determine rareness of the level. Hoping a math guy here at phofreaks knows of a way I can play on the math with the id. Thanks
  14. I haven't been to the forum in a while but I notice it there are topics where several people have posted replies but yet the view count still shows 0 specially on the php math board. Not sure if im the only one that notice that. Figure id report it.
  15. I notice today when i tried to log in through my nexus 7 tablet when clicking on the input field to type my log in information the tablet auto zooms in and pops my keyboard up like it should. The problem though is that it only allows me to type my user name in and scrolling down doesn't scroll the login box down with the rest of the page.
  16. One way is have it start the rank from where the alliance you are searching for. Only start the rank from the networth where your alliance is at all the way to rank 1.
  17. One thing though. Isnt that pretty heavy weight since its ranking every single alliance even past the rank of a alliance I need.
  18. and all i have to do is just add a WHERE clause to grab a certain alliance SELECT alliance, rank, total FROM ( SELECT alliance, @row := @row+1, @rank := IF(totnet=@lasttot, @rank, @row) as rank, @lasttot := totnet as total FROM ( SELECT alliance, SUM(networth) as totnet FROM test GROUP BY alliance ORDER BY SUM(networth) DESC ) as tot JOIN (SELECT @row:=0, @lasttot:=0,@rank:=0) AS init ) ranks WHERE alliance = 5 works great
  19. Ahh thanks so much for doing that Barand i was sitting here trying to fill in my stuff on your other post in that other thread but that guy is using two differant tables My SQL isnt this high in level yet had to change the table to test instead of alliancetest but it works well. Thanks so much hopefully this example will help break me into understanding sql variables and statements with subqueries. Cause i would really like to beable to free hand write sql on that level
  20. I put together a test table CREATE TABLE test ( id INT AUTO_INCREMENT PRIMARY KEY, alliance int(5), networth int(5) ) INSERT INTO test (alliance,networth) VALUES(2,100),(2,150), (3,130),(3,70),(3,80), (4,300),(4,200),(4,100),(4,100), (5,100),(5,220),(5,180), (6,100),(6,220),(6,110),(6,120),(6,80)
  21. Thanks Barand I"m going to try that query out. I did solve the issue just using a 2nd query which was plan B but If that query works then im going to use that instead. I have another issue now though lol Im trying to do ranks with Alliances in my game. I need to do SUM(game.networth) and compare it to $users_alliance_stat for each alliance. I googled the heck out of this. This query almost works accept it doesnt count each alliance instead returns how many members are in the first alliance. What im trying to do is add up all the players networth that is in each alliance so I can figure out what rank a alliance is SELECT COUNT(*), SUM(game.networth) as sum_stat FROM game GROUP BY alliance HAVING sum_stat > $users_alliance_stat an easier example that doesnt work with sql. But probably easier to understand what i'm trying to do SELECT COUNT(*) FROM game WHERE SUM(game.networth) > $users_alliance_stat
  22. Since InnoDB has no real order im starting to think its kinda random cause i just notice if order changes on ties even on my script. Never notice this before probably cause I didnt have so many users having a tie before
  23. wierd i just noticed another problem if I do this in myphpadmin SELECT experience, id FROM game ORDER BY experience DESC it gives me a completly differant order then my pagination script which uses "SELECT experience,id FROM game ORDER BY experience DESC LIMIT $offset, $rowsperpage"
  24. ya thats the problem i have is ties. so when I select the persons rank it lines up where they are in the pagination. right now on my pagination script it just pulls in order if there is two users with the same experience points (for example) I'm not sure how mysql orders that if im doing order by experience DESC not sure how mysql decides who is next in line. My first idea was to use SELECT COUNT(*) FROM table WHERE points > players points but then i was like oh wait that won't work for ties. So thats the problem im having I need to pull the players exact rank as to where they would show up on my pagination script I can do this if i used another select like select all users who have the same experience as that player and then take that informtation to figure out how many players are ahead of that player but that just seem so lame to do that. I"m working on this new idea now that almost works but for some reason its off by like 4 some how haha no idea why SET @rownum := 0; SELECT rank, experience FROM ( SELECT @rownum := @rownum + 1 AS rank, experience, id FROM game ORDER BY experience DESC ) as result WHERE id= 3112
  25. I found this example online but I don't understand it enough to edit it SELECT COUNT(*) FROM game ui WHERE (ui.points,ui.id >= (uo.points, uo.id) ) AS rank FROM game uo WHERE id = @id
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.