• What are you working on? V2
    2,001 replies, posted
You guys and yer games n stuf What's a good starting language to make games? C++?
[QUOTE=The Inzuki;17056949]You guys and yer games n stuf What's a good starting language to make games? C++?[/QUOTE] If you have no experience with programming you should start with Python. Something most people won't tell you is how painful it is to build large C/C++ apps if you don't use an IDE. I don't use an IDE for my C/C++ stuff so creating a build system sucks. Python doesn't need to be compiled, so you can just write some code and go. If you use an IDE, I guess it doesn't really matter.
[QUOTE=PvtCupcakes;17056992]Something most people won't tell you is how painful it is to build large C/C++ apps if you don't use an IDE.[/QUOTE] Well of course they won't tell you that, because most people aren't insane and use some kind of IDE or an easy to setup build system.
As for what I'm up to. I just got my ID3/Ogg tag reader to sort of write id3 tags. It manages to mess up the tag, but at least it's getting the data where it needs to be. :v:
[QUOTE=PvtCupcakes;17056877]You know, you can get some crazy performance improvements by clearing only what has changed instead of the entire screen. If the whole screen changes, you won't get much performance, but other than that it's huge.[/QUOTE] Isn't it slower to calculate what changed than just refresh all of it?
[QUOTE=Xeon06;17057461]Isn't it slower to calculate what changed than just refresh all of it?[/QUOTE] Heck no. All you do is find the position of the object before moving it. Draw a piece of the background over it, and move the object and draw it at it's new position. [editline]10:11PM[/editline] My Pygame game went from 4ms render times to 0.2ms render times.
i guess i've made enough progress to show this off [img]http://content.screencast.com/users/train/folders/Jing/media/a6ec96df-e1b6-49c5-a58e-e88673010a71/2009-08-31_2348.png[/img]
[QUOTE=PvtCupcakes;17056877]You know, you can get some crazy performance improvements by clearing only what has changed instead of the entire screen. If the whole screen changes, you won't get much performance, but other than that it's huge.[/QUOTE] Too bad there's no way to clear certain sprites in SFML.
[url]http://spamtheweb.com/ul/upload/310809/58409_crimegame.php[/url] It's a flash game coded with AS2, so far all you can do is walk, for some added fun I made it so there's places you can't walk. The premise of the game will be to break into this guy's house, and complete a list of goals, like make a sandwich in his kitchen, you'll have to search the place to find the ingredients while avoiding squeaking tiles. The noisy tiles will put up your noise meter (which will constantly be going down by a value of 5 or something), there will be other stuff that puts up the meter, not sure what though. If you have any ideas or want to help PM me.
[QUOTE=PvtCupcakes;17056877]You know, you can get some crazy performance improvements by clearing only what has changed instead of the entire screen. If the whole screen changes, you won't get much performance, but other than that it's huge.[/QUOTE] I'm only just getting into it for now and wouldn't know where to start with that. I am also trying to get my head around OOP while doing this because it's always been a bit of a mystery to me but one thing I want to know is how I create a new object when, for example, F2 is pressed. My code so far: [code]#include <SFML/Graphics.hpp> class ChestSprite { private: sf::Sprite Chest; sf::Image Image; public: ChestSprite( float X, float Y ) { Image.LoadFromFile( "chest.bmp" ); Image.CreateMaskFromColor( sf::Color( 255, 255, 255 ) ); Chest.SetImage( Image ); Chest.SetX( X + 40 ); Chest.SetY( Y + 100 ); } sf::Sprite& SpriteRef() { return Chest; } }; class GuySprite { private: sf::Sprite Guy; sf::Image Image; public: GuySprite( float X = 0, float Y = 0 ) { if( !Image.LoadFromFile( "male person.bmp" ) ) { } else { Image.CreateMaskFromColor( sf::Color( 255, 255, 255 ) ); Guy.SetImage( Image ); Guy.SetX( X ); Guy.SetY( Y ); } } sf::Sprite& SpriteRef() { return Guy; } float WhatsX() { return Guy.GetPosition().x; } float WhatsY() { return Guy.GetPosition().y; } }; int main() { sf::RenderWindow App( sf::VideoMode( 800, 600, 32 ), "SFML Window" ); GuySprite guy1( 10, 10 ); bool Running = true; bool ChestExists = false; while( Running ) { sf::Event Event; while (App.GetEvent(Event)) { if( Event.Type == sf::Event::Closed ) { App.Close(); Running = 0; } if( ( Event.Type == sf::Event::KeyPressed ) && ( Event.Key.Code == sf::Key::Escape ) ) { App.Close(); Running = 0; } if (Event.Key.Code == sf::Key::F1) { sf::Image Screen = App.Capture(); Screen.SaveToFile("screenshot.jpg"); } if (Event.Key.Code == sf::Key::F2) { ChestExists = true; } } float ElapsedTime = App.GetFrameTime(); // Move the sprite if (App.GetInput().IsKeyDown(sf::Key::Left)) guy1.SpriteRef().Move(-100 * ElapsedTime, 0); if (App.GetInput().IsKeyDown(sf::Key::Right)) guy1.SpriteRef().Move( 100 * ElapsedTime, 0); if (App.GetInput().IsKeyDown(sf::Key::Up)) guy1.SpriteRef().Move(0, -100 * ElapsedTime); if (App.GetInput().IsKeyDown(sf::Key::Down)) guy1.SpriteRef().Move(0, 100 * ElapsedTime); App.Clear( sf::Color( 0, 0, 0 ) ); if( ChestExists ){ ChestSprite chest( guy1.WhatsX(), guy1.WhatsY() ); App.Draw( chest.SpriteRef() ); } App.Draw( guy1.SpriteRef() ); App.Display(); } return 0; }[/code] So far I've managed to create a ChestSprite which follows the GuySprite but I want it to stay still and be able to create multiple ChestSprites. How?
It's more logical if you make a guy class deal with an instance of a Chest, so it doesn't clutter up main(), it also makes more sense in terms of relationships - a Guy has a Chest, the Chest doesn't follow the Guy. Although in a different situation, for all purposes a Chest could be a specialized Guy (in which case you would make Chest inherit from Guy)... One way to deal with multiple instances of an object (a generic BulletMan, for example) is to keep them all in an array or a vector, although an issue you'll encounter is memory management (boost::ptr_vector deals with them by taking ownership of the object unless you explicitly release(iterator) them).
But how do you keep them in an array if you don't know what size you have to make the array. Or am I being stupid and forgetting something about arrays (Can you create them to just have no specific size and they get bigger when you add to them?). I have just woken up so my following of stuff for about an hour will be slow.
Yes, that's true of arrays. The C++ standard library has something called the Standard Template Library which contains "containers" of classes (compound data types like arrays, stacks, maps which can be modified at runtime) and things that deal with them, although I suggest you only dip your head into templates and the STL after running through C++ - it's quite a bit to swallow by itself, although they're insanely useful.
[IMG]http://s6.directupload.net/images/090901/fu2luezg.png[/IMG] Works via STEAM ID. The Shield is if you are VAC Banned, the right icon shows the most played game/the current game. The number is the Steam rating, and last but not least the Steam registration date.
[QUOTE=AGMadsAG;17047075]Qurl, I'm really interrested in your progress. Since it's stuff like that, I would like to do when I get a little futher in C++. Currently stuck becouse of School taking all my time :(. What are you going to use your game for?[/QUOTE] Well I'm making a UI lib that can just plug into any dx game, like source games, GTAIV, things like that. Game is just a MMOCC similar to habbo and chatroom games like that.
I have a problem. My code so far: [code]#include <SFML/Graphics.hpp> #include <vector> #include <iostream> class ChestSprite { private: sf::Sprite Chest; sf::Image Image; float Xpos; float Ypos; public: bool exists; ChestSprite() { exists = false; } void Create( float X, float Y ) { Image.LoadFromFile( "chest.bmp" ); Image.CreateMaskFromColor( sf::Color( 255, 255, 255 ) ); Chest.SetImage( Image ); Xpos = X; Ypos = Y; exists = true; } sf::Sprite& SpriteRef() { return Chest; } void draw( sf::RenderWindow& win ) { Chest.SetX( Xpos ); Chest.SetY( Ypos ); win.Draw( Chest ); } }; class GuySprite { private: sf::Sprite Guy; sf::Image Image; public: GuySprite( float X = 0, float Y = 0 ) { if( !Image.LoadFromFile( "male person.bmp" ) ) { } else { Image.CreateMaskFromColor( sf::Color( 255, 255, 255 ) ); Guy.SetImage( Image ); Guy.SetX( X ); Guy.SetY( Y ); } } sf::Sprite& SpriteRef() { return Guy; } float WhatsX() { return Guy.GetPosition().x; } float WhatsY() { return Guy.GetPosition().y; } }; int main() { sf::RenderWindow App( sf::VideoMode( 800, 600, 32 ), "SFML Window" ); GuySprite guy1( 10, 10 ); bool Running = true; bool ChestExists = false; std::vector<ChestSprite> Chests; ChestSprite *chest; while( Running ) { sf::Event Event; while (App.GetEvent(Event)) { if( Event.Type == sf::Event::Closed ) { App.Close(); Running = 0; } if( ( Event.Type == sf::Event::KeyPressed ) && ( Event.Key.Code == sf::Key::Escape ) ) { App.Close(); Running = 0; } if (Event.Key.Code == sf::Key::F1) { sf::Image Screen = App.Capture(); Screen.SaveToFile("screenshot.jpg"); } if (Event.Key.Code == sf::Key::F2) { std::cout << "Attempting chest creation" << std::endl; ChestExists = true; chest = new ChestSprite; chest->Create( guy1.WhatsX(), guy1.WhatsY() ); Chests.push_back( *chest ); chest->draw( App ); } } float ElapsedTime = App.GetFrameTime(); // Move the sprite if (App.GetInput().IsKeyDown(sf::Key::Left)) guy1.SpriteRef().Move(-100 * ElapsedTime, 0); if (App.GetInput().IsKeyDown(sf::Key::Right)) guy1.SpriteRef().Move( 100 * ElapsedTime, 0); if (App.GetInput().IsKeyDown(sf::Key::Up)) guy1.SpriteRef().Move(0, -100 * ElapsedTime); if (App.GetInput().IsKeyDown(sf::Key::Down)) guy1.SpriteRef().Move(0, 100 * ElapsedTime); App.Clear( sf::Color( 255, 255, 255 ) ); for( int i; i < Chests.size(); i++ ) { Chests[i].draw( App ); } App.Draw( guy1.SpriteRef() ); App.Display(); } return 0; }[/code] Now what it's not doing is it's no showing the ChestSprite. Is this because at the end of the if statement the object is being destroyed. [code]if (Event.Key.Code == sf::Key::F2) { std::cout << "Attempting chest creation" << std::endl; ChestExists = true; chest = new ChestSprite; chest->Create( guy1.WhatsX(), guy1.WhatsY() ); Chests.push_back( *chest ); chest->draw( App ); //is the ChestSprite being destroyed here? }[/code]
I'm pretty sure that you have to call draw every frame. And no, chest will not be destroyed; only the pointer will be (leaving the ChestSprite-object untouched) - if chest is a normal pointer.
[QUOTE=ZeekyHBomb;17064182]I'm pretty sure that you have to call draw every frame. And no, chest will not be destroyed; only the pointer will be (leaving the ChestSprite-object untouched) - if chest is a normal pointer.[/QUOTE] I am calling draw every frame. That within the If statement is a test to see if it's working. [editline]04:09PM[/editline] I think it's this piece of code not working: [code]for( int i; i < Chests.size(); i++ ) { Chests[i].draw( App ); }[/code]
I just finished working on a video using new fancy pieces of software (the first time I actually use them): [img]http://maxofs2d.free.fr/public/misc/thebadwatersteamroll.png[/img]
[QUOTE=Max of S2D;17064270]img[/QUOTE] Home > Facepunch > Hardware and Software > Programming
[QUOTE=Max of S2D;17064270]I just finished working on a video using new fancy pieces of software (the first time I actually use them): *gay picture*[/QUOTE] I believe you made a wrong turn, this is the programing section, m'love.
[QUOTE=Wickedgenius;17064251]I am calling draw every frame. That within the If statement is a test to see if it's working. [editline]04:09PM[/editline] I think it's this piece of code not working: [code]for( int i; i < Chests.size(); i++ ) { Chests[i].draw( App ); }[/code][/QUOTE] This is a little bit off-topic, but a seperate indent level just for the curly braces? Washfdlfdfsdfsfsd, OCD overdrive.
[QUOTE=HubmaN V2;17064492]This is a little bit off-topic, but a seperate indent level just for the curly braces? Washfdlfdfsdfsfsd, OCD overdrive.[/QUOTE] No that's got something to do with the way I've copied it I think.
K&R for me :).
[img]https://dl.getdropbox.com/u/99765/fdfd.png[/img] yay sliders. Doesn't work with negative numbers yet.
[QUOTE=qurl;17065030][img]https://dl.getdropbox.com/u/99765/fdfd.png[/img] yay sliders. Doesn't work with negative numbers yet.[/QUOTE] Nice GUI. Is the entire system your own?
[QUOTE=Wickedgenius;17064251]I am calling draw every frame. That within the If statement is a test to see if it's working. [editline]04:09PM[/editline] I think it's this piece of code not working: [code]for( int i; i < Chests.size(); i++ ) { Chests[i].draw( App ); }[/code][/QUOTE] Fixed it by initializing i to 0: [code]for( int i = 0; i < Chests.size(); i++ ) { Chests[i].draw( App ); }[/code] I can now make magical chests everywhere: [img]http://img257.imageshack.us/img257/8268/captureofq.png[/img] What does everyone use for video capture? I want to be able to save the progress of this as I make it.
[QUOTE=Wickedgenius;17065410]Fixed it by initializing i to 0: [code]for( int i = 0; i < Chests.size(); i++ ) { Chests[i].draw( App ); }[/code] I can now make magical chests everywhere: [img]http://img257.imageshack.us/img257/8268/captureofq.png[/img] What does everyone use for video capture? I want to be able to save the progress of this as I make it.[/QUOTE] Fraps? Or Xfire if you like having 10 FPS.
I used recordmydesktop but that is Linux only. 24FPS with 1366x768 HD resolution ohhh yeahhh. Hehe. Quick question: How did you manage to call the function of a class from a different scope? :S
All his functions are public? Also, do you ever delete the objects you have created with new?
Sorry, you need to Log In to post a reply to this thread.