Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Sui

Pages: 1 [2] 3 4 5
16
General / Re: Running everything in Main.
« on: December 20, 2012, 12:21:28 pm »
You shouldn't have any problems with the end result, but your code will become hard to maintain.

How did you learn C++?

Have you read about OOP (Object-Oriented Programming) at all?

I have been using it for about 20 years (along with other languages like VB and C#) and am still learning new and better ways to code.

'Refactoring' by Martin Fowler is a great book on restructuring code, but you really need a solid C++ / OOP book first.

17
General / Re: Running everything in Main.
« on: December 20, 2012, 11:37:03 am »
You shouldn't encounter any performance problems, however your code will become increasingly difficult to maintain if you don't structure it. For a trivial demo program it doesn't matter too much.

On a larger, more complex project the compile time would get longer and longer as all of the code has to be compiled every time. Ideally you should be breaking your functionality into multiple header and code files. Your best bet is to pick up a book on Object-Oriented Programming (OOP) to learn how to design object models and structure your code.

Sorry I can't recommend a specific book, as I have been coding a long time and haven't read that kind of book recently. Perhaps some of the other guys on here know of a good book.

Which programming language are you using? Is it C++?

18
General / Re: Some questions about optimizations
« on: December 03, 2012, 09:49:15 am »
Laurent is right about the profiling. You need to identify the real bottleneck in your program and focus your optimisation efforts there.

That said, chances are it is your collision detection that is the bottleneck if you have a lot of objects to test. I hit this issue with my first game (Gravity Core) and used a variant of the 'Recursive Dimensional Clustering' algorithm published in Game Programming Gems volume 2.

The first two books in the GPG series are well worth picking up. They are full of good ideas and useful code samples.

They're not too expensive if you opt for used:
http://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=game+programming+gems

I can dig out some code for 2D collision checking if you like. Let me know. It will need some tailoring as it's tied into my game engine object model. To be honest the best way is to pick up the books and learn how it works from the ground up.

19
General / Re: need help with a weird problem (working with files)
« on: November 12, 2012, 10:03:23 am »
I tend to use SHGetFolderPathA instead, as this works on Windows 2000 and XP also. There are still a lot of people out there running Windows XP.

The code I use to get the path is:

        const char *PlatformCompatibility::GetUserStorageFolderRoot()
        {
//              return "";              // TEST CODE - simulate obtaining path failed

#ifdef WIN32
                static char appDataPath[MAX_PATH+1];
                memset (appDataPath, 0, MAX_PATH+1);

                // Getting the local appdata path (not the roaming one)
                // Always get the default path - current path should not be relevant for local (non roaming app)
                if (SHGetFolderPathA( NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_DEFAULT, appDataPath ) == S_OK)
                        return appDataPath;
                else
                        return "";

#else
                // Apple's "Where to Put Application Files" page
                // http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFileSystem/Articles/WhereToPutFiles.html

                static string appSupportPath;

                char *tempEnv = getenv("HOME");
                if (tempEnv != 0)
                {
                        appSupportPath.assign(tempEnv);
                        appSupportPath.append("/Library/Application Support");
                        return appSupportPath.c_str();
                }
                else
                        return "";
#endif
        }


You can read more about the function on MSDN:

http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(%22SHLOBJ%2fSHGETFOLDERPATHA%22);k(SHGETFOLDERPATHA);k(DevLang-%22C%2B%2B%22);k(TargetOS-WINDOWS)&rd=true


Note that you will need to create your own folder structure in there before writing to it. It is usual to create a company folder and a unique game subfolder (e.g. Suisoft\Starfire_2012aefr in my case).

On Windows you can use CreateDirectoryA and mkdir is fine for other platforms.

The folder paths will need to be built using string concatenation using the user appdata path as a basis.

Hope this helps.

20
General / Re: need help with a weird problem (working with files)
« on: November 07, 2012, 06:18:11 pm »
Where does your application get installed to?

If it's C:\Program Files that is a protected folder and you won't be able to write to it. On my old game I had INNO Setup make the folder read/write but this really isn't the right way.

Application data files should be written to the 'Application Data' area or perhaps 'My Documents' to comply with Windows standards.

I created a utility class to do this, as I don't think SFML (at least 1.6) has built in support for file IO to the correct areas.

Let me know and I can post some Mac & Windows compatible code. I haven't made a Linux build of my SFML game as yet.

Perhaps standard functions to get user writable folder paths might be a good feature in SFML, unless I've missed them and they are already there...

21
General / Re: need help with a weird problem (working with files)
« on: November 07, 2012, 09:05:22 am »
Which Operating System are you installing on? Is it Windows?

22
General / Re: How do i make an installer for my sfml 2.0 game?
« on: November 06, 2012, 09:16:20 am »
Inno Setup is very good and also free:

http://www.jrsoftware.org/isinfo.php

You just have to set up a simple script. The documentation is easy to follow and there are example scripts to use as a basis.

I have used it for both of my PC games (one free, one shareware) with no problems.

Highly recommended.

23
Graphics / Re: Screen Resolution Change - White Textures
« on: September 20, 2012, 01:46:36 pm »
Afaik there's a problem with Virtual Box...

Otherwise make sure you follow the offical tutorial specially about OpenGL.

Thanks for the quick reponse.

I read on another thread that there are some known problems with context loss when recreating the SFML window (in my case using it to change resolution):
http://en.sfml-dev.org/forums/index.php?topic=9022.msg60861#msg60861

I am concerned that this issue may crop up on some machines when the updated game is released live.

Has anyone encountered the white texture issue when changing resolution?

Thanks.

24
Graphics / Screen Resolution Change - White Textures
« on: September 20, 2012, 12:20:22 pm »
I'm improving my game engine at the moment and have implemented an option to change the screen resolution in-game. I had originally hoped it would run at desktop resolution on all reasonably modern machines but I am receiving complaints of bad performance from some players.

The code I am using is:


sf::VideoMode   newMode (width, height, 32U);
m_window->Create (newMode, m_title, sf::Style::Fullscreen);

glViewport(0, 0, m_window->GetWidth(), m_window->GetHeight());

CalculateGameViewWidth ();      // aspect has probably changed

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f, m_gameViewWidth, m_gameViewHeight, 0.0f);      // top and bottom flipped to reverse vertical axis to match game engine (0=top)

// Synchronise SFML view system (for font usage)
m_window->GetDefaultView().SetFromRect(sf::FloatRect(0.0f, 0.0f, m_gameViewWidth, m_gameViewHeight));

m_window->UseVerticalSync(true);
m_window->SetFramerateLimit(61); // Limit to 60 frames per second (slightly more to prevent occasional stuttering on Mac)



This works nicely on my development machine but when testing on Oracle Virtual Box (Windows XP) all of the text and fonts turn white after changing resolution. Note that I am still using SFML v1.6 and the sprite rendering is my own OpenGL code, rather than SFML's. I am using SFML Graphics for text rendering.

I know from reading some other threads on the forum (and from Googling) that context loss is an issue on some hardware and causes the white texture issue. I also know that SFML 2.0 solves this to a large extent but won't help with my own OpenGL code.

If someone can point me in the right direction, the questions I have, are:

Can I detect the state that causes the white boxes somehow?

How does SFML 2 detect the issue and reload the textures?

I have been searching around for a solution to this myself, including looking on the SFML forums but I can't find the answer. Most of the Google results seem to relate to Android. The official OpenGL documentation I've been reading suggests that hardware/drivers manage textures and you don't get the texture loss problems like Direct-X, but clearly there are exceptions.

Any help much appreciated.

Thanks.

25
SFML projects / Re: Starfire - Ares Assault v1.01 Released
« on: August 15, 2012, 04:53:36 pm »
I must say that I am amazed by your game! really good graphics (although i think you can do much better!), nice gameplay, to me it doesn't lagg or anything.. the difficulty for me was in the middle of "Just right" and "Pretty Hard".. but that's just me ;)
keep on your creations!
btw:: you should probably start developing on linux, they're the future now ;) (and always were!) ..
and yea, about the valve thing you are right, i read it a couple of weeks ago and i got stunned!
i really think that this new investement they're after is going to get nothing else but winners ;)
cheers and grats for your game! ~Zeneus

Thanks! Glad you like it.

The production values are much higher on this game than my previous effort.

Will be intesting to see what happens with Valve, Microsoft and Apple. Perhaps folks who only use their PC for web and gaming could be tempted over to Linux. It would be very difficult for me to move to Linux, as I use so many Windows-only applications. I would have to go through significant pain.

26
SFML projects / Re: Starfire - Ares Assault v1.01 Released
« on: August 11, 2012, 03:02:04 pm »
A linux version is something I'm considering.

At the moment I have next to zero experience with Linux and the development tools. I'm planning on buying a new PC in a few months, so I can have a play around installing test operating systems on my old one.

Ubuntu seems pretty popular and Valve are targetting it with Steam. That's likely where I'll start.

Beforehand, I want to iron out the performance issues with Starfire and get to a final version. I think some of the code I have for Mac OSX support should work on Linux as well, as they're both UNIX based. SFML does most of the cross-platform work (brilliantly) but there are a few bits and pieces I've done myself that will need porting.

27
SFML projects / Re: Starfire - Ares Assault v1.01 Released
« on: August 07, 2012, 09:29:25 am »
Thanks!

Did you get a chance to play? What did you think to the difficulty?

Cheers,
Gary

28
General / Re: Fraps slows application way down?
« on: July 05, 2012, 03:35:16 pm »
Can you capture Starfire without problems? I'm using PlayClaw and I only get a black screen... :-/

FRAPS works fine on both of my games (both OpenGL).

There is a free version you could try out. It just watermarks the videos.

29
General / Re: Fraps slows application way down?
« on: July 05, 2012, 02:52:34 pm »
I have been using FRAPS to capture videos of my game. I am using vertical sync (60 fps) in the game and 30 fps capture in FRAPS.

I have found the best settings for capturing videos without slowdown for YouTube and the like, is to set the screen resolution to 720p (1280x720 resolution). That way the videos are already in a standard YouTube friendly resolution.

Running the game at 1680x1050 with FRAPS tends to kill performance.

Another thing I found using Sony Vegas (for video authoring) is that the frame rate should be set to 30  instead of 29.97. At 29.97 rendering, frames are blending together resulting in ghosting. I suspect this may be the same in other packages.

30
SFML projects / Starfire - Ares Assault v1.01 Released
« on: July 05, 2012, 02:40:03 pm »
Hi All,

I have released a new version of the game.

Following feedback, the difficulty has been significantly toned down particularly on Easy / Space Slug modes.

The next release will aim to fix performance problems on machines with certain video cards, in particular those with limited memory.

You can download the latest version from here: (for PC and Mac)
http://www.suisoft.co.uk/starfire/index.htm

(please refresh your browser to ensure you see the v1.01 download links)

I have also posted a new YouTube video showing a playthrough on Hard difficulty:


Enjoy and please pass on.

If you have any comments or suggestions, please get in touch.
I have added a poll, if you don't mind rating the difficulty.

Thanks.

Pages: 1 [2] 3 4 5