Jump to content

  • Log In with Google      Sign In   
  • Create Account

Felix Ungman

Member Since 19 Nov 2007
Offline Last Active Today, 01:25 AM

#5179815 How do you manage object pools in your engine/game?

Posted by Felix Ungman on 12 September 2014 - 03:00 AM

I like to keep things simple and use the new and delete operators most of the time and don't worry that much about allocation. I'm confident that the implementation of new/delete doesn't do anything terribly stupid and that I would have to work really hard to do something better performance-wise. If I need to track objects I put them into an std::vector or sometimes a std::map. There are some cases where I have groups of large numbers of very small objects, and for those I instead use the operator new[] and delete[].

#5178247 GOTO, why are you adverse to using it

Posted by Felix Ungman on 05 September 2014 - 01:26 AM

Oh, I use goto on a regular basis. I've used it twice in the last 10 years, which means I write about one goto statement every fifth year. I'm not adverse, but imho goto is lame, real programmers use comefrom.

#5177822 How Does a Noob Start Creating a Simulator?

Posted by Felix Ungman on 03 September 2014 - 04:18 AM

Install some IDE, there are many good free ones like http://www.jetbrains.com/pycharm/ and try to do something really simple, like http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

Implementing Game of Life will highlight some of the basic concepts of writing simulation systems, yet it's possible to implement in few hundreds line of code.

#5177365 Online Course: Understanding Video Games

Posted by Felix Ungman on 01 September 2014 - 12:29 AM

There's a course over at Coursera starting this week that seems worth checking out: https://www.coursera.org/course/uvg


An 11-lesson course teaching a comprehensive overview of analytical theory pertaining to video game media. Topics covered: play and game, emergence versus progression, game mechanics, story, interpretive theory, the culture of games, violence, sex and race in games, and finally, serious games. Estimated workload: 3-5 hrs/wk for non-credit; 7-10 hrs/wk for credit.

About the Course
Video games are a globally entrenched entertainment medium that entertains, informs and challenges us. These games are defined by, and define our modern culture. In this course, students will learn how to study games and engage in informed discussions about them. Ultimately, this course is about understanding the literacy of video games.
Understanding Video Games was created with the help of world renowned video game developer, BioWare Corp, located in Edmonton, Alberta.
The three main parts of the course are: 
1) developing the terminology that enables us to talk about video games; 
2) exploring how these terms are used in theoretical frameworks to interpret games, and; 
3) turning these theories toward cultural aspects of games in order to understand how the medium has impacted society. One of the most important insights students will gain from the course will be an understanding of the interplay between video game designers, players and the games themselves.




#5170132 Can somebody explain this code to me, please

Posted by Felix Ungman on 29 July 2014 - 12:06 PM

I don't know perl, but isn't it supposed to be a write-only language?

#5154331 Member variable as template paramter

Posted by Felix Ungman on 17 May 2014 - 04:11 PM

Ok, the example maybe didn't illustrate what I meant, a better one might be:  

class ButtonWidget
    std::function<void()> _onClick;

    void SetOnClick(std::function<void()> action) { _onClick = action; }

    void TrackClick()
        // ...
        if (_onClick)
        // ...

Then you can fix the data you want to hold in the lambda:

for (int i = 0; i < n; ++i) {
    int buttonNumber = i;
    button[i]->SetOnClick([buttonNumber]() {

Code is simple but powerful. I don't know how it relates to your framework or how you would need to rewrite it (it seems you use signals both for events and for data bindings, right?), but I've found the technique very useful in my own gui code.

#5153492 Opinion needed: returning values without null checks everywhere

Posted by Felix Ungman on 14 May 2014 - 12:32 AM

Objective-C has an interesting take on this problem. If you have a nil object reference, calling a method is a no-op, and calling a function returns a default value (i.e. zero, false, or nil). Good coding practice is *not* checking the object for nil, but instead just send the message and checking the return value instead. Unfortunately there's no simple equivalent construction in C++.

#5145914 I have some new habits.

Posted by Felix Ungman on 10 April 2014 - 06:12 AM

I have a much easier time thinking of someone with a background with a function based (not functional lambda calculus) experience like C/Pascal will do a better job at designing software than someone with a (bad) OOD background. He or she would use the modules approach of Pascal and apply it to OOP and we would all be happier for it.


I'm sure a bad designer would produce crappy work no matter the methodology. Granted, OOP gives you a richer set of tools to introduce strange and unnecessary relationships, and in that case sticking to C/Pascal might give you some damage control.


I think the problem here is that when you are learning a new methodology, you write small toy-world pieces of code of very limited complexity. But in the real world, projects grow and requirements change and complexity seems to grow without bounds. With a team of inexperienced developers you tend to get a lot of redundancy (failing to see that different parts of a system share a common concept) and a lot of bad dependencies (such as realizing that another part of the system is doing something related to what you're coding so you do a quick-and-dirty rewiring). Time constraints and deadlines don't make things better.  You need an experienced designer willing to take the time to constantly re-evaluate the design as the system grows.


I am always trying to improve and to know more about OOD (a new improved way) is always interesting.

I highly recommend Evans Domain Driven Design. Beware that it's not a beginners book. Although it has a lot of patterns (OODish or whatever you want to call it), I think the main point is more the process or rather mindset when designing large software systems.

#5126045 MMO Engine Production - Do we create from scratch or use libraries?

Posted by Felix Ungman on 24 January 2014 - 01:42 AM

Do free, previously coded and open source game engine libraries usually allow their creations to be used in projects that charge a monetary, monthly fee for their products?


The issue with open source licenses is not whether you're allowed to charge for distribution or use (most licenses allow it), but whether you are required to apply the license to you're own code too. GPL might actually be fine if you're using a service based revenue model.

#5109384 Using a Notepad in Industry to keep track of modified code

Posted by Felix Ungman on 15 November 2013 - 02:36 AM

As a solo programmer, I've found git far more useful than svn. Once you understand how it works, it's extremely easy to set up, branch off modifications, compare those changes, and merge them together. I would never dream of doing this by hand.

#5108644 Appropriate number of bugs

Posted by Felix Ungman on 12 November 2013 - 04:13 AM

That being said, I never really liked the Agile development model (but this is just me), because it forces you to code fast, without thinking about possible bugs you might be introducing. I also don't like how it categorizes and splits work into fixed, periodic categories (or whatever they're called - 2 weeks planning, 2 weeks developing, 2 weeks testing, then repeat). Since you're not documenting much, just adding tasks, you will end up forgetting details of what was planned before you even start developing. Plus, when it comes to bugs, you really cannot plan for them. I always find it easier and faster to fix bugs as I find them, while I'm still involved in the task I'm working on, even if it's not related to my work. Instead, Agile just forces you to add a new task for the bug and move on.


Agile is not not cowboy coding. If you plan to implement a certain feature, you're not really done with the task until the feature works as expected (i.e. no bugs). Fixing bugs as soon as you find them is a good practice, and it doesn't contradict good agile practices. In the contrary, if you are measuring project velocity (story points per sprint or whatever your measure is) then the earlier you fix the bugs the better you'll be able to measure the "true" velocity. Otherwise you are just borrowing time from the future and adding to the hidden technological debt.


That said, agile may not be easy to do in practice (depending on the organizational culture), and may not be the best approach for every project. On the other hand, I've not find any negative aspects of it in my experience.

#5108422 Appropriate number of bugs

Posted by Felix Ungman on 11 November 2013 - 01:59 AM

One of my lecturers at the university once told a story about a programming course he'd previously taught to a mixed group of both software and hardware engineers. When reviewing the lab assignments he was astonished that the code submitted by the hardware engineers didn't have any bugs. When he asked them about it, they answered "oh, we didn't realize bugs were allowed".


There's only one answer to what's the appropriate number of bugs: ZERO. That's the mindset and the rest is just implementation.

#5107839 Is hacky code allowed in industry?

Posted by Felix Ungman on 08 November 2013 - 03:31 AM

I always found hacky code to fix all the bugs in my game and let me progress faster in my game development process.


I've realized that adding code almost always makes it less clean. And the faster you add new code the faster it gets dirty. There are two solutions:

1) Add code slowly to keep it clean.

2) Add code quickly and then come back and clean it up.


IMHO hacky code is OK if it's used as a stepping stone. Actually, many times I've found that adding a lot of hacky dependencies allows you to use the resulting code smells as a guide to find the architecture.

#5107371 Hosting Online Game

Posted by Felix Ungman on 06 November 2013 - 01:19 AM

I'm also currently comparing host services for a matchmaking server. So far I've looked at Amazon EC2, Google AppEngine and some local cloud provides. Pricing is highly dependent on CPU, memory, and bandwidth needs, and I'm not able to compute costs yet because I'm still deciding what needs to be done on the server and what can by done by the clients or using a peer-to-peer scheme. AppEngine seems simpler to use (no OS admin), but doesn't allow UDP servers (yet?). Amazon has a lot of nice extra services, like database and storage services, that can potentially make the solution more scalable (but the pricing gets more complicated). The local cloud providers simply give you a virtual server and a some virtual storage for a fixed monthly fee.


So no conclusions yet, I will have to continue working out the architecture before I decide.

#5071993 Name of a particular property

Posted by Felix Ungman on 22 June 2013 - 05:23 AM

As you're dealing with data buffer, it seems that the function is some kind of stream writing operator.