Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Vapourware Trying to learn programming from ~0, realistic goals naturally help needed.

Unwanted
Shitposter
Joined
Oct 5, 2014
Messages
3,390
Location
Nazi death cult center of jew medicine avoidance
While it's 'true' that they're both in ram, parts of the stack are very often found cached on L1 memory simply because it's what the CPU operates in most often. Or did you think it was faster magically?
Caching doesn't matter with temporary variables, bro.

There is no allocation involved in using the stack and no fragmentation of the heap.

jesus fucking christ - ignored
Sorry you did not get asskissing posts you feel you are entitled to. Sometimes I get mad that no one brofisted one of my posts, too.

edit: also dear, shitlord, the memory heap is not a data structure, you're getting it confused with the other heaps, which are trees - unfortunate naming that.

Still wrong my friend. The heap is called a heap because the memory the OS provides your application is always stored in some kind of heap data structure. If you write your own memory manager chances are you will still use a heap in some form.
 

baturinsky

Arcane
Joined
Apr 21, 2013
Messages
5,526
Location
Russia
You won't be a developer. It takes too long to get decent at, and all of your goals are way too ambitious. Just start with modding, write some scripts and forget the full blown developer thing for a long while.

Meh, not really. It takes a lot of time to be really good, but if you put in the effort and don't have hopelessly humanitarian mind, it's not hard to build something playable. Especially if you build upon existing engine, or mod existing game.
 

28.8bps Modem

Prophet
Joined
Jan 15, 2014
Messages
302
Location
The Internet, Circa 1993
You won't be a developer. It takes too long to get decent at, and all of your goals are way too ambitious.

Eh, pretty much anyone can be a decent enough programmer to ship a game these days. Computers are ridiculously powerful to the point that they're forgiving of terrible code, and there are tools like Game Maker that make it so even your source code doesn't have to be exactly perfect for it to compile and run.

Look at Tom Francis, the guy who made Gunpoint. He was a journalist who knew near enough bugger all about programming, and within a couple of years he shipped a reasonable game. That was pretty much the reason I decided I wanted to get serious about making an RPG. If he can ship a game, then I have no excuses what with being a software engineer already.
 
Self-Ejected

Davaris

Self-Ejected
Developer
Joined
Mar 7, 2005
Messages
6,547
Location
Idiocracy
28.8bps Modem
Yes, you don't have to be an awesome programmer to make games anymore. But you do have to enjoy the act of creation and have the will to finish things, when its not fun any more. Most people can't think an original thought, can't finish what they start and can't promote their games afterwards. These are the big 3 skills you need, same as anything else in life.
 

almondblight

Arcane
Joined
Aug 10, 2004
Messages
2,549
Now to complicate things. Numbers are different.
If you do
x = 5
y = x
y++
print x
print y

they will be different. Because = is different for numbers than objects (in python). For numbers it just creates a new memory by itself.

In python:

x = 5
y = 5

x and y will both be pointing to the same memory address. Even if you do:

x = 10
y = 11
<other stuff>
c = 5

c will be pointing to the same memory address x and y were before (whatever address python decided to give 5).

Perkel If you have trouble with mutable (information stored at this address can be change) and immutable (information at this address can not be changed) variables this might help.
 

Destroid

Arcane
Joined
May 9, 2007
Messages
16,628
Location
Australia
Implementation details like that aren't really relevant since the VM looks after all that stuff. As the programmer in this case you just need to know which data types are pass by value and which are pass by reference.

EDIT: Sorry if I just come in here to poopoo in my last few posts, I just don't think bombarding someone so new with all this under the hood stuff is useful.
 

Raghar

Arcane
Vatnik
Joined
Jul 16, 2009
Messages
22,506
Well shouldn't you do also some theoretic stuff like Sedgewick algorithms 1-4? To get proper theoretical background at first? Basically for first three weeks? It's nice stuff for complementing the early studies.

http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html IF you have zero knowledge go from here and STOP at generics. (Aka don't even read them)
Actually nutsandbolts trail would be sufficient for start, you can look also at http://docs.oracle.com/javase/tutorial/java/javaOO/index.html to get some idea about objects and other stuff, in case you'd move week - month later to object oriented programming after you'd get some basics.

Grab from somewhere "Beginning Illustration and Storyboarding for Games", and look at stuff needed for project management, otherwise you'd be quickly lost in 300 lines of code of your project. (Storyboards are mostly for movie industry, or for companies with 50+ developers, normally something more simple is used.)

http://www.oocities.org/temerra/los_rays.html
This is a simple stuff about FOV.
(In normal games it's done by: throw a lot of objects into GFX card and let drivers work the stuff they show on the screen. And when AI needs visibility simple check a line between AI and character for free space)

Anyway what types of games would you try to make?
 

baturinsky

Arcane
Joined
Apr 21, 2013
Messages
5,526
Location
Russia
Implementation details like that aren't really relevant since the VM looks after all that stuff. As the programmer in this case you just need to know which data types are pass by value and which are pass by reference.
Knowing difference between pass-by-value and pass-by-reference is essential in garbage-collecting languages too. And yes, you can cause memory leak in them too.
 

JMab

Augur
Joined
Nov 12, 2013
Messages
177
Location
Melbourne, Australia
The thread got assbergered. But this is the Codex after all.

Good point, I'm going to roll with it.

Perkel, I'd suggest randomly picking an NP-Complete Problem (my favorite is the Travelling Salesman) and come up with an algorithm that can solve it in O(n) time.

That will be a good beginner exercise to learn Python.
 

Burning Bridges

Enviado de meu SM-G3502T usando Tapatalk
Joined
Apr 21, 2006
Messages
27,562
Location
Tampon Bay
Sorry I got interested when I saw Codex + "programming thread". I remember participating in a thread about Qt 2 years ago and that was actually very interesting.
A pity that the thread is now derailing, Perkel seemed like a very curious pupil.

I was going to post this speech "Stop Writing Classes"
"I hate code and want as little of it as possible in our product"
While don't recommend to follow his advice evangelical it is a good introduction how people use OO to prepare for cases that will never be needed.
 
Last edited:

almondblight

Arcane
Joined
Aug 10, 2004
Messages
2,549
Implementation details like that aren't really relevant since the VM looks after all that stuff. As the programmer in this case you just need to know which data types are pass by value and which are pass by reference.

Eh...unless all you're doing is adding integers, you need to know the difference between mutable and immutable in python. Not like "theoretically this helps you understand some concepts" need to know, but "this is why some of your variables are (seemingly) randomly changing and others aren't" need to know.
 

desocupado

Magister
Joined
Nov 17, 2008
Messages
1,802
Can anyone explain to me what interfaces are and where and when you would use them? In the books I've read, I never quite understood them.
 

ChristofferC

Magister
Joined
Aug 12, 2009
Messages
3,515
Location
Thailand
To put it short, an interface specifies what functionality an implementation of that interface must provide. Ideally it comes with some documentation that describes the intent and requirements of the interface and some hints about how the implementations should look like.

Many times you don't want to care about which implementation of an interface you are using. Say, for example, that you want to retrieve some data from a backend. You don't really care which backend you fetch data from as long as you get the data. It could be an XML file, a database or a radio link to the moon. So you can have several implementations of the same backend interface, and you don't have to care about which implementation is being used. The implementation can be swapped out transparently.

The interface is the cornerstone of modular, extendable software.
 
Last edited:

Burning Bridges

Enviado de meu SM-G3502T usando Tapatalk
Joined
Apr 21, 2006
Messages
27,562
Location
Tampon Bay
Sometimes useful.
Same as above. I would only use interfaces when I absolutely know that I need them.
Any premature use of interfaces results in a clusterfuck.
 

titus

Arcane
Patron
Joined
Sep 28, 2011
Messages
1,719
Location
Romania
Can anyone explain to me what interfaces are and where and when you would use them? In the books I've read, I never quite understood them.

In general, think of them as molds for your objects. You can have a generic type of 'car' that provide you with certain details that a car can have. You won't create objects out of it but you can use it to implement specific car types/brands/whatever. Using it you know that a car must have an engine, wheels, that it can be driven, etc etc etc. In addition to that, each new car can have its own stuff but that doesn't affect the core.

In hardware, think of the USB interface. You have your pins and you know each pin's role. You don't care what's at the other end as long as the pins behave like they need to.

Or you want to provide plugin support for your application. You create an interface and all your plugins must provide the functionality of that interface. When you load the plugins your app knows what to expect and which method does what.

Basically this
The interface is the cornerstone of modular, extendable software.
 
Last edited:

Burning Bridges

Enviado de meu SM-G3502T usando Tapatalk
Joined
Apr 21, 2006
Messages
27,562
Location
Tampon Bay
Keep in mind that when you want to use an interface all methods of the interface must be implemented, and if you use interfaces everywhere without added benefit you are just making you own life hard.
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,810
rolling currently through various list, loop based exercises.

This tutorial is rather mediacore in therm of consistency with material earlier used. In one exercise it explains completely function in other it says use function .xxxx but it doesn't explain anything or even better sometimes when i fail to actually figure out proper answer i check answer and there is new function which wasn't mentioned earlier.

But it is rare though (happened like 2 times).

Still every new exercise build my knowledge how to tackle different problems.
 

Burning Bridges

Enviado de meu SM-G3502T usando Tapatalk
Joined
Apr 21, 2006
Messages
27,562
Location
Tampon Bay
That will never change. One function leads to another function etc. There are millions of classes / functions out there and you will add a few thousand of your own.
For the rest you have Intellisense.

On your level I would concentrate on keywords, and the basic rules of the language.
There are only a few and they are more important than functions.
and del from not while
as elif global or with
assert else if pass yield
break except import print
class exec in raise
continue finally is return
def for lambda try
That's a list of Python keywords. Neat isn't it? A search "language" + "keywords" will bring up similar short lists for other languages.
Your aim is to know all these by heart and be able to remember what they do.
If you try to understand every function that you use, you will never get finished.
If it works, I don't look into every function that I use. I mark it with a comment when / why it was included and in 99% of the cases I never look it up again.
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,810
huge boost to my morale.
I ploughed just now through 5-6 exercises without single mistake.
 

Perkel

Arcane
Joined
Mar 28, 2014
Messages
15,810
any reason why i should bitewise in python ?

Or should i ask why bitewise operations are a thing in higher language ?

My logic goes that if for example i will import data from files that are not in decimal then i would use bitewise to convert or to deal with them and export data to files which need to be in bytes.
 

JMab

Augur
Joined
Nov 12, 2013
Messages
177
Location
Melbourne, Australia
Files come in binary or text flavours, rather than being tied to a particular math notation, i.e. You can store decimal, hexidecimal or whatever you want in them, in either binary (non-human readable, smaller) or text.

Typically you'll only work with decimal numbers.

Bitwise operators are used to manipulate the computers smallest storage variable, the bit (can be 1 or 0).

You won't need to use these much in games. The most common use I've seen is with bit flags (or bit fields). This is where you store a list of options (or flags) for efficiency - it's more efficient to manipulate the bits of 8, 16 or 32 byte variables than it is to use a bunch of individual Boolean flags. Bools are normally 1 byte, however for a long time in Windows programming a 4 byte BOOL type was used.

So the typically game usage I've seen for bitwise operators is:

Flags |= DEBUG

This means you're turning on the DEBUG flags with a bitwise OR, whilst keeping all of the other bit flags in the variable as they are.

As long as you understand how to use the 3-4 common bitwise operators, you won't need to know much more and you won't need to use them very often.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom