Jump to content


Member Since 14 Dec 2013
Offline Last Active Mar 06 2017 09:48 AM

#5238157 What would you be willing to trade to get your ideal job in the gaming industry?

Posted by Sunsharior on 03 July 2015 - 05:24 AM

I would sacrifice a lot more things (i've already sacrificed so much), but i wouldn't sacrifice my happiness.

#5237984 2D Polygon Collision Detection

Posted by Sunsharior on 02 July 2015 - 06:46 AM

The question is vague, but i'll try to answer anyway.

Not too long ago, i've been at the same place where you are at the moment. The biggest problem i had was trying to assimilate everything at once.
Start with small bites.
1. First, design a simple Polygon class. Just try to make it work, and focus on that.
2. Once it's working, try to implement your own  SAT algorithm that work with your own polygon class. You'll need to understand how SAT work.
3. Once that is working, modify your sat algorythm to include the MTV.
Now i realize this might not help you, so here is my own SAT function you can read and try to understand (or even use if you want, but a mention would be nice, just don't claim it as your own).

The code is well documented, should you have more question, i'll be happy to answer.


The Sat Function




The Collision structure, including the MTV.




The Polygon struct.



The Segment struct




The Vector struct



Edit: I highly recommend this book. It explain everything you'll ever want to know about collisions.

#5237981 Creating menus using Codeblocks (C++)

Posted by Sunsharior on 02 July 2015 - 06:18 AM

Also, each Menus can be a stateinside the engine you are using, making a simple interface with Update, Draw and Clear or what ever fit your need. Consider using one state per menu, unless your design do not need it.


Just plug the current state inside the main game loop and change it when you need it.


We'll be happy to answers more question.

#5234436 Code Management in a Project

Posted by Sunsharior on 12 June 2015 - 06:40 AM

I'll add my advices as well.

Code writting :

  1. Write small and focused function. The smaller and simpler, the better.
  2. Write Self documenting code. Your code must be so simple, just reading throught it explain what it does.
  3. The fonction name and it's parameters should explain near 100% of what it'll do. Exemple : If i look at "void Math::SortArray(std::array<T> &_array, bool _ascending) const;" i know that it return nothing, that the parameter _array will be modified by the function, that i can sort ascending or not with the second parameter and that the function will not motify the class "Math", as it is const.
  4. Comment anything that could be misinterpreted or cannot be made simple.
  5. If you have a programming style, stick to it. Never deviate. Everyone in your team must be up to date with the programming style and must follow it.
  6. Never use magic numbers. Use enumerators, or const in c/c++ and final in java.
  7. Never duplicate large chunk of code. Example: if you have a function that sort integer and another that sort double, rewrite it as a template.
  8. If you are programming with objects, encapsulate everything that can be encapsulated.
  9. Every class function must be private, unless it need to be public.
  10. Learn the most usefull programming patterns*.
  11. *Try to avoid the singleton programming patterns.
  12. Sometime, take the time to return to something that you finished and think about if it could be written simpler. Do a little optimization and refactoring here and there during developpement. Don't forget to retest what you change.
  13. if you are using a language that use header, try as hard as you can to maintain a clean and well sorted header (with comment). Group all draws function, group all getter, all setters, etc... This fall into your programming style or choice.
  14. Remove anything that become obsolete or unused. Don't worry about losing anything, you have a source control. The worst thing you could do is commenting whole functions. Its making scrolling through the code unnecessary obfuscated.
  15. Don't over-complicate anything. A lot of thing can be made simple just by taking the time to think it through.
  16. If you are writing something new, make sure it don't already exist first. Nobody wants three functionally identical functions that return the bounding box or an actor, written by 3 different guys / gals.
  17. This wikipedia page list a lot of things that can overcomplicate code and make it harder to manage. Print it and pin it on the dashboard where you work.


Code documentation :


  1. Use a version control, git, mercurial, etc... and a version control software like svn or SourceTree.
  2. Always commit something with zero errors, zero warnings.
  3. Try to maintain the documentation up to date with the code.
  4. Atlassianhave a wide variety of tools for a small team, without paying too much (Confluence for documentation, Jira for bugs, Hipchat for chat, Bamboo for building new versions. Bitbucket for source control). I highly recommend it.

#5221618 Implementing a quest/achievement system

Posted by Sunsharior on 06 April 2015 - 08:34 AM

The observer design pattern is a good idea for decoupled achievements. Here is a link to an article describing it: http://gameprogrammingpatterns.com/observer.html

#5220716 please help with SDL

Posted by Sunsharior on 01 April 2015 - 09:27 AM

You are missing the methods "clean" and "update" from the file SDLGameObject.cpp

#5197653 Text Based RPG help

Posted by Sunsharior on 11 December 2014 - 02:12 PM

Like Josh Petrie said, you declared functions in a header file that were never defined elsewhere. I have enclosed 3 of your project's file code with the error fixed.


You will noticed a few things:


1. I have created the Prologue.cpp file and moved the content from Char info.cpp to it.

2. The prologue is now used as a class instead of static. See the modification i did to Main.cpp to notice it's scope remain inaffected.

3. The fonctions and member variables of the class Prologue are no longer static. Prologue.cpp now have the proper definition of thoses fonctions, and a constructor aswell.

4. The file Char info.cpp has been deleted.

Attached Files

  • Attached File  RPG.rar   1.1KB   38 downloads

#5195747 How should i process about embedding a SDL2 game into QT to make a level editor.

Posted by Sunsharior on 01 December 2014 - 11:54 AM

Thank you for your reply Dejaime. It helped me do the initial setup.


After fiddling this weekend, and doing additional researches, i've partially solved my problem. I'm not done yet but i've successfully draw something in QT using Sdl2. Now, what i'm missing is just the Inter-process communication between the QT application and my game. I should be able to do that during this week.


So, it's looking good, at the moment :).

#5157903 Advise for a beginner needed

Posted by Sunsharior on 03 June 2014 - 12:36 PM

Many thanks everyone, but could you please maybe tell me wich language i should learn and maybe a good website, book, method, etc to learn thuis too?


If your ultimate goal is to make a 3D FPS, i would pick C++ and DirectX / OpenGL. You need a OOP language for 3D and C++ is already largely used in the gaming industry.

Thoses are the reasons i would pick C++. Be warned though, C++ is a magnificent beast.

For learning, http://www.learncpp.com/ is a good place to start. For book, http://www.gamedev.net/page/books/index.html/_/technical/general-programming/beginning-c-through-game-programming-r1400 seems to have good reviews. I did not read it myself. Maybe it be better to search google for more reviews.

#5157618 Advise for a beginner needed

Posted by Sunsharior on 02 June 2014 - 01:47 PM

While it's possible, i wouldn't recommend doing a FPS as your first game, especialy since you say you've got little experience with programming.

You need to take bite-size task.


Start with small project like Tic-Tac-Toe or  Pong and work your way up from there. It will take many years for you to be confortable with a single programming language.

#5147676 .fla viewing source code

Posted by Sunsharior on 17 April 2014 - 10:37 AM

.fla is Adobe Flash. You will need adobe flash Ide (called macromedia before) or equivalent to open it.


One of the open source alternative is F4L. you can find it at http://sourceforge.net/projects/f4l/

#5144660 Create new white texture from existing SDL_Texture.

Posted by Sunsharior on 05 April 2014 - 08:30 PM

Color modulation is the first thing i tried to do, but i noticed setting it to 255, 255, 255 don't change the color.

I attached an image of what i tried to do earlier today.


First image is a colorModulation with the normal weapon.

Second image is a colorModulation with a white image (White shadow) of the weapon.


IMO it look so much better in the second image. Note that i would actually change the white blade for the actual blade if i manage to find something that work smile.png


Right now, i'm trying to do the second thing you said, dejaime. I'm trying to convert the texture to a surface and change all pixel to white.

Oh boy, google is really not helping me on this one, maybe i'm trying to do something very easy in a very complicated way, ahah.


Edit: Yes, i'm using SDL2. I also know texture are way faster than surface, this is why i'm trying to avoid using surfaces altogether.

Attached Thumbnails

  • bladetrail.png

#5141710 There got to be a better way to manage animations.

Posted by Sunsharior on 24 March 2014 - 09:17 AM

Thank you for your reply, Krohm (and everyone else). Quoting you, I will explain a bit further how i currently handle my animations.



Your whole problem arises because you're trying to enumerate the animations. This is a fundamentally wrong way to a approach the problem. Animations states are strings, and they are asset-specific. You don't map them to uints, you can do it, but it really isn't a sensible way of authoring assets.

Animation names are strings. So you can have very specific animations such as PlayModelAnimation("cutscene4_bridgeCollapsed_teammateAlive") where your avatar and the sidekick note how they were doing great so far, but also have to cut another few seconds next time.


I do have a "PlayAnimation" function that is called during cutscene. this function do not depend on the state of the actor, as it is only processing scripted animations. But this is somewhat irrelevant to my problem here.

What i'm describing in my post is during normal gameplay (Nothing scripted here). This depend heavily on the state of the actor, for example, if he is currently underwater, or jumping, or swiging his sword, etc... What im trying to do here is, at the end of my frame, i check what happened to the actor as a whole and set the animation correctly. Let say in a single frame, the actor moved right, but also got hurt, i need to prioritize showing the hurt animation for the next couple frames before resuming showing moving right.



I'm having myself some problems however in understanding how this could work for you since your IsState function seems to be smarter than I'd suggest to - so something is falling... or jumping... in combat or not. So basically IsState does non-trivial checking of variables which are of your own design.


IsState is simply an array of boolean that contain the state of a very specific actor. It can be things like "in combat", "falling" or "jumping". A complimentary function SetState does the work during user input (or AI) to set the appropriate states.



In my design, I don't set animation as part of the loop. I start them event-based so no state polling is required and I found this to be a rather good solution so far.


If i could do the same thing without the state polling i would be very happy. I'll try to explore Finite State Machine, which i am aleredy using for the user input / Ai function and see if i can use it too for the animations.


I think mikeman's answer i what i'll be looking into first, thought, as it is very close to what i'm currently trying to do.


Of course i will take time to really think this through. Heck, maybe putting the ManageAnimation code inside my Iactor class is innapropriate, as the actor truly care only to keep track of it's current animation and frame, as DareDeveloper aleredy said is true.

#5139109 What is a day like in the life of a programmer?

Posted by Sunsharior on 14 March 2014 - 06:06 PM

I work in a small and "family"-like software compagny. I do not currently program video game at the office, but rather medical softwares. I do have a video game side project that i develop alone, on my free time.


Since we're a small team, i often have to do both programming and analyse.


Basically, my days goes like this:


When i arrive at work, we hold a very quick meeting with the devs and project director to see when has been done the eve. Possibles issue are discuted there, along with solutions.  This take at most 15 minutes.


I always have tasks assigned via Jira, so i know what i have to do ahead of time. Normally, what i have to do is documented by the analyst. Of course, not "everything" is deocument, so if issues arise, i need to voice them / thinks of a solution. This process is very sastifing, as i act at the analyst's back-up, if he screw-up (which happens sometime).


To be honest, i don't really count the line of code in a day. It can fluatuate a lot. I normally code about 50% of the day, do research 30%, speak with my coleague 10%. The last 10% is administrative work not directly related to coding, like meetings, filling my timesheets, documenting stuffs, etc... You could write 10 line of code in a whole day and be considerer still be considered very productive.


Then, when i'm out of work  i usually keep coding 2 to 5 more hours in the evening on my personal video game project. I work in a software compagny, but my real goal is going to a video game compagny. This personal project is very nice on a CV (if completed). Also, i could make somes money out of it, but that's not really my primary goal.

#5128786 Advice about "Camera Zone".

Posted by Sunsharior on 04 February 2014 - 12:54 PM



In this game engine i am working on, i have a camera problem that i will explain in a moment.

Before i continue thought, i must state that i aleredy have a few idea on how to resolve it, but i feel all of them are "awkward". So i come here to hear about yours opinions.


The problem is kind of hard to explain, i will try my best to be as precise as possible.


I have a 2D sidescroller game. In this game is a Camera Class that can move around dynamically, that means it will try it best to keep up with whatever it's bound to.

The camera follow a simple rules: Don't go out of the Level. This mean in a 100x100 Map, the camera won't go left of tile 0 or right of tile 100.


With this come 2 major problem

1. If i wants to make a "secret" area where i do not wants the camera to enter before the player do.

2. If i wants to stop the camera right at the floor level, even if the level go below the floor eventually.


if i am not clear enought, i have attached an image to show the problem.


In picture one, you can see the level Editor. I made a corridor leading to a pit. Picture 2 is zoomed it with the player spawned. You can see in picture 2 the problem. I wants the camera to stop at the floor and not go under the floor until the actor is nearby the pit.


So i got somes idea on how to solve it, but like i said earlier, neither are spectacular.

1. Flag somes tiles as "Don't go in here yet". If the camera is about to show them, stop the movement.

2. In the map header, tell the camera where it can go and where it can't go.

3. Disallow the camera to enter "empty space" or tile flagged as "secret space" (a trigger would unflag such area as soon as the player touch it).

4. Put trigger everywhere in the level to tell how the camera should behave.


Personnaly i would go with option 3 but i wants to hear what everyone is thinking. Maybe there is a better solution i am not thinking of.


Ps: Graphics are just placeholder.

Attached Thumbnails

  • Camerazone.png