Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

Ballistic - first release


xtal256
 Share

Recommended Posts

Hi all,

It's still in the very early stages, but you can download the first release of my game Ballistic below. The maps are far from finished and some don't work but you can play on the "Industrial" map. Also, the player sprites are just place-holders, so they look pretty crap.

Because it is built using Visual Studio, you will need the MSVC redist to run it. If you use VS you will probably have it, otherwise you can get it here. I will have to look into how i can package that with my game.

Download Ballistic 0.0.1

 

I would like to hear what you think of it but please know that this release is not yet a proper, playable game but rather just to show you how far i have got with development. Considering it is my first game i think it is quite an achievement to have the GUI, physics and AI systems working, even if they are far from done.

Link to comment
Share on other sites

Transparency doesn't work. What gfx library are you using?

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

Transparency doesn't work. What gfx library are you using?

Hmm, that's odd. Can you post a screenshot? I use SOIL to load images (mainly png) and OpenGL for rendering.

Link to comment
Share on other sites

Can you show me your pixel format setup code? And did you explicitly enable blending with glEnable(GL_BLEND)?

 

user posted image

user posted image

 

I checked transparency in .png files, and even tried replacing these with 32bit BMP with transparency. No difference. So it's more likely to be in the engine than image loader.

 

I have noticed that sometimes if you don't code exactly to specs, the OGL apps tend to behave a bit differently. So check everything pertaining to alpha channels for buffer and textures, as well as making sure that blending is enabled and your blending function is set. Might help to call the glEnable and glBlendFunc before each rendering pass just in case.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

Can you show me your pixel format setup code? And did you explicitly enable blending with glEnable(GL_BLEND)?

You can view all my source code on my website, the graphics code is in Graphics.cpp. I enable GL_BLEND at the start of the app and do not disable it at all. The same goes for glBlendFunc, i do not touch it once i set it.

Link to comment
Share on other sites

Everything looks good in the graphics.cpp and image.cpp, at least as far as I can tell from just looking at it. I see you use SDL to setup the window for you. I don't know that library, but I don't see anything suspicious. Looks like you ask it for a 32 bit buffer, so it should be working.

 

Can you throw the source into a single .zip file? I can try compiling it on my end and seeing if I can force it to work.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

You can download the source here. It is built using Visual Studio 2005 but will probably compile with a newer or older version. It would be cool if you could get it to compile with gcc or some other compiler, i tried to make it as compiler and platform independent as possible.

Link to comment
Share on other sites

I'm missing SDL and SDL_Config directories. I tried to replace these with copies of Include directory I got from SDL website, but I'm still missing SDL_Config_lib.h. If you can supply me with your copies of SDL and SDL_Config directories, it would probably speed things up.

 

By the way, do you ever check compiler warnings? You are missing new line at the end of just about every single file in there. I'm surprised it didn't cause any serious problems.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

You are missing new line at the end of just about every single file in there.

Oh, come on! Missing newlines are not a compile error, they are only picked up by fussy compilers that are too stupid to detect an EOF. gcc will complain about this but still compiles ok, MSVC has no problem with it. I really don't know what the big deal is about newlines at the end of file.

 

Anyway, i forgot about the SDL components. I built SDL_Config from source and modified a few things to suit my needs, but i should just be able to give you the .lib files for SDL and SDL_Config so you can add them in linking. I will upload them when i get home.

 

That also reminds me that it will be harder to get it to compile with anything other than Visual Studio since it uses .lib files and not .a files that gcc uses. Still, that doesn't make it impossible to do, it just means that i would have to build SDL_Config using gcc/g++ and get the correct lib files for any other 3rd party component (all of which are cross-platform).

Link to comment
Share on other sites

 

Oh, come on! Missing newlines are not a compile error, they are only picked up by fussy compilers that are too stupid to detect an EOF. gcc will complain about this but still compiles ok, MSVC has no problem with it. I really don't know what the big deal is about newlines at the end of file.

It's not an error, it's a warning. And it's not an EOF issue. You need to understand how #include works. It simply replaces the include line with contents of your file. If you don't have a new line, the next line after #include is going to be on the same line as your last line in the file you included. If you have two includes in a row, that can cause problems.

 

Some compilers avoid this by appending a new line. This is NOT correct way of dealing with this, because sometimes, you DO want to merge lines with consecutive includes. Appending new line automatically is a violation of standard, and if your compiler does that, it's a crappy compiler.

 

You should check your warnings list and make sure to address every single one. If it's implicit typecast it is complaining about, add explicit typecast. If it's new line, add new line. You should have no warnings when you compile your code, not just errors. That's good programming practice.

 

Just FYI for the future.

 

 

And I'm using Dev-C++, which is GPP based, but is comfortable enough with .lib format. I'm guessing your concern with the GCC/GPP is for future portability? If I get everything running, I'll send you the make file that Dev-C++ generates. It's not exactly the same as Linux make file, but it is very similar, and should save you a LOT of trouble putting together a Linux/OSX project.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

 

It's not an error, it's a warning. And it's not an EOF issue. You need to understand how #include works. It simply replaces the include line with contents of your file.

Yeah, i googled it shortly after posting and found out that it is actually a valid problem. But it's still a pretty stupid problem IMHO. The standard should be changed so that newlines should always be included by the compiler. If there is a case where you do want an #include on the same line then i should think that it would make the code less readable and so should not be done. But that's just me ranting...

 

 

You should check your warnings list and make sure to address every single one. If it's implicit typecast it is complaining about, add explicit typecast. If it's new line, add new line. You should have no warnings when you compile your code, not just errors. That's good programming practice.

I will check the level of compiler warnings/errors that i have MSVC set at but i think it's already fairly high.

 

 

And I'm using Dev-C++..

I used to use that, until i realised Why i shouldn't use dev-cpp. And a lot of people at GameDev agree.

Link to comment
Share on other sites

I'm aware of the problems, but personally, I prefer them over problems with VC++. If you prefer dealing with that beast, I won't hold it against you.

 

The truth is that there is no good native Windows C++ compiler on the market right now. They all suck. So it's really just a preference of what kind of sucking you can tolerate better.

 

I'll probably eventually switch to GPP under CygWin to make Windows programs. Most likely, some time soon after I install Windows 7 and start working in 64 bit environment. Until then, Dev-C++ does the trick for me.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

I'm aware of the problems, but personally, I prefer them over problems with VC++.

I never said VC++ as an alternative. For the GNU compiler i now use Code::Blocks. Not a whole lot better than Dev-C++ as an IDE but at least it is updated more often and doesn't crash.

 

Now, SDL libraries. I have uploaded them here. If you add them both to the linker it should compile ok. Give me a shout if something else goes wrong smile.gif

Link to comment
Share on other sites

I still need the .h files... Can you just pack up your SDL and SDL_Config folders from your src directory?

 

P.S. I don't use IDEs. I do all my code in Notepad. The only thing I use Dev-C++ IDE for is to keep all the .cpp and .lib dependencies together, so that I don't have to mess with makefile or run commands by hand every time.

Edited by K^2

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

 

I still need the .h files...

D'oh, i knew i'd forgotten something. Anyway, you can get the header files from the SDL website, in fact, you could have built the lib files yourself too, i just thought i'd save you the trouble since i already have them.

I have uploaded the whole SDL packages for SDL, SDL_Config and SDL_Mixer here. You might have to read the docs to find out how to use them (i.e. what header files to include), i'm sorry i can't help you much on that because i set them up with my dev environment a long time ago and i can't quite remember how i did it. You shouldn't need to build any of them, you will need to statically link the SDL_Config.lib and link the SDL libs (SDL.lib and SDLmain.lib, i forgot to include SDLmain.lib in the zip i gave you yesterday so use these ones) and i'm not sure about SDL_Mixer but i think you just need the DLL (included in the Ballistic release) and the header files.

If you don't want to bother with all this then i understand. I'm just glad that you could actually get the release to run, i remember last time i released an early build you couldn't even get that to run.

 

 

 

P.S. I don't use IDEs. I do all my code in Notepad. The only thing I use Dev-C++ IDE for is to keep all the .cpp and .lib dependencies together, so that I don't have to mess with makefile or run commands by hand every time.

Then that is using an IDE. You use it so you don't have to bother with makefiles yet you refuse to use it's editor, why? Do you think that denying yourself luxuries like syntax highlighting and more than one level of undo makes you a better programmer? It just makes you more stubborn and unwilling to accept change. Forgive me if this is not the case, you just seem to come across as that type of person.

Link to comment
Share on other sites

Syntax highlighting I actually like. If I can find a good text editor with syntax highlighting that otherwise works like Notepad, I'd use it. I don't like automatic indents, and I like to have the editor separately from compiler. Also, a built in hex editor would be very nice, especially one where I can select blocks of file to be hex-edited, and the rest to be ASCII edited. Never seen one that does that, though. Maybe I'll write my own one day. Though, I've been saying that for years, and just using Notepad has always been easier.

 

Never used any IDEs under Linux, though. Always relied on makefiles.

 

 

P.S. Would it kill you to use C-style strings?

 

Edit: It compiles now. I had to make a few minor changes to make it work, but nothing significant. Strangely, it refused to link until I changed main to WinMain, but whatever. Still have the transparency issue, so I will work on that.

 

P.P.S. I think I had to compile the DLLs into the code statically to make things work. Do you even use dynamic linking anywhere? If not, why do you include the .dlls with the binaries?

Edited by K^2

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

Sounds interesting, but the game refuses to run for me. I'm using Windows xp and have installed that patch.

The error message says: "This application has failed to start because the application configuration is incorrect. Re-installing may fix the problem."

Maybe I've missed something.. should I install something else apart from MSVC?

 

BTW Is there a linux version?

Link to comment
Share on other sites

Do you have .NET? And what Service Pack version are you running?

 

Edit: Haro, are there multiple graphics threads running within the program? Because the following code added to DrawGLTexture slows the rendering significantly, and hangs it up completely later on.

 

while(glIsEnabled(GL_BLEND)==GL_FALSE){       glEnable(GL_BLEND);}

 

Edited by K^2

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

 

Syntax highlighting I actually like. If I can find a good text editor with syntax highlighting that otherwise works like Notepad, I'd use it. I don't like automatic indents, and I like to have the editor separately from compiler.

This is getting a bit off topic, but have you tried TextPad? You can turn off automatic indenting (as i'm sure you could in most good editors) and it is not tied to a compiler. By default it is set up to use the Java compiler if one is installed, but a Java compiler is not a requirement for TextPad. And you can configure it to use other compilers too, Ctrl+1 compiles Java and i have Ctrl+2 compile with g++. It has a basic hex viewer but not an editor, i quite like HexEdit as a hex editor. The name is not very original (nor is it unique, there are many hex editors named HexEdit) but it is by far the best i have tried.

 

 

P.P.S. I think I had to compile the DLLs into the code statically to make things work. Do you even use dynamic linking anywhere? If not, why do you include the .dlls with the binaries?

Well that was the whole point of including the DLLs, so i thought i was using dynamic linking. Forgive me if i sound a bit n00bish but i still don't fully understand how linking works. I know that i have linked SDL.lib and SDLmain.lib and i did that because that's what the SDL documentation said to do, but i didn't think that statically linked it, i thought i still needed SDL.dll. Maybe not. The SDL_Mixer needs some DLLs for each file format it supports, i have only included smpeg.dll to decode MP3 files but it came with DLLs for OGG and some others as well.

I am not sure if i should statically link everything or dynamically link it. The advantage of dynamically linking to the MSVC runtimes is that they can be updated separately by the system, but i'm not so sure about the SDL stuff. If don't know if it would matter but i would like to have as little external dependencies on my game as possible, although i can just include the DLLs in the directory as i am currently doing.

 

K^2, what system are you running on? XP? If you could narrow down which component is causing the alpha channel bug then we can determine who is responsible for it. I can't imagine it's a problem with OpenGL so it's either my bug or a bug in the image loader, SOIL. If you can get the raw pixel data after the image has been loaded but before the OpenGL texture is created, you can see if the pixels have the correct alpha value. I think the SOIL source is included in the source i gave you so you should be able to step into it in a debugger.

 

 

are there multiple graphics threads running within the program

The only other thread i use other than the main one is for the AI, and i don't make any drawing calls in it. I am currently not using any mutexes or anything, that will have to be the next thing i do otherwise i will start getting really funky bugs that are hard to track down, but i don't see how it could be affecting the graphics.

Link to comment
Share on other sites

I disable textures completely, add glEnable(GL_BLEND) and glBlendFunc(...) calls in the DrawGLTexture(), set color with glColor4f(1.0,1.0,1.0,0.5); and the blending STILL doesn't work. What's worse, if I try to confirm that glEnable(GL_BLEND) even worked with glIsEnabled(GL_BLEND) I get GL_FALSE. If I keep running it on while(glIsEnabled(GL_BLEND)==GL_FALSE)glEnable(GL_BLEND), it takes a while to get past that loop, and then still refuses to work.

 

So it's certainly not SOIL. It has to be either in SDL itself, or it does something to OpenGL that breaks things. Or worst case scenario, there is a serious memory leak somewhere that is affecting the program flow. That can explain why it doesn't happen on all versions of Windows the same way.

 

And yeah, I have XP Pro with SP2.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

 

...So it's certainly not SOIL. It has to be either in SDL itself, or it does something to OpenGL that breaks things. Or worst case scenario, there is a serious memory leak somewhere that is affecting the program flow. That can explain why it doesn't happen on all versions of Windows the same way.

I don't think SDL touches OpenGL too much. It uses DirectX for it's drawing routines (on Windows) but you can set it up so that you can use OpenGL functions instead. Still, something might be going wrong when i setup SDL to use OpenGL. Here is the tutorial that i used to setup OGL with SDL.

 

 

And yeah, I have XP Pro with SP2.

Yeah, same as me (actually, i might have SP3) so that rules out the OS to some degree. Perhaps you should check the version of OpenGL you have, or maybe the graphics card (that is not something that i know a lot about so i'm not sure if that would affect it).

Link to comment
Share on other sites

Why are you even using SDL for graphics if you are rendering with OpenGL anyways? That seems really silly to me.

 

Interestingly, if I disable acceleration, everything works the way it is supposed to. Hmm....

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

 

Why are you even using SDL for graphics if you are rendering with OpenGL anyways?

No, i'm not using SDL for graphics, i'm using OpenGL. That's what i said in my last post. You can use SDL's graphics functions which use DirectX internally but i don't use them, i use OpenGL. As far as i know, you don't "turn off" SDL graphics, you just pass SDL_OPENGL to SDL_SetVideoMode and start using OpenGL. I'm not sure if you can mix calls to OpenGL and SDL's graphics functions, but i don't.

 

How did you disable acceleration? Do you have a (reasonably) good graphics card on your PC that can handle hardware acceleration? I am only using a laptop with basic Intel video card so i figure if it works on mine it can work on any... i guess not sad.gif

 

@GTArv: you might need the MSVC redist package that i talked about earlier. If you do have it then maybe it's a different version (if that matters). I will have to read up on how to package my game for release.

Since i am still heavily in development i probably will try to get more of my game done before i release another version so if it doesn't work for anyone then at least you can look at the pretty screenshot on my website smile.gif

Edited by Haro
Link to comment
Share on other sites

I have an 8800GT, and I simply disabled the acceleration in the troubleshooting. I doubt you are running this sans-acceleration, because when I do this, things get REALLY slow.

 

And you are still using SDL for graphics inits and buffer swapping. That's mainly what I'm talking about.

 

I'm going to see if I can take out all video calls via SDL and see if it still does the same thing. I have a feeling it's going to fix things.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

 

And you are still using SDL for graphics inits and buffer swapping. That's mainly what I'm talking about.

Well according to the tutorial (that i linked earlier), i still need to setup graphics using SDL by calling SDL_Init(SDL_INIT_VIDEO) and then telling SDL that i will be using OpenGL for the graphics by passing the SDL_OPENGL flag to SDL_SetVideoMode.

As for swapping buffers, SDL_GL_SwapBuffers() is (as the name suggests) the SDL function to swap the OpenGL buffers.

 

If i don't use SDL to setup OpenGL then i would need to get the HDC of the window and that would be Windows specific. At least using SDL i can port to other platforms relatively easily. If you can figure out how to setup OpenGL without using SDL, and get it to work, let me know.

 

EDIT: also try setting different OpenGL attributes with SDL_GL_SetAttribute, such as the depth size. Also check the return result to make sure there is not an error

Edited by Haro
Link to comment
Share on other sites

Your platform specific code would consist of opening the window, getting its hardware context, setting up rendering context and pixel format, and swapping buffers. That is it. This can ll be placed in your ballistic.cpp, and it would be the only file you'd need to replace if you were to change platforms.

 

 

EDIT: also try setting different OpenGL attributes with SDL_GL_SetAttribute, such as the depth size. Also check the return result to make sure there is not an error

First thing I tried. No difference.

 

Edit: Ok, I took out SDL completely. (Temporarily lost event system in the process, but I can fix that if need be.) Problem persists, however. So something else is going on.

Edited by K^2

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

  • 2 months later...
ghost of delete key
Syntax highlighting I actually like. If I can find a good text editor with syntax highlighting that otherwise works like Notepad, I'd use it. I don't like automatic indents, and I like to have the editor separately from compiler. Also, a built in hex editor would be very nice, especially one where I can select blocks of file to be hex-edited, and the rest to be ASCII edited. Never seen one that does that, though.

Have you seen Notepad++?

 

It does everything you mentioned (except maybe tha ASCII/hex thing, but it does display both), and is highly extensible and configurable. (it even has tabbed pages like Firefox smile.gif )

There is a large community that supports it, and there are more plugins for sweat-saving than you can shake a stick at.

I haven't dug too deeply into it, but I believe that there are plugins for something like intellisense and code completion if you wanted it. Or you could write one.

 

 

I'm surprised nobody's mentioned Notepad++, it can't be such a secret. colgate.gif

It's the only text editor I use now.

scagv35.jpg


"I can just imagine him driving off the edge of a cliff like Thelma & Louise, playing his Q:13 mix at full volume, crying into a bottle." - Craig

Link to comment
Share on other sites

ghost of delete key, you do know this is a 3-month-old thread, right?

But as for your suggestion, yes, Notepad++ is a good alternative to plain old Notepad. Personally, i use TextPad, but everyone i work with uses N++ for some reason or another and i even use it myself for some things.

 

Anyway, while i'm here i might update you all on my game. I have successfully built an installer for it and tried it out on an XP VM at work. I noticed the same transparency problem that K^2 mentioned. It also was using about 60% CPU for rendering alone. But since it was running in a VM which doesn't support hardware acceleration i guess that's no surprise.

I also tested it on my Vista machine and it seemed to work fine.

Funny thing is, i tried it again on the VM and i didn't get the transparency problem. So i really don't know what could be going on there.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.