Forums

Off Topic Chat Lounge Thread is sticky

Quick find code: 23-24-312-63626936

Icy Spring

Icy Spring

Posts: 3,248 Adamant Posts by user Forum Profile RuneMetrics Profile
Jack Flac said :
Basic data management at first, which was okay. It's what's pythons built for. But I ended up having to force build a game engine with it, which really wasn't fun. The libraries are there, but past a certain point, you're basically fighting with it to get it to do anything.

I don't know. 100-200 lines of code, for something I can write in c++ or c# in just 10-20, I can do it, but it isn't really fun.

How could Python possibly require that many more LoC?

30-Sep-2017 05:43:04

Jack Flac
Feb Member 2022

Jack Flac

Posts: 6,207 Rune Posts by user Forum Profile RuneMetrics Profile
Icy Spring said :
Jack Flac said :
Basic data management at first, which was okay. It's what's pythons built for. But I ended up having to force build a game engine with it, which really wasn't fun. The libraries are there, but past a certain point, you're basically fighting with it to get it to do anything.

I don't know. 100-200 lines of code, for something I can write in c++ or c# in just 10-20, I can do it, but it isn't really fun.

How could Python possibly require that many more LoC?
Because pythons greatest strength is also it's greatest weakness.

Python is designed first and foremost, with readability in mind. It's a scripting language that has both an easy to read ,and write ,syntax, but due to this is rigid in structure, and limited in terms of functionality. You have to do a lot more checks to mange something that you can pull off easily with other languages.

It's great for data management, but beyond that, you're going to be getting really creative, having to write long programs to get anything done.
Leader of The Enemy ||
The opposite of Justice is simply another Justice. What is Evil is subjective to each person.
YOU
are their evil

30-Sep-2017 06:11:51

Icy Spring

Icy Spring

Posts: 3,248 Adamant Posts by user Forum Profile RuneMetrics Profile
I don't really see what you're getting at. Dynamic typing makes complex projects with tens of thousands of lines of code a pain in the ass because you lose compile time type safety, but in general its object-oriented aspects are more or less the same as you would see in C++ or C#, minus templating, so program design usually wouldn't differ significantly. Do you have any code examples?

30-Sep-2017 06:43:08 - Last edited on 30-Sep-2017 06:43:30 by Icy Spring

Team Skull
Aug Member 2008

Team Skull

Posts: 24,511 Opal Posts by user Forum Profile RuneMetrics Profile
Averia Light said :

I must be punished for my complicity.


;)
"Revenge...is like a rolling stone, which, when a man hath forced up a hill, will return upon him with a greater violence, and break those bones whose sinews gave it motion."- Jeremy Taylor

30-Sep-2017 06:58:31

Jack Flac
Feb Member 2022

Jack Flac

Posts: 6,207 Rune Posts by user Forum Profile RuneMetrics Profile
Icy Spring said :
I don't really see what you're getting at. Dynamic typing makes complex projects with tens of thousands of lines of code a pain in the ass because you lose compile time type safety, but in general its object-oriented aspects are more or less the same as you would see in C++ or C#, minus templating, so program design usually wouldn't differ significantly. Do you have any code examples?
Heres a very simple piece of code that allows for spritestrip functionality in the Ren'py game engine.

https://pastebin.com/XcB7QrSC

Due to the limitations of python, you have to go through and physically define every single slot, with each image being a specific size, and the sheet having to be a specific, pre-defined layout.

With C++ or C#, it's much more adaptive. You don't have to individually define each slot, you can have the program run through, and grab the size reactively.

Python is a very rigid language. It isn't flexible.
Leader of The Enemy ||
The opposite of Justice is simply another Justice. What is Evil is subjective to each person.
YOU
are their evil

30-Sep-2017 07:37:41

Icy Spring

Icy Spring

Posts: 3,248 Adamant Posts by user Forum Profile RuneMetrics Profile
Don't take this the wrong way, but your code is clearly written by a novice. Duplicated effort (compileRows recomputes work done in makeSprites), two for-loops doing a single task instead of a single for-loop doing two tasks, manually enumerated for-loops (1*width, 2*width, ..., name1, name2, ...), and having your Animation class take a billion arguments seems like an awkward design.

Do you have any C++ code for comparison? Also, it's kinda unfair to make generalizations about a language based on your experience with some random game engine's interface...

30-Sep-2017 08:34:37 - Last edited on 30-Sep-2017 09:30:09 by Icy Spring

Dadizar
Oct Member 2005

Dadizar

Posts: 5,902 Rune Posts by user Forum Profile RuneMetrics Profile
Volkisch said :
Dadizar said :
Volkisch said :
Dadizar said :
Volkisch said :
I haven't lost my job yet ;-)
You work in a butcher shop right?

I think I saw you there. Is this you?





I don't know what that's from, I don't watch many movies movies.
Hint: If I were a rich man.


Like I said man, I don't watch many movies. Still no clue
I knew it. You are Lazar Wolf!
§¤*
What love we've given, we'll have forever. What love we fail to give, will be lost for all eternity. - Leo Buscaglia
»¤§

30-Sep-2017 13:07:17

Anarya

Anarya

Posts: 785 Gold Posts by user Forum Profile RuneMetrics Profile
Jack Flac said :
Basic data management at first, which was okay. It's what's pythons built for. But I ended up having to force build a game engine with it, which really wasn't fun. The libraries are there, but past a certain point, you're basically fighting with it to get it to do anything.

I don't know. 100-200 lines of code, for something I can write in c++ or c# in just 10-20, I can do it, but it isn't really fun.
Fair enough. Games engines definitely fall in the category of things I wouldn't touch with a 10 foot pole in Python. When runtime is critical, it's probably good to reach for something lower level.

Also, I really, truly, genuinely hate to be that guy, but you might want to look into list comprehensions. You could probably rewrite your spritestrip program into ~15 lines of code if you used them instead of hard-coding all those crops, renames, and loops.
https://docs.python.org/3/tutorial/datastructures.html?highlight=comprehension#list-comprehensions

30-Sep-2017 14:49:15

Jaesh

Jaesh

Posts: 30,083 Sapphire Posts by user Forum Profile RuneMetrics Profile
I don't really see what you're getting at. Dynamic typing makes complex projects with tens of thousands of lines of code a pain in the ass because you lose compile time type safety, but in general its object-oriented aspects are more or less the same as you would see in C++ or C#, minus templating, so program design usually wouldn't differ significantly. Do you have any code examples?
Have a heart. Have a brain. Be You. Be Vegan.

30-Sep-2017 16:18:41

Quick find code: 23-24-312-63626936 Back to Top