• What are you working on? V4 (HTML ISN'T PROGRAMMING)
    2,003 replies, posted
[QUOTE=NovembrDobby;17907385]Why play a game when you can make an app to do it for you? A little C++ project. [media]http://www.youtube.com/watch?v=j_7d1SLxmVo[/media][/QUOTE] I kept waiting for it to say DOMINATING.
[QUOTE=andersonmat;17910512]Yup, those characters will get you. Oh, what do you know, it works on my steam community I'm working on: [url]http://andersonmatt.com/profile/76561197992443150[/url] :dance:[/QUOTE] Alot better than the default steam community page
[QUOTE=efeX;17910786]Alot better than the default steam community page[/QUOTE] Thanks. :)
Quick idea/recommendation. Try splitting up friends into pages, having them all at once on the page makes it scroll rather slow.. (Not sure if that's just me or what)
[QUOTE=efeX;17911559]Quick idea/recommendation. Try splitting up friends into pages, having them all at once on the page makes it scroll rather slow.. (Not sure if that's just me or what)[/QUOTE] Yeah, maybe after 20 friends or something add "View all friends"
Pagination to friends. :D
[QUOTE=Diaklu;17911816]Pagination to friends. :D[/QUOTE] It's 6:40 AM what are you doing.
[QUOTE=omarrodriguez;17911975]It's 6:40 AM what are you doing.[/QUOTE] What are you doing in the programming forum.
[QUOTE=Diaklu;17912021]What are you doing in the programming forum.[/QUOTE] what the fuck
[QUOTE=FireSMILIE;17904736]Thanks for the first answers but I've got another question: how do you create the image? Or the real question is how do you draw the lines in the image?[/QUOTE] [cpp]//How to make the image Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); BufferedImage image = new BufferedImage(resolution.width, resolution.height, BufferedImage.TYPE_INT_ARGB); //How to draw the lines Graphics2D g2 = image.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setPaint(new Color(255, 255, 255, 20)); g2.setStroke(new BasicStroke(4)); g2.draw(new Line2D.Float(lastMouseLocation, currentMouseLocation)); g2.dispose();[/cpp]
[QUOTE=Jimmylaw;17909142]Added some animations into my 2D platform to make it look alittle bit nicer. Please ignore the fact my player is falling through the objects and going crazy at points, this is the work of the recording software, the game works perfectly when not recording. [media]http://www.youtube.com/watch?v=av3V1DoDYpQ[/media][/QUOTE] :downs: :downs: :downs: You realise the most likely cause of that is that the game is too slow to keep the character at the desired position? So if you run that game on a shitty PC the character will fall through the floor. By which I mean the recorder is causing slow down. Your collision is done in a silly way.
[QUOTE=efeX;17911559]Quick idea/recommendation. Try splitting up friends into pages, having them all at once on the page makes it scroll rather slow.. (Not sure if that's just me or what)[/QUOTE] [QUOTE=omarrodriguez;17911793]Yeah, maybe after 20 friends or something add "View all friends"[/QUOTE] Sounds good, maybe after I get home I'll do this. I have a few other things I wanted to do to the site as well.
[QUOTE=andersonmat;17913268]Sounds good, maybe after I get home I'll do this. I have a few other things I wanted to do to the site as well.[/QUOTE] Rather, it's an iPhone-inspired UI, right? How about a button that adds another couple of rows every time it's pressed?
[QUOTE=Jallen;17912919]:downs: :downs: :downs: You realise the most likely cause of that is that the game is too slow to keep the character at the desired position? So if you run that game on a shitty PC the character will fall through the floor. By which I mean the recorder is causing slow down. Your collision is done in a silly way.[/QUOTE] Its not my collision, i have a gravity like force pressing down on the character at all times. When it hits the blocks gravity is turned off but clearly when run on a slower computer or when its recording the game doesn't update faster enough for it to realise this.
[QUOTE=Jimmylaw;17914444]Its not my collision, i have a gravity like force pressing down on the character at all times. When it hits the blocks gravity is turned off but clearly when run on a slower computer or when its recording the game doesn't update faster enough for it to realise this.[/QUOTE] That's a lot of :words: for 'my collision is done in a silly way'.
[QUOTE=Jimmylaw;17914444]Its not my collision, i have a gravity like force pressing down on the character at all times. When it hits the blocks gravity is turned off but clearly when run on a slower computer or when its recording the game doesn't update faster enough for it to realise this.[/QUOTE] You probably aren't turning off gravity properly. Show us some code if you wish.
[QUOTE=Jimmylaw;17914444]Its not my collision, i have a gravity like force pressing down on the character at all times. When it hits the blocks gravity is turned off but clearly when run on a slower computer or when its recording the game doesn't update faster enough for it to realise this.[/QUOTE] Turning off gravity is a wonky way of stopping a character from going through something, what do you plan to do if the character walks into a wall? Either look into a physics library or read up on physical simulation. Also, in the video, your gravity says it's off when it's obviously still working, so you might want to look at why that's happening. And it can't be "not updating fast enough", because it slows down, therefore gravity is being turned off, but only partly. Which most likely means that it's being turned off and then back on over and over again. Also also, apparently you have collision detection working for the ground, might want to try and replicate that.
[QUOTE=ryandaniels;17914660]because it slows down, therefore gravity is being turned off, but only partly. Which most likely means that it's being turned off and then back on over and over again.[/QUOTE] This.
Ugh his number 1 problem is that his movement/physics/ect is not time based. If he fixes that then he can work on getting his physics working correctly.
Thanks for everyones help on this, i am starting another side project to get gravity simulated correctly.
[QUOTE=Jimmylaw;17914743]Thanks for everyones help on this, i am starting another side project to get gravity simulated correctly.[/QUOTE] It's easy: [cpp] Vec2f playerPos( 50, 50); //Players position Vec2f playerVel( 0, 0 ); //Players velocity ... void update( float frameTime ) { playerVel += Vec2f( 0, -1 )*frameTime; //Add gravity to the players velocity playerPos += playerVel*frameTime; //Move the player based on his/her/it's velocity } .. void keypress( char key ) { if( key == spacebar ) playerVel += (0, 10); //Makes the player jump into the air } [/cpp]
Would playerVel += Vec2f(0,-1)*frametime be decreasing the Y axis therefore moving the player up and not down? Edit: So would this be correct movement code? person.position += Vector2.Multiply(person.velocity, (float)gameTime.ElapsedGameTime.TotalSeconds);
[QUOTE=Jimmylaw;17914824]Would playerVel += Vec2f(0,-1)*frametime be decreasing the Y axis therefore moving the player up and not down?[/QUOTE] Sorry, my mindset is that 0,0 is at the bottom left of the screen and y goes up. So yeah, you'd want Vec2f(0,1)*frameTime if your y value goes downwards.
[QUOTE=Jimmylaw;17914824]Would playerVel += Vec2f(0,-1)*frametime be decreasing the Y axis therefore moving the player up and not down? Edit: So would this be correct movement code? person.position += Vector2.Multiply(person.velocity, (float)gameTime.ElapsedGameTime.TotalSeconds);[/QUOTE] You should have world co-ordinates and screen co-ordinates separately. I think _r4nk was using world co-ordinates.
[QUOTE=Jimmylaw;17914824]Would playerVel += Vec2f(0,-1)*frametime be decreasing the Y axis therefore moving the player up and not down? Edit: So would this be correct movement code? person.position += Vector2.Multiply(person.velocity, (float)gameTime.ElapsedGameTime.TotalSeconds);[/QUOTE] You should multiply the vector with time elapsed from [i]the last time you updated it[/i]. This makes it run equally fast on all computers, regardless of processing speed. I don't know what that TotalSeconds counts time from, but it certainly doesn't sound right.
[QUOTE=Jimmylaw;17914824] So would this be correct movement code? person.position += Vector2.Multiply(person.velocity, (float)gameTime.ElapsedGameTime.TotalSeconds);[/QUOTE] Uh? The velocity is basically the rate of change. So if the players velocity is (5,0) then it's like saying the player is moving 5 units [I]per second[/I] to the right. You don't want to multiply the players position by velocity. Simply add velocity to the players position. The reason we multiply velocity by frametime ( which should be in milliseconds! ) is so that over 1 second, the players position would have increased by exactly 5. Once you start multiplying things by frametime, try and think of every value as "over 1 second". Hope I am explaining this okay, i suck at explaining stuff.
[QUOTE=Jimmylaw;17914824]Would playerVel += Vec2f(0,-1)*frametime be decreasing the Y axis therefore moving the player up and not down? Edit: So would this be correct movement code? person.position += Vector2.Multiply(person.velocity, (float)gameTime.ElapsedGameTime.TotalSeconds);[/QUOTE] I generally flip the coordinates on render, that way I'm working in the first quadrant, which is less prone to errors and makes more sense.
[QUOTE=r4nk_;17914915]You don't want to multiply the players position by velocity. Simply add velocity to the players position.[/QUOTE] Nobody's doing that anywhere
[QUOTE=ThePuska;17914940]Nobody's doing that anywhere[/QUOTE] Oh whoops, hes: [cpp] person.position += Vector2.Multiply(person.velocity, (float)gameTime.ElapsedGameTime.TotalSeconds); [/cpp] threw me off. Why isn't that an operator anyway :P
Well that leaves me confused. I took the example r4nk_ did for me and did what i thought was correct and turned it into this for my code. [code] person.velocity += new Vector2(0,10) * (float)gameTime.ElapsedGameTime.TotalSeconds; person.position += person.velocity * (float)gameTime.ElapsedGameTime.TotalSeconds; [/code] It appears this makes my persons velocity carry on increasing till i take my finger off the button, not sure if its ment to do this? Edit: How do you post your code like the example above?
Sorry, you need to Log In to post a reply to this thread.