December 27, 2024, 01:03:49 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Wondering where all the forums have gone?

Join the community Discord server!

Pages: 1 ... 51 52 [53] 54 55 ... 77

Author Topic: Official PyGG2 Development thread  (Read 161637 times)

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #780 on: June 21, 2012, 11:53:33 am »

You're gonna have to help me out with that one, because that genuinely makes no sense at all.
A variable on everything is one option. The other option is to make a general "Shot" class (f.ex.), and use some two separate "Shot_red" and "Shot_blue" classes that have separate code.
Both of them feature flexibility.
Logged

Saniblues

  • Onion Knight
  • Administrator
  • *****
  • Karma: -1305
  • Offline Offline
  • Posts: 12206
Re: Official PyGG2 Development thread
« Reply #781 on: June 21, 2012, 11:56:37 am »

I don't really see the point in doing that when you could easily alter how they function by using the variable that assigns their team. And we would only need a boolean if we're using the shot_red and shot_blue argument here.
Logged
Quote from: mop
Quote from: MR MAGN3TIC
I don't like it.  :nah:
Oh, well, you might as well pack up and stop now, because he doesn't like it
I'm bored out of my skull, Lets play a different game!
Lets take a visit down below And cast the world in flames!

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16150
  • Yeah so now I have an idea
Re: Official PyGG2 Development thread
« Reply #782 on: June 21, 2012, 04:58:29 pm »

it'd be good design to assign a .team variable to everything, and assign the numerical number to a constant.

It wouldn't make any sense to essentially hard code the two teams when behavior works identically
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #783 on: June 22, 2012, 06:14:35 am »

Alright. Then what I decided and already implemented was correct.
Logged

Glock Topic

  • New Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 10
Re: Official PyGG2 Development thread
« Reply #784 on: June 22, 2012, 07:45:32 pm »

team = True :x10: or False :x20: or None :ninja:

 :c1:
« Last Edit: June 22, 2012, 07:47:40 pm by Glock Topic »
Logged

Saniblues

  • Onion Knight
  • Administrator
  • *****
  • Karma: -1305
  • Offline Offline
  • Posts: 12206
Re: Official PyGG2 Development thread
« Reply #785 on: June 22, 2012, 10:56:31 pm »

team = True :x10: or False :x20: or None :ninja:

 :c1:
put this man on the dev team
Logged
Quote from: mop
Quote from: MR MAGN3TIC
I don't like it.  :nah:
Oh, well, you might as well pack up and stop now, because he doesn't like it
I'm bored out of my skull, Lets play a different game!
Lets take a visit down below And cast the world in flames!

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: Official PyGG2 Development thread
« Reply #786 on: June 22, 2012, 11:41:32 pm »

can bools really contain null
because if so then this guy is a genius
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

Glock Topic

  • New Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 10
Re: Official PyGG2 Development thread
« Reply #787 on: June 23, 2012, 03:38:55 am »

can bools really contain null
because if so then this guy is a genius
bools are immutable
« Last Edit: June 23, 2012, 03:46:44 am by Glock Topic »
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: Official PyGG2 Development thread
« Reply #788 on: June 23, 2012, 03:59:34 am »

no sir that is not how data types work
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Official PyGG2 Development thread
« Reply #789 on: June 23, 2012, 04:06:46 am »

no sir that is not how data types work

Yes sir, in Python bools, int's, None, str's among others are, in fact, immutable.

Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12532
  • Another one --
Re: Official PyGG2 Development thread
« Reply #790 on: June 23, 2012, 04:29:12 am »

I don't want to live in a world where people refer to consts while talking about storing dynamic data
I really don't
« Last Edit: June 23, 2012, 04:29:43 am by Chartreuse »
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

Glock Topic

  • New Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 10
Re: Official PyGG2 Development thread
« Reply #791 on: June 23, 2012, 04:42:39 am »

no sir that is not how data types work

Yes sir, in Python bools, int's, None, str's among others are, in fact, immutable.


and tuples
Logged

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Official PyGG2 Development thread
« Reply #792 on: June 23, 2012, 04:43:23 am »

I don't want to live in a world where people refer to consts while talking about storing dynamic data
I really don't

Assuming you're talking to me, I was talking about immutable, not constant.

Variable in Python's are more "names" for objects than anything. When I say a = 1 I assign the name "a" to 1. When I say a += 1 I'm actually saying a = a + 1, meaning I assign the name "a" to the value of "a" with one added. The int object with value 1 never changed.

This is also the reason the ++ operator doesn't exist in Python.
« Last Edit: June 23, 2012, 04:49:21 am by nightcracker »
Logged

nightcracker

  • NC
  • Full Member
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 516
  • PyGG2 dev
    • NC Labs
Re: Official PyGG2 Development thread
« Reply #793 on: June 23, 2012, 04:47:27 am »

no sir that is not how data types work

Yes sir, in Python bools, int's, None, str's among others are, in fact, immutable.


and tuples

As I said, among other things :) (frozenset)
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6409
  • Developer
Re: Official PyGG2 Development thread
« Reply #794 on: June 23, 2012, 04:50:44 am »

I still prefer integer constants for team stuff because there isn't really a good reason why to use bools and it forces us to use signed bytes in syncing (something I don't like) or some extra if conditionals.

If we allow None, we can't do easy if checking, so we'll have this
Code: [Select]
if team:
...
elif team == False:
...
else:
...
whilst with constants we would have
Code: [Select]
if team == constants.TEAM_RED:
...
elif team == constants.TEAM_BLUE:
...
else:
...

I prefer the latter. It's a lot more readable.
Logged
Pages: 1 ... 51 52 [53] 54 55 ... 77
 

Page created in 0.03 seconds with 36 queries.