Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411431 Posts in 69363 Topics- by 58417 Members - Latest Member: gigig987

April 20, 2024, 03:56:34 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General thread for quick questions
Pages: 1 ... 53 54 [55] 56 57 ... 69
Print
Author Topic: General thread for quick questions  (Read 134718 times)
Photon
Level 4
****


View Profile
« Reply #1080 on: May 19, 2017, 02:24:01 PM »

Yeah, I like underscores for type names and variable names. Functions LookLikeThisThough.
Wait, so you mix them?

You monster. Waaagh!
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #1081 on: May 19, 2017, 02:53:19 PM »

Functions are different than types/variables. They should look different to emphasize how important functions are!  Yawn
Logged
JWki
Level 4
****


View Profile
« Reply #1082 on: May 19, 2017, 11:16:12 PM »

Functions are different than types/variables. They should look different to emphasize how important functions are!  Yawn

Yup. Still trying to find out what I like best though, atm FunctionsAreThis and TypesAreThis_t for some reason, with variablesLookingLikeThis.
Logged
oahda
Level 10
*****



View Profile
« Reply #1083 on: May 19, 2017, 11:37:47 PM »

TypesLookLikeThis
variablesLookLikeThis
functionsLookLikeThisToo

m_memberVariablesOnlyLookLikeThis because I like having jQuery-style accessors where getters and setters are both just called the variable name so I need it to avoid name clashes, and of course the ugly extra bit goes on the hidden vars and not the exposed interface.

FunctionsLookLikeThis in C# tho because everyone else does it like that.

Also I use reverse notation so it's ActorEnemy and ActorPlayer and not EnemyActor or PlayerActor etc; the "derived"/specific descriptions come last so that related types are generally listed together when ordered alphabetically.
Logged

JWki
Level 4
****


View Profile
« Reply #1084 on: May 20, 2017, 01:39:51 AM »

TypesLookLikeThis
variablesLookLikeThis
functionsLookLikeThisToo

m_memberVariablesOnlyLookLikeThis because I like having jQuery-style accessors where getters and setters are both just called the variable name so I need it to avoid name clashes, and of course the ugly extra bit goes on the hidden vars and not the exposed interface.

FunctionsLookLikeThis in C# tho because everyone else does it like that.

Also I use reverse notation so it's ActorEnemy and ActorPlayer and not EnemyActor or PlayerActor etc; the "derived"/specific descriptions come last so that related types are generally listed together when ordered alphabetically.

Oh yeah in cases where I have private fields I also use the m_underscoreConvention, just to get intellisense to list all of them when I go "m_" in the editor.
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #1085 on: May 20, 2017, 09:09:56 AM »

m_ for intellisense is great Smiley

@JWki, yep. Pretty similar here:

some_variable
some_struct_t
some_struct_t some_struct; // a random variable, thx to _t is possible !!! this happens all the time
some_variable = SomeFunction( (some_struct_t*)some_struct );
 Kiss Kiss Kiss
Logged
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #1086 on: May 20, 2017, 09:47:29 AM »

In C++ and other traditional programming languages:
-FunctionName || ClassName
-variableName
-CONSTANT_NAME

In GML:
everything_looks_like_this
Logged

oahda
Level 10
*****



View Profile
« Reply #1087 on: May 21, 2017, 12:36:18 AM »

Right, forgot enum values.

IN_CPP_LIKE_THIS

inCSharpLikeThisBecauseUnityDoes

ExceptAtWorkLikeThisBecauseTheOthersDo
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #1088 on: May 21, 2017, 03:15:14 AM »

Please stop, people. No one cares, this is a textbook case of bike shedding.
Logged
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #1089 on: May 21, 2017, 03:51:21 AM »

Please stop, people. No one cares, this is a textbook case of bike shedding.

People seem to like chiming in though. Plus, it's not like this discussion has any real stakes, so I don't get the bikeshedding accusation at all
Logged

JWki
Level 4
****


View Profile
« Reply #1090 on: May 21, 2017, 05:52:03 AM »

He's right tho in that it's pretty trivial and doesn't really matter at all.

Now, has anyone here done client/server networking with rewind+replay before?
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #1091 on: May 21, 2017, 09:17:38 AM »

Yeah I have  Who, Me?
Logged
JWki
Level 4
****


View Profile
« Reply #1092 on: May 21, 2017, 09:20:08 AM »

Yeah I have  Who, Me?

Cool, trying that atm. I've never done any Realtime networking before so I'm starting with the naive approach and adding features like lag compensation, prediction etc incrementally.
Logged
oahda
Level 10
*****



View Profile
« Reply #1093 on: May 21, 2017, 09:29:39 AM »

Please stop, people. No one cares, this is a textbook case of bike shedding.
ill shed ur bike !!!  Mock Anger
Logged

cynicalsandel
Level 7
**



View Profile
« Reply #1094 on: June 09, 2017, 09:20:20 PM »

So, I'm faking tile based movement right now by having a timer count up 1 time each frame from 0 to 3 before resetting it where the player only moves on the 0 of the timer. It's very inelegant, but it was the best I could think of at the time. Right now, I think that if I tied the timer to starting on a button press rather than being tied just to what I guess is delta time, it'd improve it slightly, but I'm an idiot and haven't been able to figure it out yet and I'm worried it still wouldn't feel right. (Tile based movement seems self explanatory, but essentially I'm trying to ripoff original Pokemon movement)

I asked a competent programmer over twitter what they did, and I got back "Ah, the easiest way is set the tile destination, do the movement itself in pixels, move X pixels/timestep until you reach the new tile". I didn't want to bug them further, but it feels relatively similar to what I was already trying for but I don't have tile destinations.

I'm trying to figure things out on my own to improve slightly as a programmer and not just have people write code for me, but I'm struggling.

edlt: ok i need more help i'm trying to figure out how to get a math pattern of a = b, b+2, b, b+4 then it loops (i'm trying to write a new function for my animations, and i know how to do it with 2 or 3 frames that are all unique, but i run into problems because i want to reuse one frame for 4 total frames or 3 with a ping pong back and forth pattern)

i should probably mention i'm using pico-8 and like half of my problems are only problems because of limitations
« Last Edit: June 09, 2017, 11:27:49 PM by cynicalsandel » Logged

Photon
Level 4
****


View Profile
« Reply #1095 on: June 10, 2017, 09:38:01 AM »

Please stop, people. No one cares, this is a textbook case of bike shedding.

People seem to like chiming in though. Plus, it's not like this discussion has any real stakes, so I don't get the bikeshedding accusation at all
I was genuinely curious. I see "camelcase" all over the place and end up feeling out of touch. Tongue
Logged
Photon
Level 4
****


View Profile
« Reply #1096 on: June 23, 2017, 05:52:32 AM »

So I'm hoping to put out a beta/demo version of my current project soon, and I was wondering what one might use for packaging it up. That is, in particular, I want to protect the game assets so that they aren't just sitting out there for anyone to copy and use. I'm totally new at this sort of thing so I'm not sure where to start or if I have to make some sort of concession in the actual game code itself for this.

@cynicalsandel: Can you show us what your code looks like right now?
Logged
oahda
Level 10
*****



View Profile
« Reply #1097 on: June 23, 2017, 09:41:16 AM »

Just wanted to confirm something that seems obvious but which would be nice to have explicit: it's better to pass something like a char by value than by reference because the char is only one byte but the reference is a couple of bytes, right?
« Last Edit: June 25, 2017, 05:09:07 AM by Prinsessa » Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #1098 on: June 23, 2017, 12:08:43 PM »

Yes
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #1099 on: June 23, 2017, 05:11:53 PM »

Just read the whole naming discussion.


This is one of the things I like about C#. There is an official standard for naming etc and it's pretty much used everywhere so you don't have to have these silly discussions about how to use a language.
Logged

Pages: 1 ... 53 54 [55] 56 57 ... 69
Print
Jump to:  

Theme orange-lt created by panic