• Content count

  • Joined

  • Last visited

  1. OpenGL API and structures

    Why OpenGL 1.x does not contain structures is not a question I have a direct answer for, but my assumption is that it would be better designed that way so driver developers can keep the most complex stuff internal and privatized in their driver code. Not sure if you know this already, let's take a brief look at why OpenGL came about in the first place. Before OpenGL was even thought of, there was an API called PHIGS back in 198x. From what I've read, the main issue with PHIGS is that ultimately it didn't give the developers what they needed in many instances. So SGI initially created Iris GL, which eventually became the basis for OpenGL in January 1992. Unlike PHIGS, OpenGL had a simplified state machine and supported an "immediate mode" rendering component. AFAIK, simplicity was the overall goal, while having a standard that graphics hardware could support via software or hardware all across the board and with little setbacks as possible. Prior to what we have today, programming graphics hardware was quite a task and all sorts of structs were everywhere. I mean, if you take a look at how NVIDIA's gfx registers were laid out and accessed back in 199x (hello NV1 and Riva128), you'll see that each channel is just a series of structs. OpenGL was meant to simplify graphics programming greatly. Keep in mind that it was not originally designed for games, but for CAD, 3D simulations, and so forth. Not that it really matters though... This is just my two cents. If I'm wrong about any of this, someone feel free to correct me. Shogun
  2. How to stay motivated?

    Wow, I didn't realize that this thread was still active! In case you are all wondering, have things gotten better since then? Actually no, things have gotten MUCH worse. Do I feel the same? Honestly, no. In fact, I feel more motivated now. I've quit binge drinking too! Right now I am living with mom and pops for a while since I can't afford my place anymore and still broke as a joke. But at least I have a part time job doing game testing for Win10/Xbox Game certification. I'll likely be doing this until I can get something better. Since I'm far away from the job now, I have to commute about 4-5 hours a day via bus, but I scraped up enough money to get a used Surface Pro to work on my game's UWP port for Dream.Build.Play. I'm going to submit my game to this contest before the end of this year and hopefully win some money or exposure. You just have to: Stop complaining. There's always someone that has it worse and deals with a greater set of challenges than I do. I mean really, I have Microsoft contacts, id@xbox access, the business card of a Sony publisher, and more. Plus Josh said stop Keep on keeping on. Leverage your advantages, build smart solutions to overcome your disadvantages. Stop drinking! Killing your brain cells and trashing your liver isn't going to help. So even though I've had no breakthroughs and things have gotten far worse, I feel more motivated. Ever hear the saying "I'm sick and tired of being sick and tired?" Well, I'm sick and tired of saying that I'm sick and tired of being sick and tired. That's enough, let's just move forward! Shogun
  3. Not sure how many of you would care about this, but today is Windows Developer day, and Microsoft has been having a live stream today. So far, it's been pretty interesting, for both games and non-game apps. It's mostly on UWP (which everyone seems to hate), but I'm taking advantage of UWP for my game. One bit of good news is that (IIRC) Microsoft will allow UWP games to access the full GPU and other resources. Curious what you all think of this, as well as if you share the opinion that Microsoft is practically *begging* developers to support UWP at this point. Shogun
  4. Wow, didn't realize I had more responses to the thread... Anyway, I'm fixed it "forrealzees" this time. Using the roxlu portable nanosecond timer in place of my millisecond one, then converting the numerator from 1000 milliseconds to the appropriate number (1000*1000*1000), it appears to work fine this time. Even without Vsync, ran nicely at 120+fps. It was a combination of a low resolution timer plus my own spawning code was causing some entities to spawn yet rapidly disappear! Since it happens in the blink of an eye, it was a rather hard bug to catch until today. So far, no more spawning issues! Now to try it on my desktop Mac and PC, as well as mobile devices. If only I had one. All of my monitors are 60hz only Shogun.
  5. Yes, now I am finding the flaws as they surface. Sometimes after coming out of the background or a suspended state, the FPS calculation will spew a really high number and cause the game to move rapidly for one second, then go back to normal. This will result in death many times for the user. So yes, I dun f@#%ed up even more. The entire gameloop is too large and is a complete mess (I'll never code a game this way ever again). The delta_speed variable is a percentage that is multiplied against the entity's speed value so that it moves at an adjusted speed based on frame rates. I am not accumulating time as I did not plan this thing ahead or even consider the need for time based movement when I originally wrote it. Then when primitive counts started reaching the millions, frame rates dropped and then I realize "I dun screwed up". The loop is updated further down. I forgot to add that. If milisecond timing is a bad design choice, then I will do a way with it pronto. I wasn't aware of the poor accuracy, and if the margin of error is that great, then I'll most definitely stop using it. I wrote that half arsed timing function out of laziness. Speaking of high resolution timers, I'll need one that's portable to all three major OSes. Which I did find here: /* ----------------------------------------------------------------------- */ /* Easy embeddable cross-platform high resolution timer function. For each platform we select the high resolution timer. You can call the 'ns()' function in your file after embedding this. */ #include <stdint.h> #if defined(__linux) # define HAVE_POSIX_TIMER # include <time.h> # ifdef CLOCK_MONOTONIC # define CLOCKID CLOCK_MONOTONIC # else # define CLOCKID CLOCK_REALTIME # endif #elif defined(__APPLE__) # define HAVE_MACH_TIMER # include <mach/mach_time.h> #elif defined(_WIN32) # define WIN32_LEAN_AND_MEAN # include <windows.h> #endif static uint64_t ns() { static uint64_t is_init = 0; #if defined(__APPLE__) static mach_timebase_info_data_t info; if (0 == is_init) { mach_timebase_info(&info); is_init = 1; } uint64_t now; now = mach_absolute_time(); now *= info.numer; now /= info.denom; return now; #elif defined(__linux) static struct timespec linux_rate; if (0 == is_init) { clock_getres(CLOCKID, &linux_rate); is_init = 1; } uint64_t now; struct timespec spec; clock_gettime(CLOCKID, &spec); now = spec.tv_sec * 1.0e9 + spec.tv_nsec; return now; #elif defined(_WIN32) static LARGE_INTEGER win_frequency; if (0 == is_init) { QueryPerformanceFrequency(&win_frequency); is_init = 1; } LARGE_INTEGER now; QueryPerformanceCounter(&now); return (uint64_t) ((1e9 * now.QuadPart) / win_frequency.QuadPart); #endif } /* ----------------------------------------------------------------------- */ Since this game is cross platform, it has to work on everything. If nano seconds are the way to go, then I'll use that instead. And yes, using the frame rate isn't really a reliable way to do this (it blew up in my face). I found that using a fixed value will give me consistent results. A fixed delta doesn't generate any issues for me. Shogun
  6. my personal future in game programing

    Curious what country you are in? Spain? Eastern Europe? I guess I shouldn't have assumed you live in the same country I do, Murica Sorry, it's a bad habit. Can't say I recommend you come here if you are living elsewhere (I sometimes wish I could be elsewhere). So I was told that Sweden has more jobs and that it would be easier to find work there. If you have friends in Sweden, try reaching out to them and see if you can at least use them as a reference. Every leg up helps. Shogun
  7. my personal future in game programing

    First of all, why do you want to contract/freelance? If you plan to do game dev for a living, then I strongly do not recommend this route. I have been a contractor for years, and I've grown sick and tired of it (I can't get a full time position anywhere here to save my life). You would be better off just getting a full time position at a game dev company (maybe a well managed startup) and establish yourself that way. If this is going to be something part time and not your main source of income, then that's fine. Second, where do you live? Location is often key to your success not in gamedev only, but in software engineering as a whole. If you are in sillicon valley or areas with good tech jobs, then you should try going to development events and meeting people. In this industry, it's not all about what you know, but WHO you know. Knowing someone behind the scenes can be the difference between landing your dream position in the long term or the contractor who is unemployed for months on end between contracts. Even if necessary, you may have to take some game testing position(s) to get your foot in the door. Testing sucks but that's how I got started. If you aren't in a tech oritented area, then you might want to move. This is what I did also. Lastly, if you want to get started right away, try freelancing on A co-worker of mine recommends it and he gets work from time to time there. So if you do, work on building your profile, take some time to make a good one, and you may get some really neat projects to work on. So by all means, give it a go. There's an occasional game project there too, but make sure that you are working with competent people. Shogun EDIT: If you do come to a tech oritented city for a job, I highly recommend avoiding Seattle. There are people fleeing California and other places for the jobs and you will likely have an extremely hard time getting anything up here. I have 7 years of experience and I've been out of a proper dev job for over 8 months and there's no end to this BS in sight. At this point I want to leave and maybe go to Portland instead.
  8. Windows Mouse Handling Sucks

    Wow, I did not know that. Heh, learn something new every day! Shogun
  9. Windows Mouse Handling Sucks

    In my opinion, of course... My game not only needs to know if the mouse is currently out of the game's window, but also the position of the cursor relative to the window as it moves outside. MacOS and Linux give me this by default, but for Windows, I had quite a bit of trouble finding a reliable way to do it. This isn't the first time I've had issues dealing with Window's mousing handling. It's been a pain in my arse multiple projects. #if defined(_WIN32) && !defined(_WINRT) /* Because Windows mouse handling sucks in general compared to Mac/Linux, a little extra work is required to find out if the cursor is outside of the game's window to prevent cheating. In my experience, the reliability of GetCursorPos and ScreenToClient vary from one comp/OS to another, so a better idea is to check every frame and use those resulting coordinates only if it tells us we are off screen. No disrespect Microsoft, but why do you insist on making such trivial things a pain in my behind sometimes? */ struct vec2_t<float> bounds; This->get_bounds( bounds ); POINT pt; GetCursorPos((POINT*)&pt); ScreenToClient(GetActiveWindow(), (POINT*)&pt); if( pt.x < 0 || pt.x > bounds.v[0] || pt.y < 0 || pt.y > bounds.v[1] ) { This->mouse_move_func(pt.x, pt.y); } #endif So yeah, I can't believe it took me that long to get this stupid thing figured out. Anyone else have the same problem before? Anyone else come up with a better solution? I'm just glad it works.... Shogun
  10. Although I see that link shared alot, it actually made my timing issues worse for this particular game. In the future, I'll be sure to follow that guide to avoid future headaches. Also, I fixed the problem. Instead of using frame times, I used my game's actual frame rate divided by 1000. Now it works perfectly (so far). L. Spiro is going to kill me if he reads this, but I just want this game to work! Thanks. Shogun
  11. One of the biggest reasons why I haven't released my game is because of this annoying timestep issue I have. To be frank, this game was poorly planned, poorly coded, and was originally written as a small tech demo and a mini-game. Now it has evolved into a fully featured (and very messy code base of a) game. If you thought Lugaru was bad, Looptil is far worse! So what happens is that the delta is not really consistent. Sometimes enemies don't spawn fast enough because the delta isn't even consistent at 60fps, which is a big reason why the game is broken. static uint64_t last_time = 0; uint64_t current_time = time_get_time(); //( get_current_time() * 1000.0f ); int fps_limit = 60; float frame_time = float( current_time - last_time ); if( last_time != 0 ) This->m_delta_speed = frame_time / ( 1000.0f / 60.0f ); And this is my timing function: uint64_t time_get_time() { #ifdef _WINRT return GetTickCount64(); #endif #if __ANDROID__ /* TODO: Fix std::chrono for Android NDK */ uint64_t ms = 0; timeval tv; gettimeofday( &tv, NULL ); ms = tv.tv_sec * 1000; ms += tv.tv_usec / 1000; return ms; #else std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); std::chrono::system_clock::duration tp = now.time_since_epoch(); std::chrono::milliseconds ms = std::chrono::duration_cast<std::chrono::milliseconds>(tp); return (uint64_t) ms.count(); #endif } Now I know some of you will cringe when you see GetTickCount64(), but that's the only function that gives me reliable results on Windows 10 (UWP) ports, so that's staying. One more thing to note here, my game has a badly written game loop. It uses a switch statement, followed by draw_game_mode(), update_game_mode(), so I kinda screwed myself there. I tried changing it, but it broke the game completely, so I left it in it's messy state. Is it possible to simply just have a proper delta calculation function? Because it's adjusting itself based on the current frame time. This may not be the best of ideas, but it was something I whipped up because I needed to have this run okay when it goes down to 30fps without running half the speed. This works in general, but it's innacurate and causes problems. Any ideas? Thanks. Shogun EDIT: Feel free to ask anything in case I missed a vital detail. My lunch break is ending and it's time for me to go. Thanks.
  12. How to stay motivated?

    I'm curious on how you all stay motivated to work on your games and such. This used to be an easy thing for me. Now, not so much... I'm not trying to give you all a sob story (I've had worse; been homeless before) but The past months since late October have been really depressing and a real downer. Been out of steady work for 8 months (seattle's available job pool is dwindling and nobody wants to hire full time so I might leave), and now here I am working in a white collar sweatshop 8.5 hours a day, commuting 3+ hours a day, and very little time to myself. The pay isn't even the are minimum to get out of debt due to not having a job, and I literally have no money to myself. Everything goes to rent so I don't end up homeless again. When I do get home, I'm mentally exhausted and feel as if every brain cell in my head is busted. When that happens I can't seem to carry a thought in a bucket so I just go to bed. Cycle repeats. So how do you all stay motivated? For me it's a constant struggle not to get depressed and start drinking again. I have a game that's almost ready to be released but I have no money to do so. It's already cross platform with lots of great pier reviews too. I even had a Sony publisher take interest in it, plus I got id@xbox approval too, but my financial situation sucks. I spin my gears at max speed but I feel like I'm getting nowhere fast. Once again, I'm not asking for you to pity me or for sympathy because I'm done crying over it. Life sucks and that isn't going to change for everyone. What I AM asking is how to stay motivated even when everything looks hopeless and there's no way out? How do you all handle it? Thanks, Shogun
  13. HTML5 RSS Feed w/ matching style?

    Wow, this is more complex than I thought! It's times like this I wish I could just pay someone to do it for me. But either way, I will get it done, one way or another because it's gotta get done. I'll be honest here, I don't know jack crap about server side, jQuery, ajax, etc. I only know about HTML5, Javascript and XML. Everything else you said is like greek to me, so I'll have to take some online courses. Thanks fastcall! Shogun
  14. Since the general programming forum was nixed, I hope that it's still okay to post such a question here. Mods, if it doesn't belong here, feel free to move it. Thanks. Since I am not a web developer, I am having trouble getting this automatically generated RSS feed to match the style of my webpage. What I used was a pre-written template and went from there. So to be honest, I don't know jack crap about CSS, but I understand the basics of HTML (I need to be more like fastcall22). This is the code to my RSS feed that rssdog generated: <iframe width="100%" height="750" class="rssdog" src=""></iframe> For those of you that need it, this is a link to the website that generated it: And last but not least, this is a link to my website: Since I'm getting ready to make a submission of my game to id@xbox, I really would like to have my blog used to display project updates and so on. I know, I'm really anal about stuff like that, but I want to make the best impression I possibly can because as a poor indie without a dime in his name and one paycheck away from losing everything, I have little to no room for error. Any ideas? Thanks. Shogun
  15. Seattle's cost of living isn't too bad (even though housing prices have nearly doubled in the last 7-8 years) if you are making at least in the $40k-ish range, but I've made more than double that so I got comfortable rather easy and had plenty of disposable income before. Seattle is still far cheaper than, let's say, NYC. SF, however, is far worse. I don't believe it would be worth it. I've been considering Oregon, such as the Portland area, but apartments and rental houses are more expensive there. If I get another call about a job in Hillsboro for Intel, I'm taking it. Shogun.