First off, i'm not sure if this is in the correct section of the forum, so if it's not, sorry, please move it.
I'm trying to implement a screen shaking effect. My game uses SDL and is 2D.
My problem is that i'm trying to make the effect by altering the screen's pixels offsets by random ammounts just before the call to SDL_Flip() at the end of each frame. This is ok but when the screen shakes, there will be ugly black spaces around my game scene because nothing was renered there. I hope you understand my problem.
The solution I came up with is, in my opition, pretty complicated and looks unnecessary. What I will do is have the rest of my game draw to a surface that's 32 pixels bigger in each direction. The rendering code will make sure that no important info is drawn in the 32 pixel border. When the frame is about to end, just before the call to SDL_Flip(), The game will do the screen shake effect on the bigger surface and then copy the bigger surface's pixels onto the smaller surface that's the size of the screen. It will make sure to add a 32 pixel offset and not copy pixels that aren't visible on the actual screen. Hopefuly, that wasn't too confusing either... I'm not so good at explaining things.
A small problem that I'm having with this is that I don't know how to set up and free 2 SDL_Surfaces that can be drawn to and updated.
My bigger concern is that there is a very simple way to do this that I don't know about. Should I not bother trying to hack this into my graphics code and put it at a higher level?
- Viewing Profile: Topics: Lith
Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics
Community Stats
- Group Members
- Active Posts 141
- Profile Views 1,498
- Member Title Member
- Age 16 years old
- Birthday September 16, 1996
-
Gender
Male
136
Neutral
User Tools
Contacts
Lith hasn't added any contacts yet.
Topics I've Started
Screen Shake Effect
26 May 2012 - 12:49 AM
Browser Based Game Overhead
17 May 2012 - 11:51 AM
Hello.
I have a couple of questions concerning browser based games. Not the flash type, the ones that use web pages as their interface.
I hope that these questions aren't too vague and hard to answer.
I have a couple of questions concerning browser based games. Not the flash type, the ones that use web pages as their interface.
- Would it be necessary to have each component run in a separate process? Components could be, for example, the main game logic, login/registration and leaderboards. Should I worry about the overhead of having some users requesting a battle outcome while others are trying to register?
- Is it wise to worry about the images the server sends to the client and the bandwidth overhead or should I let the clients browser cache worry about it?
- Is writing my game's server in C++ or similarly low level language going to create more problems than speed issues it solves? Would I be better off sticking to something like PHP for example?
- Is this 'plan' feasible? Start with shared hosting and gradually upgrade to VPS and dedicated hosting as my game grows and I need more power.
- How would I calculate a handy figure that shows the "cost per month per player?" This would give me the cost of hosting the game for a month for every player I have. It would facilitate my hosting upgrade decisions. Do I really need to be concerned with this?
- Are there any other 'big' issues with creating browser based games concerning speed and web hosting that I should know about
I hope that these questions aren't too vague and hard to answer.
What's the point of private class members and methods(C++)
13 May 2012 - 05:41 AM
When I'm writing classes in C++, I never make anything private. Why?
Because it makes me have to write more code to interface between the public and private parts of the class. This, in turn, increases the time I spend on the project for no gain. I know how the class works and how to use it because I wrote it.
I like to have everything public so that If i'm using the class later, and I need it to do something a little different, It may be possible by tinkering with methods and members that should be private.
If you are using a class that someone else wrote, I still belive that you would benifit from having everything public. You would still learn how to use the class through the usual means of looking at the documentation, reading tutorials and reading header files. The only difference is that you would have alot more freedom in how you use it.
To be honest, I think I'm missing something big, can someone enlighten me?
Because it makes me have to write more code to interface between the public and private parts of the class. This, in turn, increases the time I spend on the project for no gain. I know how the class works and how to use it because I wrote it.
I like to have everything public so that If i'm using the class later, and I need it to do something a little different, It may be possible by tinkering with methods and members that should be private.
If you are using a class that someone else wrote, I still belive that you would benifit from having everything public. You would still learn how to use the class through the usual means of looking at the documentation, reading tutorials and reading header files. The only difference is that you would have alot more freedom in how you use it.
To be honest, I think I'm missing something big, can someone enlighten me?
VC++ 2010 Deafult Project Linker Settings Messed Up
11 April 2012 - 01:00 PM
I am using Visual C++ 2010 and when I create a new project, in the linker settings under 'Additional Dependencies', it allways has the library 'sfml-window-d.lib'. When I look in the project's 'Inherited linker additional dependencies', I see the sfml-window-d.lib, along with all the other deafult libraries.
Is there any way to change the project deafults so that I can remove the 'sfml-window-d.lib' from it?
Is there any way to change the project deafults so that I can remove the 'sfml-window-d.lib' from it?
Dungeon Generation Problems
30 March 2012 - 08:07 AM
Hello.
I am working on a simple method of generating dungeons for my game. So far, I have a system that will generate rooms in random places of random sizes but I need a way to connect them to eachother with corridors.
I read that the way in which I connect the rooms and make corridors will give the feeling of the dungeon, so I don't think that using a pathfinding algorithm that connects the midpoints of all the rooms would be very interesting. There is also the problem of making sure every place is reachable.
Can someone suggest how I could connect the rooms?
I am working on a simple method of generating dungeons for my game. So far, I have a system that will generate rooms in random places of random sizes but I need a way to connect them to eachother with corridors.
I read that the way in which I connect the rooms and make corridors will give the feeling of the dungeon, so I don't think that using a pathfinding algorithm that connects the midpoints of all the rooms would be very interesting. There is also the problem of making sure every place is reachable.
Can someone suggest how I could connect the rooms?
- Home
- » Viewing Profile: Topics: Lith

Find content