Jump to content
  • Advertisement

Finalspace

Member
  • Content count

    565
  • Joined

  • Last visited

Community Reputation

1193 Excellent

About Finalspace

  • Rank
    Advanced Member

Personal Information

Social

  • Github
    f1nalspace
  • Steam
    finalspace

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. This is how i done it successful in the past. A system should have some sort of list of component types it requires + a list of optional component types it may need. A system contains a list of entities which always passes those type requirements. This list of entities are automatic populated as soon as a component is added/removed to/from a entity. When the system runs, it just iterate over that list, gets it components it needs, does the data transformation and its done. This way the system just updates the entities it cares and doesent care about anything else. But for heavy mathy stuff, this is not efficient. You always want to process just the data you care and nothing else. For that a data-oriented approach may be better, see the following video for a much better explanation: https://youtu.be/rX0ItVEVjHc?t=1941 Meaning that copy the data over to small designated structs, process them and then copy they back may be faster than operating on the components directly. Also this implementation is not suitable for scenarios where you do tons of component add/remove operations while the game is running. If you have something like that, you need a different approach.
  2. This will be a post mortem explaining how i failed the game dev competition for a tower defense game, so here it goes. In the start of june 2018 i found the tower challenge post by accident, read the description and was really excited. So i decided to apply and started right away - without any planning whatsoever. I created a new visual c++ project and after 3 evenings with a couple of hours i got the basic game mechanics nailed down: Enemies could be spawned and moved from waypoint to waypoint along a direction and randomly placed towers could hit and destroy it. Everything (tiles/enemies/towers) was defined in static int arrays, so i can adjust it however i like. It was going very smoothly and i was very happy with it. The next 2 evenings was a nightmare. I made a new map and suddently everything was broken. All the towers was shooting randomly, the enemies was not following the waypoints anymore, bullets missed all the enemies and so on, even the spawning was behaving weirdly. So it took me 7 hours to find all those bugs and fix them. After that in the next evening i refactored the current code, made it more robust and fixed a few bugs. In addition i added basic HUD rendering to display lives, score, money, current wave, etc. Now it was looking really good so far and the game was already playable. The next day for whatever reason i decided to use the editor "TileD" to setup everything. I have no idea why i wanted that, maybe i thought it would save me time or something but i was wrong. Even after 5 evenings, i still couldnt´t figure out how to get towers/enemies/waves defined in the TMX file. So i partly gave up on that idea and ended up just defining the walkable tiles and the waypoints in the TMX file. In addition i created a shitton of code just to parse a TMX file - including writing a generic xml parser in C99. The only thing useful i made in that 5 evening was that parser 😞 This entire process took me ~20 hours -> 4*8 useless workhours minus 2 hours for writing the xml parser. After that the next 3 evenings i did of lot of refactoring needed to get the TMX loaded in the way i wanted. The result was not that bad. I now could define all the waypoints, the walkable and placeable tiles in the editor and setup as many spawners as i want. This took me about ~6 hours. The next 2 evenings was a blast! I was very productive and added a lot of functionality and fixed a lot of bugs. I now had a fine looking HUD , multliple waves with multiple spawners for each wave. In addition i improved almost every part of the game, even the towers was rotating smoothly against the target now and you could lose or win the game. The "game" finally started to take shape. Of course after a blast, there comes the opposite of that: Destroying and unproductivity! In one evening i broke the tower rotation, the enemy position prediction, the rendering and even the HUD. Why of a sudden did everything brake? It may be that i just wanted to make it "even better" -> Over complicating simple things! In the following evening i reverted everything and simplified a lot of the game mechanics. Now all of a sudden the enemy prediction worked and the tower rotation was correct and very smooth. But the font rendering seems to be totally broken now - after switching to a new font. So i had no choice to still use the old font 😞 Many evenings later with a lot of delays between, i finally fixed the nasty font rendering bug. It took me over 10 hours to find that bug and 5 seconds to fix it... Now the new font or any other font works just fine. In addition i made a few simple functions to render and handle UI buttons - to select the appropriate tower. Now i got sick i could barely do anything, so i was of for over a week. After that i wanted get rid of the ugly dev graphics, so in 2 hours i made a push rendering system + opengl implementation and changed everything to it. It looked exactly the same as it was before, but now it was much more flexible and i finally could add sprites to the game. The next day i successfully added loading and rendering of sprites in just about 30 minutes. Then i searched the net for a free tileset, which i can use to test the sprite rendering. After i found one, i changed the TMX map to use it. The following 4 evenings i have written a lot of code for parsing/converting/rendering the tilesets from the TMX, but with wrong results. All the UV´s was incorrect and even after spending hours of debugging i could not find the bug at all. Now there was a full week where i didn´t do anything. The motivation was gone. The first evening in the following week i was still not motivated at all, but i wanted to get this finally fixed so i forced myself to analyze the code again - searching for the UV bug and after a short amount of time, i finally found the bug... It was just a typo... After fixing that typo now all the UV´s was correct and everything looked fine. In the next evening i added 3 more layers to the TMX map, trying to make it look more prettier. But there was a problem, the fixed map dimension was not sufficient to make use of the tilesheet i was going for. So i decided to change the entire system from a fixed map size to a dynamic one and this was pretty expensive from a time perspective, it took me around 2-3 hours. Now i had just a few days left before the deadline. The following days i moved all the wave/enemy/tower definitions into separated xml files, so i can starting making the actual 20 waves/enemies and a few towers. Of course this required me to change a lot of the internal systems, but the written xml parser now payed of and in an hour it was changed very easialy. Now i started to fiddle around with the data, trying to add more waves, more towers... Such tasks are not my thing, so it took me two hours just to add another wave and another tower 😞 So now i had one day left before the deadline and the game was not even close to be finished. I had one level, two waves, two towers, two enemies and very basic game mechanics working, without upgradable towers. Also i had no final art, no sound or music, not even a menu 😞 The following days i was really depressed about it, so i was not working at the project at all, so i failed and missed the deadline. So now comes my reasons why i failed it: 1.) I didn´t plan anything I had no idea which art style i was going for I had not slicest idea what type of waves/towers/enemies i want I had no idea how the level should look like I didn´t set any goals or milestones or tasks whatsoever 2.) Forcing myself to use the TileD editor was a huge mistake For such a little project, one level should be just fine. So why the heck do i need a editor when i just want to have one level anyway? The only thing i needed to setup in the editor was the visual tiles, the walkable and placable areas and the positions for the spawners and thats it. 3.) I added a lot of complexity without thinking it through At work i always do that, but for some f*cking reason on private projects i never do that and that always kills me. I should have sticked with the simplest solution in all cases, then i may had finished it in time. 4.) I didn´t continously worked on the game There was too many days of me not working on the game at all. I should at least made one little thing each day or something like that. But not everything was bad, at various point i made a lot of progress and the last build i made was not that bad. It was playable, you can win or lose the game - it just lacks content in a all places, so i decided to finish the game to end of september - to have at least one finished game made in my life. Thats almost two month´s from today - counting just the days, that should be doable - even with my limited time budget.
  3. Finalspace

    Towadev

    A simple technical tower defense 2D game
  4. To translate to modern OpenGL 3.3+ you have to: 1.) Build the matrix stack yourself, as every gl*Matrix* function is deprecated 2.) You cannot use any glBegin(), glVertex*(), glColor*() functions anymore -> Use VBO instead. 3.) You cannot use glClient*() related functions, such as glClientActiveTexture or glEnableClientState 4.) You need to use at least one active shader program, because there is no function pipeline anymore 5.) You need a active vertex array, otherwise you wont see anything (Some drivers have a default VA bound, so keep that in mind) For more details see the following tutorial: https://ahbejarano.gitbook.io/lwjglgamedev/
  5. "thebennybox" has a very good tutorial for 3D software rendering: https://www.youtube.com/channel/UCnlpv-hhcsAtEHKR2y2fW4Q
  6. Solved. The function was almost correct. Using uint32_t as a buffer was my mistake. It must be unsigned long instead! Also the RGBA byte swap was required, otherwise you get a weird or blank icon.
  7. I want to set a icon in Linux/X11 at the start of my C++ program. The following code i tried does not work at all - nether in XFCE or Gnome or KDE. Did i something wrong here, i dont see any mistakes? fpl_internal void fpl__X11LoadWindowIcon(const fpl__X11Api *x11Api, fpl__X11WindowState *x11WinState, fplWindowSettings *windowSettings) { // @TODO(final): Setting the window icon on X11 does not fail, but it does not show up in any of the bars // In gnome/ubuntu the icon is always shown as "unset" int iconSourceCount = 0; fplImageSource iconSources[2] = FPL_ZERO_INIT; if (windowSettings->icons[0].width > 0) { iconSources[iconSourceCount++] = windowSettings->icons[0]; } if (windowSettings->icons[1].width > 0) { iconSources[iconSourceCount++] = windowSettings->icons[1]; } if (iconSourceCount > 0) { int targetSize = 0; for (int i = 0; i < iconSourceCount; ++i) { targetSize += 2 + iconSources[i].width * iconSources[i].height; } // @MEMORY(final): Do not allocate memory here, use a static memory block or introduce a temporary memory arena! uint32_t *data = (uint32_t *) fplMemoryAllocate(sizeof(uint32_t) * targetSize); uint32_t *target = data; for (int i = 0; i < iconSourceCount; ++i) { const fplImageSource *iconSource = iconSources + i; FPL_ASSERT(iconSource->type == fplImageType_RGBA); *target++ = (int32_t) iconSource->width; *target++ = (int32_t) iconSource->height; const uint32_t *source = (const uint32_t *)iconSource->data; for (int j = 0; j < iconSource->width * iconSource->height; ++j) { // @TODO(final): Do we need to swap the byte order of the icon in X11? #if 0 *target++ = (iconSource->data[j * 4 + 0] << 16) | (iconSource->data[j * 4 + 1] << 8) | (iconSource->data[j * 4 + 2] << 0) | (iconSource->data[j * 4 + 3] << 24); #else *target++ = *source; #endif } } x11Api->XChangeProperty(x11WinState->display, x11WinState->window, x11WinState->netWMIcon, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) data, targetSize); // @MEMORY(final): Do not free memory here, see note above! fplMemoryFree(data); } else { x11Api->XDeleteProperty(x11WinState->display, x11WinState->window, x11WinState->netWMIcon); } x11Api->XFlush(x11WinState->display); }
  8. Finalspace

    Scrum metodology

    My wife works in a heavy agile environment and what i heard about is not that bad, but not great either - because it does not work for all customers. There are customers which always think in the waterfall method and does not want to get involved in the development process at all -> They want a fixed price, a fixed feature set based on a hard specification book. Other customers misuse the system to get features for free - using the blaiming scheme -> "It does not work as intended" > "Change it!", even though its 100% implemented as descriped in the product/backlog. But there are definitly customers which seems to be happy with the system as well. I personally dont work in a agile environment, i just had two professional trainings for SCRUM and know the basics - so i can at least apply for jobs which requires it.
  9. Finalspace

    Tower Defense almost over!

    I didn´t make it, there was too much stuff going on. Right know i have a playable prototype with bare minimum game mechanics and dev gfx, but nothing more. I even didn´t had time to create a short video showing my progress 😞 Maybe i will write down a blog entry about what went wrong...
  10. I have more than one implementation for a function, so i dont want to go this route 😞 And each implementation should always do exactly for what the function is intented/named, so there are no difference in documentation for each implementation. Oh great, that looks promising so i will try that macro Regarding two files policy: I agree for medium to large projecs - but for smaller ones i like to have just one translation unit only. *Edit: Awesome the intellisense macro work like a charm Thanks again!
  11. Finalspace

    include video files in OpenGL...

    You can use the FFmpeg library to read/decode almost any video file format. FFmpeg is fast and very stable, but it is a pure low level api, so you dont get any high level functions like -> PlayVideo or GetPicture. You have to manage packet/frame queuing/decoding yourself, but its not that hard if you know how to properly code multi-threaded queues and stuff. The hard part is to syncronize audio/video properly, but even There is a wonderful tutorial out there, which explain everything you need to know how to play a video - including sound: http://dranger.com/ffmpeg/ To get started, grap the shared libraries as well as the development package for version 4.0 from: https://ffmpeg.zeranoe.com/builds/ Also i have written a short video player using pure FFmpeg 4.0 based on my platform abstraction library. You can find the demo here.
  12. I have written a couple of single header file libraries and all are fully documented using doxygen style in the header part. As soon as i start using the functions in a project, no documentation will show up in intellisense - regardless of the documentation style (XML style does not work either). However the implementation does not have any documentations whatsoever and i dont want to duplicate the same documentation block over and over again. Example: #ifndef MYLIB_H #define MYLIB_H /** * \brief Returns a length squared by the given two parameters * \param x X-position * \param x Y-position * \return Distance by X and Y */ int mylibGetLengthSq(float x, float y); #endif // MYLIB_H #if defined(MYLIB_IMPLEMENTATION) && !defined(MYLIB_IMPLEMENTED) #define MYLIB_IMPLEMENTED float mylibGetLengthSq(float x, float y) { float result = x * x + y * y; return(result); } #endif // MYLIB_IMPLEMENTATION How do i change that, so that documentation are used from the header file only or ignoring the not defined implementation documentation. Is that possible? Of course if i include the implementation in a separated C/C++ file, it works correctly - but i want to prevent that. Is there any way to mark a function implementation as (Never ever try to parse documentation from here)...??
  13. Finalspace

    Incorrect angular collision response

    Haha thats so great - its almost exactly the same mistake i did after i transformed old java code from my old physics engine into c++ - resulting in that: https://www.youtube.com/watch?v=r7rmuB0H1Is Physics programming is always fun ;)
  14. Finalspace

    Why are enums broken

    Thats it - great that somebody actually brings that up! And guess what, i am one of such a person who actually only uses the features that they want and dont accept new ones until i evaluated and weighted them by a lot of categories.
  15. In OpenGL you can have subpixel accuracy when bilinear filtering is active. So a fragment is one of that subpixels, but when nearest filter is active - a fragment equals one pixel. Also a fragment is always a filled portion of a geometric object, such as a triangle, quad, etc - A pixel is just one point on your screen - not necessarily to be filled. Oh and fragments are defined in clip-space and pixels are obviously in screen space. https://www.khronos.org/opengl/wiki/Fragment_Shader And if you are really want to know how a 3D renderer such as OpenGL works, you can check out: https://www.youtube.com/watch?v=Y_vvC2G7vRo&amp;list=PLEETnX-uPtBUbVOok816vTl1K9vV1GgH5
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!