Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    16
  • comments
    35
  • views
    17251

Project: Towadev

How i failed the tower defense GD competition

Sign in to follow this  
Finalspace

910 views

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.

Sign in to follow this  


0 Comments


Recommended Comments

Great writeup! :) And I don't know about anyone else but I find analysing where things went wrong just as (or more) useful than cases when things went according to plan.

Definitely it sounds like trying to make a map editor was a big ask, I saw that both Awoken and Eddie struggled with doing the map editing functionality AND the game at the same time, whereas those of us who did the maps procedurally had an easier time. And it sounds like writing the code for drawing sprites too was making it a big job, compared to using some kind of engine or library.

Share this comment


Link to comment
10 hours ago, lawnjelly said:

Great writeup! :) And I don't know about anyone else but I find analysing where things went wrong just as (or more) useful than cases when things went according to plan.

Thanks! Its my first time critizing myself in a blog like this so i had no idea how this will go.

10 hours ago, lawnjelly said:

Definitely it sounds like trying to make a map editor was a big ask, I saw that both Awoken and Eddie struggled with doing the map editing functionality AND the game at the same time, whereas those of us who did the maps procedurally had an easier time. And it sounds like writing the code for drawing sprites too was making it a big job, compared to using some kind of engine or library.

Yeah, writing a editor for such small projects are just overkill - especially if you dont have time for that. But using a existing one which is not suitable for your game is much worse - like in my case. i think it would have been better when i have written it myself - especially because i have a dozens in the past already and i know how this things are implemented.

10 hours ago, lawnjelly said:

And it sounds like writing the code for drawing sprites too was making it a big job, compared to using some kind of engine or library.

I always have the requirement to write everything myself, not using any engine or thirdparty library. I dont mind fighting against technical issues. Also i normally dont have technical issues, because i already did all those stuff a lot in the past, so i know how it works. The two issues i had was a typo and a too small sized font atlas - thats it. Everything else was just wrong decision making... But maybe i try to make the project with unreal, just to see if this would be a different.

Share this comment


Link to comment

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
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By Green_Baron
      I probably haven't understood something very basic here and kindly ask for help. There is a problem occurring since i switched from raw pointers to std::unique_ptr.
      I have a singleton i use for debug drawing of primitive shapes. It holds unique pointers to several member objects like
      ... std::unique_ptr<Program> m_shaderDebug{ nullptr }; std::unique_ptr<VertexArray3D<omath::dvec3>> m_boxArray{ nullptr }; ... I get the singleton like this as a member of another drawable object O:
      orf_n::DrawPrimitives &m_drawPrimitives{ orf_n::DrawPrimitives::getInstance() }; Somewhere in O i call the setup:
      m_drawPrimitives.setupDebugDrawing(); That sets the above members of the singleton like for example:
      Icosphere is{ omath::dvec3{ 0.5, 0.5, 0.5 }, 2 }; m_sphereArray = std::make_unique<VertexArray3D<omath::dvec3>>( is.getVertices(), 0, true ); m_sphereIndices = std::make_unique<IndexBuffer>( is.getIndices() ); and a flag m_allSetup that setup has taken place.
      Now, when i call the singleton's cleanup method that simply does
      if( m_allSetup ) { m_boxArray.reset(); m_shaderDebug.reset(); m_boxIndices.reset(); .... the program exits fine.
      If i wait for the singleton's destructor to call the cleanup method, the program segfaults. The debugger tells me the pointers holdvalid objects of the respective type at that time.
      I probably haven't got something basic here.
      Let me know if you need more code.
       
    • By Ace001
      Will you suggest some C++ video tutorials that would be beneficial to me for reviewing beginner level C++ usage in game programming and for escalating my C++ skills to an intermediate level of understanding?
    • By TheAICodeGuy
      Hello everyone!
      If you couldn't figure it out I'm new here. I've been reviewing jobs regarding AI game programming because I love working on AI systems. A few searches have been well straight forward and I'm grateful for that, but for anybody whose has or who still is currently working as an AI programmer, what skills would you say are necessary? I've learned (and still am learning because well learning and getting BETTER never ends) C and C++. Of course I'll continue to sharpen my skills there as much as possible. I've seen some jobs list python and/or lua in their descriptions. Would you say these extra skills are, I guess, major in the game industry? I know python a bit, but lua I don't really know much at all. 
      However I'm most definitely willing to learn.
      Thank you to anyone willing to give feedback!
    • By joetext
      Hey all, I'm at my wits end with this weird memory leak. My issue is with the small preview-render view that comes up on the Windows 10 taskbar when you hover over your application. I don't know the name of it, but it's the little thumbnail view that pops up when you have your mouse hovered over a minimized application. When I do this with my dx11 program, memory absolutely rockets up, I'm talking like going from 1 gb to 4 gb in a few seconds. I managed to find a single line that I can comment out and "fix" the leak, but it's not making any sense to me. The graphics portions of my program are somewhat fragmented between different abstraction layers so bear with me.
      // the code that actually handles the render calls // map buffers and copy data from cpu buffers m_context->copyDataToBuffer((void*)verts.data(), sizeof(Vertex) * verts.size(), m_vertexBuffer); m_context->copyDataToBuffer((void*)indicies.data(), sizeof(uint) * indicies.size(), m_indexBuffer); m_context->copyDataToBuffer((void*)uniforms.data(), sizeof(HuiUniforms) * uniforms.size(), m_uniformBuffer); // render ISamplerState* sampler = shaderSys->getSamplerState(); m_context->setVertexBuffer(m_vertexBuffer); // this is the line that is causing the leak m_context->setIndexBuffer(m_indexBuffer); m_context->setUniformBuffer(m_uniformBuffer, ShaderType::Vert); m_context->setUniformBuffer(m_uniformBuffer, ShaderType::Frag); m_context->setTopology(PrimativeTopology::TriangleList); m_context->setSamplerState(sampler); Texture2D** textureArr = &diffuseTexture; m_context->setTextures(textureArr, 1); m_context->drawIndexed(indicies.size()); m_vertexBuffer is an abstraction for a ID3D11Buffer. Here's the code for that setVertextBuffer call
      void D3DRenderContext::setVertexBuffer(IBuffer* buffer) { D3DBuffer* d3dBuffer = static_cast<D3DBuffer*>(buffer); ID3D11Buffer** d3dBufferResource = d3dBuffer->getBuffer(); UINT stride = sizeof(Vertex); // Vertex is a simple struct UINT offset = 0; m_context->IASetVertexBuffers(0, 1, d3dBufferResource, &stride, &offset); } And for completeness sake here's the copy buffer function
      void D3DRenderContext::copyDataToBuffer(void* data, int dataSize, IBuffer* toBuffer) { D3DBuffer* d3dBuffer = static_cast<D3DBuffer*>(toBuffer); ID3D11Buffer** d3dBufferResource = d3dBuffer->getBuffer(); HRESULT result; D3D11_MAPPED_SUBRESOURCE resource; result = m_context->Map(*d3dBufferResource, NULL, D3D11_MAP_WRITE_DISCARD, NULL, &resource); memcpy(resource.pData, data, dataSize); m_context->Unmap(*d3dBufferResource, NULL); } A few things.. I removed like 15 ASSERTS to make the code shorter, so any pointer that could potentially be null, and the dx results are all checked in the actual code. Second, I have the dx debug output enabled and it has nothing to say. Third, I've tried flushing the context after every call to drawIndexed, to no avail.

      This leak is just beyond bizarre to me, granted I have no clue how the underpinnings of that preview window work. In the meantime, I'm going to figure out how to tell windows to disable it, but I'd still like to know why this is happening. Any suggestions appreciated!
    • By GameCreator
      Say you have a 4x4 grid.  How would you generate a path so that every tile is touched once?

      Rules:
      You can start and end anywhere, just not the same tile You can go off one side and resume on the opposite side.  You don't have to use this but you're encouraged to (this is also easily fixed by shifting the path either vertically or horizontally) You must use all 16 tiles once and only once (no crossing paths) I could probably do something like this with a recursive function but the problem is that sometimes you'd end up with the following situation where you'd trap yourself:

      How would you prevent this?  It's easy enough to detect; you haven't generated a path on all 16 tiles.  You can brute force it then by starting over and hoping it doesn't happen often.  But what's the proper way to do this?
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!