Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 614 615 [616] 617 618 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 903533 times)

Spehss _

  • Bay Watcher
  • full of stars
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9225 on: March 15, 2016, 02:52:09 pm »

You included string, not cstring.
...wow, how did I miss that.
Logged
Steam ID: Spehss Cat
Turns out you can seriously not notice how deep into this shit you went until you get out.

Urist McScoopbeard

  • Bay Watcher
  • Damnit Scoopz!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9226 on: March 17, 2016, 10:36:39 pm »

Okay, so... My relationship with programming has been shaky over the years... and recently I've been inspired to take another swing at c++ literacy or some such sort. Basically, I'll be re-teaching myself all the basics, etc. During my two years in college my career path has veered very close to videogame development... Interactive Media is a field in which I'm directly adjacent to. Developing games has always been something I wanted to take on, and at a various, times have attempted with varying degrees of completion... never successfully in the digital realm. So I figured I would set some goals for myself this time around.

I'd like some help in finding out what's achievable, how to go about it, etc. etc. Where to start?

1.) Drawing graphics + related mathematical equations. In this case, drawing irregular shapes and calculating their area. Specifically, I would like a user to be able to draw a number of straight lines and/or curves enclosing a space and be able to calculate that area.

2.) Putting that code to use creating interactive maps where country sizes can be calculated/redrawn.

3.) Packaging that into an executable client.

So, I'm armed only with some half-forgotten basic knowledge. I know roughly what I want to accomplish. But where do I go from here? What am I studying? This falls firmly into the realm of game graphics, and I just don't know enough to make an educated decision about to learn.

If I manage these 3 somehow, I'll be moving on to more advanced objectives. Thanks for the help peeps!
Logged
This conversation is getting disturbing fast, disturbingly erotic.

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #9227 on: March 17, 2016, 11:18:25 pm »

c++
[obligatory Python shilling]

Anyway, general advice is to break things into bits. Then you can learn each bit individually, and later pull all the bits together.
If a bit seems to difficult, break it into smaller bits until you can manage it.

So, I'm armed only with some half-forgotten basic knowledge. I know roughly what I want to accomplish. But where do I go from here? What am I studying? This falls firmly into the realm of game graphics, and I just don't know enough to make an educated decision about to learn.
Probably best to look at an existing engine like Unity or somesuch. This mostly boils down to your own personal preference.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

DragonDePlatino

  • Bay Watcher
  • [HABIT:COLLECT_WEALTH]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9228 on: March 17, 2016, 11:56:53 pm »

So, I'm armed only with some half-forgotten basic knowledge. I know roughly what I want to accomplish. But where do I go from here? What am I studying? This falls firmly into the realm of game graphics, and I just don't know enough to make an educated decision about to learn.

Having recently learned it myself, I can only suggest C++ and SDL 2.0. I'm entirely self-taught in programming but I managed to pick up the library pretty easily. There are tools specifically for game development like Game Maker and Multimedia Fusion but they cost money, have no OpenGL support and run way slower. Unity works well but I've heard it's a bit overkill for purely 2D games. There's also SFML which is newer and easier to learn, but lacks mobile support and documentation as a result.

1) SDL 2.0 has native support for basic primitives while libraries like SDL_gfx let you draw more complex shapes like irregular polygons. I haven't tried the latter library myself but it seems to be what you're looking for.

2) SDL 2.0 has built-in support for mice, keyboards, controllers, touchscreens, etc. Any of those could be used to interact with a map. How you calculate and redraw your maps would be something you decide once you start programming your engine.

3) Ayup...And it has Windows, Mac, Linux, Android and iOS support if you ever need those. To get SDL executables to work you have to include some .dll files in the same directory, but a lot of popular games (e.g. Dwarf Fortress :P ) do that and nobody seems to mind.
« Last Edit: March 18, 2016, 12:05:49 am by DragonDePlatino »
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9229 on: March 18, 2016, 12:30:39 am »

3) Ayup...And it has Windows, Mac, Linux, Android and iOS support if you ever need those. To get SDL executables to work you have to include some .dll files in the same directory, but a lot of popular games (e.g. Dwarf Fortress :P ) do that and nobody seems to mind.

Only coders (and usually only the coder who made the thing) care about the "impurity" of needing third-party DLLs. End users only give a shit (a big shit) if you rely on optional Microsoft DLLs that you haven't shipped with the product, and those aren't actually in their system. So it's actually better from that point of view not to rely on proprietary Microsoft technologies, and to go third-party and ship those DLLs yourself. Nobody who matters will ever notice.

Elephant Parade

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9230 on: March 18, 2016, 11:52:04 am »

Trying to learn to program. I've started with Python, since I've heard it's easy/easier.

So far, I've made two terrible joke programs, and I'm working on a third.

Code: (food.py) [Select]
import time

favfood = input("What's your favourite food? ")
print("Your favourite food is " + favfood + ", huh?")
time.sleep(2)
print("I'll go make some " + favfood + ", then.")
time.sleep(3)
time = float(input("Wait--how long does your favourite meal take to cook, in minutes? "))
time.sleep(2)
if time > 60:
    print("You must be a very patient person!")
    time.sleep(2)
    print("We'll be waiting a while, then.")
    time.sleep(4)
    print("Quite a while.")
    time.sleep(4)
    print("...")
    time.sleep(8)
    print("...")
    time.sleep(12)
    print("...")
    time.sleep(16)
    print("This is taking forever.")
    time.sleep(2)
    print("I'm going to cook something else.")
    time.sleep(2)
    print("If you don't like it, you can leave.")
else:
    print("Wow, you must not be very patient.")
    time.sleep(2)
    print("I hate impatient people.")
    time.sleep(2)
    print("Get out of my house.")
    time.sleep(1)

This returns an error:

Code: [Select]
Traceback (most recent call last):
  File "C:\Users\-awholebunchofstuffincludingmyname-\Python35-32\food.py", line 9, in <module>
    time.sleep(2)
AttributeError: 'float' object has no attribute 'sleep'
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #9231 on: March 18, 2016, 11:55:23 am »

You are overwriting the time module with a variable, time = "a number".
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Elephant Parade

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9232 on: March 18, 2016, 11:56:33 am »

You are overwriting the time module with a variable, time = "a number".
Oh, oops. I didn't realize that modules shared the same space as variables, though I guess that kind of makes sense.

Edit: It works now! Thanks!
Logged

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9233 on: March 18, 2016, 12:13:43 pm »

Having recently learned it myself, I can only suggest C++ and SDL 2.0. I'm entirely self-taught in programming but I managed to pick up the library pretty easily. There are tools specifically for game development like Game Maker and Multimedia Fusion but they cost money, have no OpenGL support and run way slower. Unity works well but I've heard it's a bit overkill for purely 2D games. There's also SFML which is newer and easier to learn, but lacks mobile support and documentation as a result.

Game Maker's alright for learning very beginning stuff, like objects and variables and execution order. I wouldn't recommend buying it, but it's alright for making little experiments like Flappy Bird and Pong clones.

I've never had a performance issue with it, unless I made a typo and wrote an infinite loop of objects exponentially cloning themselves. If you're creating anything reasonable, then the performance will be absolutely fine (regular-person fine, not "The debugger says that that there was a 0.01 millisecond delay while using this function call, WORST ENGINE EVER" fine). Source: nobody complains about Undertale's performance, and that was made using Game Maker.

The real issue with Game Maker is that it doesn't use any sort of real programming language. It uses its own scripting language, GML, which means you're stuck with exactly the functionality that YoYo sees fit to put in there; no more, no less. And YoYo's documentation outright lies in some cases. Third-party resources are skimpy at best, unless you love tutorials by fourteen-year-olds with terrible microphones.

You can extend Game Maker with DLLs, but that's about the point that I stopped caring.

And, finally, once you're ready to move on from Game Maker you can't take that experience anywhere else, since the way a Game Maker script is structured is so peculiar.

TLDR: Use the free version to make a few Pong clones or simple shoot-em-ups, then move swiftly on.
« Last Edit: March 18, 2016, 12:18:51 pm by itisnotlogical »
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Elephant Parade

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9234 on: March 18, 2016, 02:08:24 pm »

Code: [Select]
favfood = input("What's your favourite food? ")
print("Your favourite food is " + favfood + ", huh?")

There has to be a better way to do this than + spam, right? I think you can use % signs in Python 2, but that doesn't work in Python 3.
Logged

Bauglir

  • Bay Watcher
  • Let us make Good
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9235 on: March 18, 2016, 02:11:13 pm »

"Your favorite food is {}, huh?".format(favfood) would be the newer version, I think, but I actually prefer + spam when that's literally all I'm doing with it. It's more readable to me because I can read it in one pass instead of needing to jump over to the format arguments every time I see brackets. But for more complicated stuff, yeah, it's a lot more powerful.


EDIT: An alternative would be print("Your favorite food is ", favfood, ", huh?"), which I think works as expected with the default arguments (you can define your own separator between the things being printed, but by default it's the empty string). This does operate somewhat differently behind the scenes, IIRC, since I don't think the strings are ever actually concatenated. I should test that at some point, actually.
« Last Edit: March 18, 2016, 02:18:37 pm by Bauglir »
Logged
In the days when Sussman was a novice, Minsky once came to him as he sat hacking at the PDP-6.
“What are you doing?”, asked Minsky. “I am training a randomly wired neural net to play Tic-Tac-Toe” Sussman replied. “Why is the net wired randomly?”, asked Minsky. “I do not want it to have any preconceptions of how to play”, Sussman said.
Minsky then shut his eyes. “Why do you close your eyes?”, Sussman asked his teacher.
“So that the room will be empty.”
At that moment, Sussman was enlightened.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9236 on: March 18, 2016, 02:20:20 pm »

by default it's the empty string).

Space. Otherwise, yes. You can even use it in Python 2 with
Code: [Select]
from __future__ import print_function
Logged

Bauglir

  • Bay Watcher
  • Let us make Good
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9237 on: March 18, 2016, 02:23:36 pm »

Space.
Dangit! Yeah, you'd have to write print("Your favorite food is ", favfood, ", huh?", sep='')

Anyway, I'm amazed at how unpythonic this is since the idea is to have only one right way to do things, and there's at least three.
Logged
In the days when Sussman was a novice, Minsky once came to him as he sat hacking at the PDP-6.
“What are you doing?”, asked Minsky. “I am training a randomly wired neural net to play Tic-Tac-Toe” Sussman replied. “Why is the net wired randomly?”, asked Minsky. “I do not want it to have any preconceptions of how to play”, Sussman said.
Minsky then shut his eyes. “Why do you close your eyes?”, Sussman asked his teacher.
“So that the room will be empty.”
At that moment, Sussman was enlightened.

Elephant Parade

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9238 on: March 18, 2016, 02:38:24 pm »

So there's no way to do it that doesn't involve a whole bunch of extra stuff? That's kind of annoying, honestly. Thanks, though.

Edit: I was wrong--%s does still work. I just forgot the "s".
« Last Edit: March 18, 2016, 02:44:20 pm by Elephant Parade »
Logged

Bauglir

  • Bay Watcher
  • Let us make Good
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9239 on: March 18, 2016, 03:09:30 pm »

Four right ways to do it! Do I hear five?
Logged
In the days when Sussman was a novice, Minsky once came to him as he sat hacking at the PDP-6.
“What are you doing?”, asked Minsky. “I am training a randomly wired neural net to play Tic-Tac-Toe” Sussman replied. “Why is the net wired randomly?”, asked Minsky. “I do not want it to have any preconceptions of how to play”, Sussman said.
Minsky then shut his eyes. “Why do you close your eyes?”, Sussman asked his teacher.
“So that the room will be empty.”
At that moment, Sussman was enlightened.
Pages: 1 ... 614 615 [616] 617 618 ... 796