Quantcast

Jump to content

» «
Photo

Random Programming Questions

18 replies to this topic
Liamardo
  • Liamardo

    Player Hater

  • Members
  • Joined: 25 Nov 2011

#1

Posted 25 November 2011 - 04:32 PM

Hey people.

So basically I have been modding for a while now but only at a basic level.
Ive used Img Tool, SAMI, TXD workshop, GGMM, Ped Editor and Obviously Cleo.
Ive designed vehicles, peds, buildings, etc. (3ds Max, Photoshop & Flash)

But I feel this is becoming small fry for me.
I've started looking into C++ and Direct x programming and finding it all a little overpowering.
The eventuality is that I want to be able to write my own codes and build my own games.

So this is kinda a request really, could anybody help me out with the basics of code writing?
and general advise?

I do realise there are plenty of resources out there to help me on my way but I would like the opportunity to
liaise with some one on the matter, say if I run into any problems or have questions I cant find answers to.

Cheers for now!

Liamardo.

Barguast
  • Barguast

    Thy next foe is...

  • Andolini Mafia Family
  • Joined: 27 Jul 2002

#2

Posted 25 November 2011 - 05:07 PM

QUOTE (Liamardo @ Friday, Nov 25 2011, 17:32)
I've started looking into C++ and Direct x programming and finding it all a little overpowering.

I'm not surprised, you're jumping in the deep end!

If you're just starting out with C++, you're best off writing some small programs to teach yourself the basics of the language. I mean text-based console applications that perform very basic tasks like adding numbers. You'll probably find this a lot more rewarding than it sounds, and you'll inevitably end up creating more and more complex programs and indirectly learning good habits.

Once you've nailed the basics of programming, the big bad scary world of DirectX will seem a little less daunting and a little more accessible, but again, you'll need to start with the basics. Your first Direct3D application will probably be a tricoloured gouraud triangle - but you'll look at it thinking that you're GOD. tounge.gif

In summary, take it slow, start from the beginning, and have patience.




Swoorup
  • Swoorup

    Foot Soldier

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#3

Posted 25 November 2011 - 05:37 PM Edited by Swoorup, 25 November 2011 - 05:40 PM.

I started out with C a month ago, should I go with C++ at the same time?
I looked at making a window-based app from C++ and really its too complex process going on! What I meant to say is, how long will an average programmer be fluent in these languages?

EDIT:Liamardo, I would suggest you take a look at cprogramming.com site. They contain the basic stuffs of C/C++ and explain very well.
Also you have any problems then there is always the forum. icon14.gif

Liamardo
  • Liamardo

    Player Hater

  • Members
  • Joined: 25 Nov 2011

#4

Posted 25 November 2011 - 05:54 PM

QUOTE (Barguast @ Friday, Nov 25 2011, 17:07)
If you're just starting out with C++, you're best off writing some small programs to teach yourself the basics of the language. I mean text-based console applications that perform very basic tasks like adding numbers. You'll probably find this a lot more rewarding than it sounds, and you'll inevitably end up creating more and more complex programs and indirectly learning good habits.



Cheers for the info dude!
I'm assuming your already adept at using c++.

so far Ive covered the basics but in the stuff I've read, it doesn't really explain too well how to create codes, if that makes sense. basically I understand how to make codes work and what processes have to happen before a basic application can work but what I don't get is, How do I know what codes to use... is there a list of data I should learn? for example Data works in binary witch is basically 1's & 0's witch is the computers native language (so to speak) but there is the other language witch is in text.... so does this mean for a specific number sequence there is a preset text equivalent? or is that over simplified? lol!




K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#5

Posted 25 November 2011 - 07:30 PM

QUOTE (Swoorup @ Friday, Nov 25 2011, 13:37)
I started out with C a month ago, should I go with C++ at the same time?

You should keep learning C until you get hang of structures, linked lists, and trees. That's a good point to switch over to C++.
  • lpgunit likes this

Swoorup
  • Swoorup

    Foot Soldier

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#6

Posted 26 November 2011 - 04:16 PM

I am learning from the site you told me, but with slower pace, applying each and every chapters into practical by just programming some useful things.
But how can I apply those linked lists and binary trees in practical. I mean for which problems.

Thank you though for all the information!

K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#7

Posted 26 November 2011 - 11:16 PM

Any time you want to have an "array" of objects, where you might want to take out or add an element, especially somewhere in the middle of the "array", linked lists might be a good solution. Their only downside is that they aren't easy to search. If you need the Nth element, you have to start with the first, jump to second, then to third... But sometimes, you only need the array to be processed in that order, and then there is simply no better option.

Lists can also save you a ton of time on memory allocation. Imagine that you have a bunch of objects that you keep creating and destroying. If you had to allocate memory every time and the delocate it, it can become rather slow, not to mention fragmentation issues. Instead, create a linked list of unused objects. Since they don't have to be ordered in memory, you can take and add objects to that list as you please. Just make sure you check its length every once in a while, and delocate unused objects if you ended up with too many. If the list is empty, and you need more, you allocate memory then.


And trees... It's a broad topic. There are search trees. Just about any AI will involve a search in a tree. Directory structure is a tree, so if you want to represent one in your program you'll have to have a tree of some sort. For rendering and graphics, there are partition trees. In particular, there is binary space partition (BSP - might sound familiar) and there are octrees. Octrees are used for everything from graphics, to physics, to AI for all kinds of neat optimization tricks. BSPs are absolutely brilliant for rendering. If you're going through NeHe tutorials, they do have one on BSPs later on. But basically, whenever you get to transparency, do realize that order in which you render things is important. BSP makes ordered transparency an absolute breeze, but there are some limitations.

So yeah, lists and trees are extremely important in programming. And you will cuss and want to throw things while learning them, because when writing pointer-chasers, the fact that your program compiled means absolutely nothing, and trying to find an error in a program that compiles and just crashes can be a pain.

SagaciousKJB
  • SagaciousKJB

    Captain tl;dr

  • The Connection
  • Joined: 21 Jun 2003
  • None

#8

Posted 05 December 2011 - 09:27 PM

I hate lists and trees, mostly because I can never find a good way to actually practice using them, so always find myself going back to reference manuals when trying to do something with them, never really getting a complete understanding since I seldom use them.

Swoorup
  • Swoorup

    Foot Soldier

  • Feroci
  • Joined: 28 Oct 2008
  • Nepal

#9

Posted 07 December 2011 - 03:34 PM

I have not seriously gotten into game programming now, because I am just covering some windows programming with C++. And honestly, I feel kind off empty doing linked list and trees now.

bartoc
  • bartoc

    Player Hater

  • Members
  • Joined: 15 Jun 2016
  • United-States

#10

Posted 17 June 2016 - 06:53 PM

Linked lists are nice to know, but I don't find myself using them that often, just because for most applications a flexible length array or some kind of good deque implementation (usually a linked list of little arrays actually) work better. Linked lists are CRITICAL structures though because they are how the memory allocator that enables all the nice things like flexible length arrays, hash tables, and easy to use strings possible actually works. To be honest once you understand graphs and trees you will probably understand how linked lists work pretty much intuitively.


Mr.Arrow
  • Mr.Arrow

    Zee's assistant and Resident Troll

  • Members
  • Joined: 08 Nov 2011
  • United-Kingdom

#11

Posted 3 days ago

Is assembly language worth learning for a programmer like me? Me and my group of friends are planning to write an operating system once I'll finish my degree in the next 4 years.

trip
  • trip

    ~

  • Andolini Mafia Family
  • Joined: 10 Oct 2007
  • United-States
  • Contribution Award [GTAF]
    Contribution Award [Gen Chat]

#12

Posted 2 days ago

Is assembly language worth learning for a programmer like me? Me and my group of friends are planning to write an operating system once I'll finish my degree in the next 4 years.

Sure. Back in school we actually had to produce a simple OS in assembly. And I do mean simple.

Call -151 :)
  • lpgunit, Mr.Arrow and Sweet Bellic like this

K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#13

Posted 2 days ago

Is assembly language worth learning for a programmer like me? Me and my group of friends are planning to write an operating system once I'll finish my degree in the next 4 years.

Knowing Assembly will make you a better programmer, period. If you are going to attempt writing an OS, it is absolutely vital to know.
  • lpgunit, Mr.Arrow and Sweet Bellic like this

lpgunit
  • lpgunit

    It's L, as in Lpgunit, not I.

  • Feroci
  • Joined: 24 May 2008
  • Philippines

#14

Posted 2 days ago

Is assembly language worth learning for a programmer like me? Me and my group of friends are planning to write an operating system once I'll finish my degree in the next 4 years.

Knowing Assembly will make you a better programmer, period. If you are going to attempt writing an OS, it is absolutely vital to know.

Well since that'll certainly give you access to the bare metal. 'Tis a pain to master though, and I heard that part of the reason why the Sega Saturn failed was that programmers were forced to write things in assembly for them to get better performance in games.

K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#15

Posted 2 days ago

Seems dubious. Writing assembly code for optimized performance was a still a common thing back then. A lot of DOS games would have bits of assembly code for graphics and audio performance. It's only with emergence of protected mode and operating systems using it that APIs became the only way of dealing with environment, and so the assembly use began to wane.

On the other hand, Saturn did have a weird architecture. It's possible that programming it in assembly was just that much harder than other systems.
  • lpgunit likes this

lpgunit
  • lpgunit

    It's L, as in Lpgunit, not I.

  • Feroci
  • Joined: 24 May 2008
  • Philippines

#16

Posted 2 days ago

Seems dubious. Writing assembly code for optimized performance was a still a common thing back then. A lot of DOS games would have bits of assembly code for graphics and audio performance. It's only with emergence of protected mode and operating systems using it that APIs became the only way of dealing with environment, and so the assembly use began to wane.

On the other hand, Saturn did have a weird architecture. It's possible that programming it in assembly was just that much harder than other systems.

They didn't come up with the likes of DirectX or OpenGL for nothing. Most held on to DOS simply because you have bare metal access to things, unlike with Windows where layers upon layers of abstraction add up to a programmer's woes. Chris Pirih, the programmer behind SkiFree, recalled as to how hard it was to get reasonable performance off an average 386 with an ISA video card. GDI wasn't exactly oriented for animation-intensive stuff like games, hence why Microsoft initially came up with WinG. But along with it came The Lion King and the PR disaster Disney, Microsoft and Compaq got, though it was more on part of Compaq's video card supplier who didn't thoroughly test their drivers.

Yeah the Saturn was an oddball in most respects. Adding a second CPU was a knee-jerk reaction (much like Sony's choice of using the Cell in the PS3), along with quad-based geometry. They got a fan in the name of Nvidia who implemented a similar quads-based scheme with the NV1, which led to a number of games ported to said graphics chip, but alas, both the NV1 and the Saturn didn't bode well.

K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#17

Posted 2 days ago

You can do direct-to-buffer writes with Windows just like you did with DOS and skip nearly all the GDI nonsense. For a good implementation see Quake II, which had both OpenGL for hardware rendering and completely custom software renderer that ran on machines without 3D acceleration. You didn't have any dynamic lighting in software, but it still looked rather impressive for its time. Although, one should keep in mind that it was created by people who weren't afraid to use techniques like Fast Inverse Square Root.

But yeah, it pales in comparison to what people pulled on DOS titles, where you could hijack the interrupt table.

If either of you feel like taking on a small assembly challenge, a really good one is writing your own SoundBlaster driver. It will only take a few functions in assembly, and you can write a C/C++ program that plays .wav files around it. Naturally, I strongly recommend using DOSBox rather than an actual DOS machine, and you can use DJGPP to compile an MS-DOS compatible binary. See my signature for hints. :p
  • lpgunit likes this

Mr.Arrow
  • Mr.Arrow

    Zee's assistant and Resident Troll

  • Members
  • Joined: 08 Nov 2011
  • United-Kingdom

#18

Posted A day ago Edited by Mr.Arrow, A day ago.

^  I really like that source code for Fast inverse square root , the comments in particular :lol:
 
Spoiler

lpgunit
  • lpgunit

    It's L, as in Lpgunit, not I.

  • Feroci
  • Joined: 24 May 2008
  • Philippines

#19

Posted A day ago

You can do direct-to-buffer writes with Windows just like you did with DOS and skip nearly all the GDI nonsense. For a good implementation see Quake II, which had both OpenGL for hardware rendering and completely custom software renderer that ran on machines without 3D acceleration. You didn't have any dynamic lighting in software, but it still looked rather impressive for its time. Although, one should keep in mind that it was created by people who weren't afraid to use techniques like Fast Inverse Square Root.

But yeah, it pales in comparison to what people pulled on DOS titles, where you could hijack the interrupt table.

If either of you feel like taking on a small assembly challenge, a really good one is writing your own SoundBlaster driver. It will only take a few functions in assembly, and you can write a C/C++ program that plays .wav files around it. Naturally, I strongly recommend using DOSBox rather than an actual DOS machine, and you can use DJGPP to compile an MS-DOS compatible binary. See my signature for hints. :p

Besides being that game programmers back then were loyal DOS fanboys, and wouldn't easily give up their system of choice.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users