Scorpie

Member
  • Content count

    33
  • Joined

  • Last visited

Community Reputation

256 Neutral

About Scorpie

  • Rank
    Member
  1. Operator Overloading C++

    Nope. Const is a compiler-enforced "promise" that can be easily violated with casting or aliasing. AFAIK, the linker doesn't even see it, since the compiler would have done all the enforcement work ahead of time. Edit: Actually I think I see what you're getting at. And I think you're right. Const has to be part of the signature if the pointed-to object is const, because the compiler has to enforce that you don't pass const objects to parameters that take objects as non-const. But if you're taking it by value it doesn't matter because the value is copied and the copy will be const/non-const no matter what the source was.     He is right indeed, I was writing it up again but you both explained it already. Quotes from the standard are metioned here on SO: http://stackoverflow.com/a/3681190 and in plain english the post below.
  2.   And without templates, native thread support, or the stl or most other modern C++ features...     Actually, thread support has been introduced with the C11 standard. (Not disagreeing with your point, quite the opposite , just correcting a piece of the statement)
  3. a better fix your timestep?

      It's funny that you mention things like simulation where delays, prediction (by which i assume inaccuracies) are unacceptable. Yet you propose and defend a solution in which you present the user with views (renders) where the objects shown reside(? correct word ?) at a different point in time. These arguments you use against the f-y-t actually prove your own theory as unacceptable for your purpose, and probably most other. (notice the italic part, it may have uses as Hodgman suggests).
  4. I'm guessing you're using Visual Studio. VS <2013 doesn't have initializer lists.   I am out dated ...  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.
  5. Enemy only shoots once. Help

    Ah, it seems like there are quite some issues with the [ source ] tags, i always type [ code ] which seems to work fine, maybe a bit less fancy but it get's the job done Good to hear that you fixed the problems!
  6. Not sure if this fixes it but it looks like you are passing your angles in degrees and in physics.c you apply [b][i]radians to degree[/i][/b] instead you should be using [b][i]degree to radians[/i][/b] (angle / 180.0 * PI)
  7. Enemy only shoots once. Help

    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: [code]//if the enemy dies remove it //Need to delete the current one and make a new enemy[/code] 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: [code] 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; } } } [/code] 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: [code] 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; } } [/code] 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??? )
  8. 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
  9. render obj file with bad shapes

    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 [code]glEnable( GL_DEPTH_TEST );[/code] ps. you might also want to enable back face culling if your model is set up properly
  10. Planet curvature

    [quote name='Emergent' timestamp='1312083940' post='4842736'] I just want to point out that a square world that wraps in both directions is topologically a torus, not a sphere. [/quote] except for a torus the inner diameter differs from the outer so it's more like a cilinder where both ends are connected by a portal ;)
  11. sine wave shader

    [quote name='EvilNando' timestamp='1311718563' post='4840838'] .... my only problem is that the waves are very slow. I am not sure if this is because Im using rendermonkey or maybe its my code .... [/quote] the speed get's determined by [b]fTime0_X[/b][b]*.5[/b], the [b]sin[/b] function takes radians as input, one periode (so 1 wave: pixel moving to side, to other side and back) takes 2*pi which is somewhere around 6.28, assuming [b]fTime0_X[/b] is measured in seconds, one wave will take just over 12,5 seconds because you multiply it by 0.5. So you should change that 0.5 to alter the speed, the higher the value the faster the waves (unless you go over the framerate offcourse, then it will look like it goes slow in the other direction, just like the blades of a helicopter look like to change direction a few times when starting up but i don't want to confuse you ). To calculate the value use [b]factor = (2*PI) / s[/b] where [b]s[/b] is the number of seconds you want it to take to complete one wave. [b]EDIT:[/b] There is also an error in your calculation that will (probably) cause unintended behaviour, you have [b]aux.y [u]*[/u] fTime0_X * .5[/b] which should be [b]aux.y + fTime0_X*.5[/b] the way you have it now aux.y also defines the speed, but instead it should just specify the offset, i made an image for you in which i try to explain the functions of the different parameters and the effect they have on your animation. I'd suggest implementing the formula as i put it in the image and toy around with the different factors to see the effect they have on the result.
  12. Disappearing Models

    [quote name='GottiJay' timestamp='1311619337' post='4840116'] Tried to do some simple animations which basically moves individual model from one position to the other...each of them enclosed in an animation function ....the problem i have is when one animation finishes the model related to that animation disappears...making way for the model in the next animation.....which is not exactly what i want... what i want is for the first model to remain in its position while the second animation was running and the second and the first models remain in their position while the third model is running an so on...this is how my animation function looks thanks for your help [/quote] You forgot to attach your code, can you try to post it again because it's hard to pin-point the problem without. I was going to take some wild stabs in the dark but i came up with so many different possible problems i decided to just wait for the code
  13. movzx and movsx question again

    [quote name='nuclear123' ] i understand why the first movsx is used to cast the signed integer value into a DWORD size and keep it's sign( negative in this case ). [/quote] Correct [quote name='nuclear123' ] What i don't understand is why when Var1 is passed into the parameter of function() it is moved into a DWORD register using movzx? [/quote] This is because your function takes a short instead of an int. Movsx would have converted your value to a DWORD but you only want a WORD. [quote name='nuclear123' ] Doesn't this mean we loose the negative value of the sign? [/quote] No, you don't loose any information, your 2 bytes aren't changed in any way, they are just padded with 2 bytes (of value zero, 0x00). [quote name='nuclear123' ] therefore it will treat this as an unsigned integer within the function? Am i interpreting this right or no? [/quote] This is a wrong assumption, you assume your function will treat your value as an int because it gets stored as a dword, however your function is empty and you cannot see how it treats your data. Add something like Var1++; inside the function to see what really happens. Here is my prediction: your function will treat the data as an unsigned WORD and ignore the two 00 bytes that get added by the movzx function. [quote name='nuclear123' ] if so why does it happen like this? [/quote] If im correct it has to do with memory allignment, on a 32 bits system accessing the memory works more efficient (in terms of time it takes to access it), by alligning them on 32bits --> 4 bytes. even though you dont use up all the data. Look it up and you'll find a way better explanation than i can ever give. Hope this clears it up. I haven't posted on this site for a very very long time, but i started reading again a few weeks ago after regaining interest in game programming and logged back in because i found your question interesting sorry if i used unnecesary quotes or anything.
  14. Damage per Second vs Rate of Fire

    Just strolling by, but felt like mentioning you can also take the variables 'clip size' and 'reload-time' into the equation which can make quite some difference. This adds more situations to the result: the chance you kill without reloading but more importantly, the chance you have to reload during a fight which costs precious time in which the oponent can kill you if his gun has a greater clip for example. oh nm, speciesUnknown did a way better job explaining, didn't see his post because i opened the topic before dinner and read+replyd after :)
  15. Well you could also try to use degenerate triangles in your strip, that will at least reduce the calls to glBegin and glEnd to 1x per frame.