• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

missile

Member
@injurai:
So you hope to become a master in graphics some day? Why just hoping? Better
say; "I'm going to becomes a master in graphics some day". This changes the
entire thing. As you have already recognized, getting away from the high-level
languages, APIs, and stuff is just the right way to start. These are things
you can use later on once you are proficient enough with the core basics, with
the fundamentals, with the pillars of computer graphics.

I've seen some of your stuff in the indie game dev thread. Do you have any sorts of other advice or recommendations on getting started. Resources, goals, approach of attack. My math skills aren't incredible, though I have a willingness to learn, and should be able to grasp just about anything given time. ...

Other advices or recommendations? Sure. But the question is whether you are
up to the task, since going down to the basics will be a long way. And even
if you are at the bottom of things, you also need to crawl up again. For one,
you will be moving very slowly, because the load on your shoulders will be
very high. But you will gain momentum with each move you make even if you
move slowly. You can compare this to a slow moving train having a very large
weight. Despite the train is slow moving, it carries a very large momentum
making the train virtually unstoppable no matter the obstacles coming in
front of it. I think you get the idea.

Lets get one thing straight and sorted right at the start; without a throughout
understanding of mathematics you will never becomes a graphics head.
Never.
You can tweak and bend the tools, APIs, etc. hoping to get the desired result,
which is ok if you just want to make things for fun, but not if you want to
produces something new, superior, or even extend the tools you have. Without
a throughout understanding of mathematics you will always be limited within
this regard. And not just within this regard. For, what are the things getting
visualized by computer graphics imagery most often? Most of these things are
by them self computed from rather complex mathematical equations, formulas, or
models.

Recommendation (1):
At university, take the basic courses in linear algebra, calculus, ordinary
differential equations, and scientific computing. You don't need to make a
master in maths, but at least visit all these undergraduate lectures! They
will teach you a lesson. I can't emphasis it enough. Don't corner them, like
many cs students do. Go over to the faculty of mathematics and inscribe for
the lectures mentioned.

Recommendation (2):
Implement the entire rendering pipeline in software and from scratch. Keep it
simple. Just implement the standard graphics algorithms. Pick a language of
your choice. You need to learn something about the history and the people
involved in computer graphics. The standard algorithms were once the best
known one. And many of the improvements in computer graphics these days are
mere modifications of the standard algorithms. During the 60' and 70' almost
all of the foundation of computer graphics were pinpoint. During this time all
of the fundamental algorithms were discovered and implemented. So it's
important that you implement them as well, even if some of them aren't en
vogue today. They will tell you a lesson.
Stick to wireframe until you understand the pipeline. You need to understand
all the coordinate transformations first and how they fit into the pipeline.
For example, clipping can be done at different stages in the pipeline. It can
even be split up. Why? And how do the graphics accelerator do it? How does it
depend on the rasterizing algorithm? Etc. Tinker around with projection.
Implement different types of project. Understand the power of normalized
coordinates. Derive OpenGL's projection matrix. Etc. Once you got that all,
start with rasterizing, lighting, texturing, and friends.

Most of the basic things in part (2) can be done solely with linear algebra
of part (1). But once you've implemented and understood the basics, you
suddenly feel doing more sophisticated stuff. And that's where the momentum
kicks in.

... Eventually I want to be able to write my own shaders and things for engines like Unity, though I'm still beginning my computer science path. I'm trying to get away from all the high level languages that take the magic away from you (currently have an Internship where is use Groovy...)

I'm hoping to get a masters in graphics and CGI, really hate databases. Yuck.
Databases sux, indeed. ;)
 

Magni

Member
New Grads (or anyone):

I have the option of either just applying to a few companies online or having my graduate adviser contact the HR they know at the company to forward my resume. If it matters, these are mostly small-medium sized companies that are local. Is there any preference here? My instinct tells me to use any possible connection but I kind of worry that it would get lost in someone's email inbox.

I'd have the grad adviser send the email personally.
 

missile

Member
... this however, I can do! wrote a little game on this DS many moons ago that was simple 2D vector graphics using a line-drawing algoithm. pretty much kickstarted my rediscovery of programming. now I'm on a mad dash to get my 3D spacewars assignment (C / OpenGL) handed in. 6 and a half hours to go!
:+
 

Kalnos

Banned
I'd have the grad adviser send the email personally.

Thanks yeah, going to go this route I think.

There seems to be a lot of opportunity right now so it doesn't seem like I will have a hard time finding something. I got an email offering to schedule a phone interview literally 2 hours after applying to one company. That was this past Thursday and I think it went pretty well but we'll see.
 

Onemic

Member
What's the job market like for programmers now?(specifically programmers for games and apps) I'm thinking seriously about going back to school for a diploma in programming analysis.
 

usea

Member
What's the job market like for programmers now?(specifically programmers for games and apps) I'm thinking seriously about going back to school for a diploma in programming analysis.
Your profile says you're in Toronto. The market in North America is super great for programmers. Mobile app developers are paid well and in-demand.

Mobile game developers I don't know as much about. It may depend on other circumstances, like whether you're a contractor, self-employed, etc.

I don't know anything about a degree in programming analysis though.
 

Haly

One day I realized that sadness is just another word for not enough coffee.
The competition is stiff for game dev, whether mobile or traditional, from my experience
as someone getting passed over for more qualified candidates
.
 

Onemic

Member
Your profile says you're in Toronto. The market in North America is super great for programmers. Mobile app developers are paid well and in-demand.

Mobile game developers I don't know as much about. It may depend on other circumstances, like whether you're a contractor, self-employed, etc.

I don't know anything about a degree in programming analysis though.

This is the program. It's 3 years with one of the years being paid co-op. I would plan to focus more on game programming and OOP with C++ in the later years.
 

usea

Member
Sorry I thought you were talking about mobile specifically. General game programmer market is not nearly as good as non-game programming. Salaries are much lower and it's more difficult to find a job. That is until you get some specialty skill or a lot of experience. That's the current trends anyway, it could possibly change.

Not saying you can't find a job. But you won't make nearly as much.
 

Onemic

Member
Sorry I thought you were talking about mobile specifically. General game programmer market is not nearly as good as non-game programming. Salaries are much lower and it's more difficult to find a job. That is until you get some specialty skill or a lot of experience. That's the current trends anyway, it could possibly change.

Not saying you can't find a job. But you won't make nearly as much.

Im open to mobile as well. Do you mean mean game programming in general or just non mobile game programming? And what are some examples of non-game programming careers? I'm not completely against the idea of doing non-game programming, as long as it's something I'm interested in.
 

usea

Member
Im open to mobile as well. Do you mean mean game programming in general or just non mobile game programming?
Either mobile or not, doesn't matter much.

And what are some examples of non-game programming careers? I'm not completely against the idea of doing non-game programming, as long as it's something I'm interested in.
A million different things. Basically whatever the needs of a company are. Developing products to sell, developing websites, supporting internal stuff. Sometimes you'll do the same stuff all year, sometimes you do something different every week. Sometimes you'll be "the API guy" and sometimes you'll wear every hat in a single day.

I've been working on one major product for the past 2 years, developing new features and doing a from-scratch rewrite. It includes embedded software, server software, windows services, and a website. One of my friends from school does consulting, so he works on 4-5 different projects a week, and each one will last anywhere from one month to six months. They are usually web applications or mobile applications.

Also, I suggest getting other people's opinions as well. I could be full of it.
 
I'm having to make a program in C++ where one class governs multiple instances of another class (not derived or inherited). For class A should I put an array of class B in private data or is there a better way to do this? We've already been informed we'll be handling 15 instances of class B.
Code:
class classA{
private:
     classB instance[15];
public:
     ......
}

EDIT: The reason I ask such a basic question is that I'm a little uncomfortable when I start needing double and triple pointers. I could create pointers and start using new all over the place but I just wanted to run this by you guys to make sure I'm not creating more work for myself.
 

Kalnos

Banned
You have the right idea. They gave you a static size (15) of class B objects therefore it's logical to store them in an array. You will probably want to make it an array of pointers to class B objects.

EDIT: The reason you want to use the pointers in this case is that if you make a member function of class A which adds an instance of class B to the array you don't want that new instance to go out of scope. You're controlling the lifetime of the object.
 
This is the program. It's 3 years with one of the years being paid co-op. I would plan to focus more on game programming and OOP with C++ in the later years.

Dont, making a engine is a lot of code. And OOP will come from self.

Focus on math, data structures, algorithms, hardware and learn to read or write a assembly language x86 or ARM is a save bet i heard arm assembly is a lot easier.

It will give a much broader market if engine or tools programmer wont net you a job. Focusing on OOP for game engines if you ask me is a waste of time. And not worth it because who knows maybe you will be using C as your engine language. And it will be different at every company. It doesn't take much to learn about OOP or design patterns.

This is my opinion someone that thinks OOP is icky :'( and like everything someone else will say you should do it. But if you focus on math, hardware, data structures and algorithms engine design will be a lot easier. You can already start optimizing on paper before you even have written a line of code.
 

Magni

Member
What's the job market like for programmers now?(specifically programmers for games and apps) I'm thinking seriously about going back to school for a diploma in programming analysis.

You're in Toronto, there's a shitton of jobs there (not sure about gaming though, talking about web/mobile).

Web: You should know either Java or C# and at least have some experience with one of Ruby/Python/Scala. Oh, and HTML/CSS/JavaScript (JavaScript is the most demanded skill of all programming jobs AFAIK) of course for all the frontend stuff. Learn some frameworks, JEE, .NET, Rails, Django, etc

PHP is also used a ton, but I'm not sure if anything new is being made with (and I just don't want to study it :lol)

Mobile: Objective-C for iOS, Java for Android, C# for Windows Phone
don't laugh :(

That's for the practical stuff. For the theory (the non-coop part of your program), focus on stuff like algorithms and data structures, the language used doesn't matter much.
 

Onemic

Member
Dont, making a engine is a lot of code. And OOP will come from self.

Focus on math, data structures, algorithms, hardware and learn to read or write a assembly language x86 or ARM is a save bet i heard arm assembly is a lot easier.

It will give a much broader market if engine or tools programmer wont net you a job. Focusing on OOP for game engines if you ask me is a waste of time. And not worth it because who knows maybe you will be using C as your engine language. And it will be different at every company. It doesn't take much to learn about OOP or design patterns.

This is my opinion someone that thinks OOP is icky :'( and like everything someone else will say you should do it. But if you focus on math, hardware, data structures and algorithms engine design will be a lot easier. You can already start optimizing on paper before you even have written a line of code.

What do you mean by hardware? The professional options I can choose to focus on later are here. I have to choose 7 different ones, which would you guys recommend? Based on what you said, I'm assuming Data Structures and Algorithms would be a good first.
 
You have the right idea. They gave you a static size (15) of class B objects therefore it's logical to store them in an array. You will probably want to make it an array of pointers to class B objects.

EDIT: The reason you want to use the pointers in this case is that if you make a member function of class A which adds an instance of class B to the array you don't want that new instance to go out of scope. You're controlling the lifetime of the object.
OK, thank you for the help.
 
What do you mean by hardware? The professional options I can choose to focus on later are here. I have to choose 7 different ones, which would you guys recommend? Based on what you said, I'm assuming Data Structures and Algorithms would be a good first.

Memory hierarchies, how does a CPU work etc.
I still need to jump back into hardware material.
Also still a student btw.

I think i would have atleast chose these.

Has the maths and physics you need to write a engine.
https://scs.senecac.on.ca/course-old/gam671

Fun topic gpgpu.. I can see software renderes take it over from dx or openGL when gpgpu matures more.
https://scs.senecac.on.ca/course-old/gpu610

Data structures and algorithm is also something you need.
https://scs.senecac.on.ca/course-old/dsa555
 

Magni

Member
Got a 91.5% on the Scala course on Coursera :D Now if only I could get similar grades on my projects and finals this month...
 

hateradio

The Most Dangerous Yes Man
Got a 91.5% on the Scala course on Coursera Now if only I could get similar grades on my projects and finals this month...
I got exactly the same score. I turned in an assignment late, so I got an 8 instead of a 10. And then I couldn't get another one to work well and turned in late, which got a low score.

Would you mind if I sent you a PM about that one?
 

Magni

Member
I got exactly the same score. I turned in an assignment late, so I got an 8 instead of a 10. And then I couldn't get another one to work well and turned in late, which got a low score.

Would you mind if I sent you a PM about that one?

Is it Assignment 6? I was super busy and only got to do the first half of it...
 

Madtown_

Member
Anyone ever done any game programming with Unity?
Know of any easy to pick up tutorials for the free version?

I'm a web developer day to day but it should be a nice change of pace.
 

injurai

Banned
@injurai:

Recommendation (1):

Recommendation (2):

Databases sux, indeed. ;)

I just want to thank you for doing these write ups. It really helps with the inspiration and drive to be told about things in this manner. I'm going to really try hard to set aside time regularly where I can just lose myself in learning this. Think I may also take Dragonelites great advice over that 3rd edition. Seems like a great place to start.
 

missile

Member
I just want to thank you for doing these write ups. It really helps with the inspiration and drive to be told about things in this manner. I'm going to really try hard to set aside time regularly where I can just lose myself in learning this. Think I may also take Dragonelites great advice over that 3rd edition. Seems like a great place to start.
Don't thank me, thank yourself for reading. xD So when do you have your first
line rastered on the screen? Btw; I've derived Bresenham's algorithm myself,
but in a much more elegant and general way as Bresenham did. The approach
seems to be new, haven't seen it in any book. I may tell you some day, after
you've passed calculus (as seen from the faculty of mathematics). :)
 

Magni

Member
No, it was assignment 4. I finished all of them, but that one.

I'm super busy right now with final projects and exams but ask away I'll try to get to it quickly. I passed all the tests except this one, got 9.55/10, so hopefully you're having trouble with another function :)

Code:
[Test Description] 'createCodeTree(someText)' gives an optimal encoding, the number of bits when encoding 'someText' is minimal
[Observed Error] org.scalatest.exceptions.TestFailedException: 1454 did not equal 1919
  [exception was thrown] detailed error message in debug output section below
 

Tamanon

Banned
If anyone is interested, Udacity has opened up their Java programming intro class now. Seems to be all about the basics of the language and OOP.
 

Jokab

Member
So I'm looking at expanding my language horizon beyond just Java (from school) with some web stuff, and what better language is there to learn than Javascript. With Dart getting better by the day, does it make sense to learn Javascript and then move on to Dart, or just going with Dart to start off with?
 
So I'm looking at expanding my language horizon beyond just Java (from school) with some web stuff, and what better language is there to learn than Javascript. With Dart getting better by the day, does it make sense to learn Javascript and then move on to Dart, or just going with Dart to start off with?

Just learn Javascript/Coffeescript for the client side. Dart is not going to be popular in a good while.
 
So I finished the first assignment early and want to read up on big O notation. I'm having difficulty understanding how to derive it(anyone know a good page to read up on this?). Headfirst never went into this and recursion so I'm terrible at these...

Example:
while (i1 < n && i2 < n && a1[i1] != a2[i2]){
if (a1[i1]<a2[i2]){i1++;}
else {i2++;}}
if (i1 = = n || i2 = = n){
System.out.println("no");} else {
System.out.println("yes ");}
The answer is 2n-1, essentially n.
So I'm guess the 2n comes from this part " a1[i1] != a2[i2]" and "a1[i1]<a2[i2]," but where is the -1 coming from?
 

Haly

One day I realized that sadness is just another word for not enough coffee.
Comes from this line I think: if (i1 = = n || i2 = = n)

When either i1 or i2 reaches n, the algorithm stops.

Given two arrays of n-1 elements, the worst case scenario is when both i1 and i2 reach n (2n), but that'll never happen because the moment either one reaches n, it ends. So the worst case is always 2n-1.
 

leroidys

Member
So I finished the first assignment early and want to read up on big O notation. I'm having difficulty understanding how to derive it(anyone know a good page to read up on this?). Headfirst never went into this and recursion so I'm terrible at these...

Example:

The answer is 2n-1, essentially n.
So I'm guess the 2n comes from this part " a1[i1] != a2[i2]" and "a1[i1]<a2[i2]," but where is the -1 coming from?

Code:
while (i1 < n && i2 < n && a1[i1] != a2[i2]){
    if (a1[i1]<a2[i2]){
        i1++;
    } 
    else {
        i2++;
    }
}
if (i1 = = n || i2 = = n){
    System.out.println("no");} 
else {
    System.out.println("yes ");
}

Big O notation captures the worst possible running time. Look through the code, and try to figure out how many times the loop will run in the worst possible scenario.

(Personally I would just write O(n), but theirs is more accurate. Also, tip: use [ code ] to format code better.)
 

usea

Member
So I'm looking at expanding my language horizon beyond just Java (from school) with some web stuff, and what better language is there to learn than Javascript. With Dart getting better by the day, does it make sense to learn Javascript and then move on to Dart, or just going with Dart to start off with?
Javascript is like 99.9% of it, since it's the only thing browsers understand right now. Coffeescript, Dart, and the many, many other similar projects are an extreme minority. Also, most of them compile to javascript, and assume you know javascript already so you can debug your code. (some run in their own VM or compile to native code, but they're so far from being practical in today's reality that they might as well not exist).

Also, most web programming involves not just client side (browser) code, but also server code. That has much more variety. I suggest you learn by making something. Make a web page with both client and server code. You can use javascript for both if you want (node.js server for the server side). Or Java even.
 
So I'm looking at expanding my language horizon beyond just Java (from school) with some web stuff, and what better language is there to learn than Javascript. With Dart getting better by the day, does it make sense to learn Javascript and then move on to Dart, or just going with Dart to start off with?

Is Java really the only thing you know?

And did you do CS or another major path? Just wondering.
 

Pat

Member
Might be a dumb question, but I have to "split" a name in first name and last name in PHP... And I simply don't know how to do it, since the split function doesn't work anymore.

Any help is really appreciated, thanks!
 

tokkun

Member
So I finished the first assignment early and want to read up on big O notation. I'm having difficulty understanding how to derive it(anyone know a good page to read up on this?). Headfirst never went into this and recursion so I'm terrible at these...

Example:

The answer is 2n-1, essentially n.
So I'm guess the 2n comes from this part " a1[i1] != a2[i2]" and "a1[i1]<a2[i2]," but where is the -1 coming from?

The loop breaks when either i1 = n or i2 = n.

Each iteration of the loop increments exactly one of them. Therefore, assuming i1 and i2 started at 0, the total number of loop iteration is the sum of the values of i1 and i2 when the loop exits.

Again, the loop must exit when one of them reaches n, so the two worst-case scenarios at the time the loop exits are
i1 = n, i2 = n - 1
and
i1 = n - 1, i2 = n

In both cases the number of iterations is (n) + (n - 1) = 2n - 1.
 
Might be a dumb question, but I have to "split" a name in first name and last name in PHP... And I simply don't know how to do it, since the split function doesn't work anymore.

Any help is really appreciated, thanks!

You should check why the split function doesn't work anymore. Either you are doing something wrong or your installation is wack.
 

Pat

Member
You should check why the split function doesn't work anymore. Either you are doing something wrong or your installation is wack.

No, the split function has been deprecated since a while it seems (source: http://php.net/manual/en/function.split.php). I tried the "explode()" and it didn't work so that's why I came here to ask... Only to find out, right after that, that I wasn't using the good variable, hehe. It works now, thanks anyway!
 

Magni

Member
So I'm looking at expanding my language horizon beyond just Java (from school) with some web stuff, and what better language is there to learn than Javascript. With Dart getting better by the day, does it make sense to learn Javascript and then move on to Dart, or just going with Dart to start off with?

You can learn Dart for your general culture if you want, but definitely concentrate on JavaScript/CoffeeScript first. JavaScript is the number 1 skill asked all programming jobs considered IIRC.
 

Jokab

Member
Javascript is like 99.9% of it, since it's the only thing browsers understand right now. Coffeescript, Dart, and the many, many other similar projects are an extreme minority. Also, most of them compile to javascript, and assume you know javascript already so you can debug your code. (some run in their own VM or compile to native code, but they're so far from being practical in today's reality that they might as well not exist).

Also, most web programming involves not just client side (browser) code, but also server code. That has much more variety. I suggest you learn by making something. Make a web page with both client and server code. You can use javascript for both if you want (node.js server for the server side). Or Java even.

Yeah, that's pretty much what I figured. I'll look into doing that.

Is Java really the only thing you know?

And did you do CS or another major path? Just wondering.

I just finished my first year at a 5-year IT (Information technology, it's like CS but almost 100% focused on software, little to no hardware) programme. I live in Sweden so the system is very different. For me it'll first be 3 years of IT, then I specialize for 2 years with a master. So yeah, after one year I only know Java, but that's the only language we've used so far. I know we'll be using Assembly and C in the first course of next year, but beyond that I suspect there won't be more any more languages "taught". I figured this would be a good time to start branching out, as I didn't know any programming before I started.
 
I'm just spending my time working on rasterization stuff after seeing missile's post, as well as doing some reading up on algorithms.

It's giving me good practice working in C, if anything.

edit(2:48): neat, got the triangle thing going - though this method is sort of long...
 
I'm just spending my time working on rasterization stuff after seeing missile's post, as well as doing some reading up on algorithms.

It's giving me good practice working in C, if anything.

edit(2:48): neat, got the triangle thing going - though this method is sort of long...

Yeah filling a triangle. Those function can get long with all the interpolation going on.
Scanline(fixed point 28.4 precision?) or Halfspace based?
I believe Half space has been the defacto method in professional renderers and hardware since like 1990.
But scanline is a lot easier to understand and make in software. And a lot more resources online to use.
My triangle scanline raster function is one found on the internet had to modified it for texture mapping and my own pipeline stuff.

Wish i had more time to at least refactor vertex and pixel calculations make them there own classes to seperate some of the logic, and wish i knew more about optimizations in c++
And dam gdi is fucking slow fuck you microsoft 80% of the time is spend presenting the frame by gdi. Hope to finish a bit of documentation before sunday and spend some time
sunday to use dx11 for to present the frames.
 
Yeah filling a triangle. Those function can get long with all the interpolation going on.
Scanline(fixed point 28.4 precision?) or Halfspace based?
I believe Half space has been the defacto method in professional renderers and hardware since like 1990.
But scanline is a lot easier to understand and make in software. And a lot more resources online to use.
My triangle scanline raster function is one found on the internet had to modified it for texture mapping and my own pipeline stuff.

Wish i had more time to at least refactor vertex and pixel calculations make them there own classes to seperate some of the logic, and wish i knew more about optimizations in c++
And dam gdi is fucking slow fuck you microsoft 80% of the time is spend presenting the frame by gdi. Hope to finish a bit of documentation before sunday and spend some time
sunday to use dx11 for to present the frames.
Well, since I went with the "try and figure this out" method, I went with scanlines - prior to the tri method, I wrote the one for lines (much simpler... :p).

Split the triangle into 2, then draw between highest and mid y, then mid to low y. It's real slow right now, so I think I'll have to fix a few things here and there. I'm not concerned with subpixel things right now, just figuring things. I actually didn't think about doing fixed point - the current method I have uses float, which probably is a factor in the slowness because I had to make a few macros for float comparison. But I'm rewriting it now, so that's that.

Oh, and I'm currently using SDL as the graphics presenter (it probably uses DX on the back or Windows though).

edit: Ah, found out what was making things so slow - unneeded call to a method. Things seem speedy - let's see if I can emulate triangle strips and whatnot...
 
Big O notation captures the worst possible running time. Look through the code, and try to figure out how many times the loop will run in the worst possible scenario.

(Personally I would just write O(n), but theirs is more accurate. Also, tip: use [ code ] to format code better.)
Thank you. I worked it out before tokkun posted and after that, it made a bit more sense.

The loop breaks when either i1 = n or i2 = n.

Each iteration of the loop increments exactly one of them. Therefore, assuming i1 and i2 started at 0, the total number of loop iteration is the sum of the values of i1 and i2 when the loop exits.

Again, the loop must exit when one of them reaches n, so the two worst-case scenarios at the time the loop exits are
i1 = n, i2 = n - 1
and
i1 = n - 1, i2 = n

In both cases the number of iterations is (n) + (n - 1) = 2n - 1.
But I took the time to went through this post this afternoon and I fully get it. Thank you so much. Your post really broke it down for me.

I had another question about big O but it concerns mergesort and two lists. I'll post it later since I have linear hw to due tomorrow.

Thanks again Haly, leroidys, and tokkun.
 
Top Bottom