Be a Supporter!

Programming Regs Lounge

  • 421,947 Views
  • 17,911 Replies
New Topic Respond to this Topic
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2013-01-23 18:48:42 Reply

At 1/23/13 06:04 PM, Dean wrote: It's still a long way from being done but if anyone has any comments, I'd like to hear them. Especially if they're alerting me to something I've done badly.

I'm playing a game while typing this up so I can't provide too much advice but one thing I noticed is this:

echo "<p>Error logging you in</p>\n";

Your error messages are in const-strings (or whatever they're called in PHP). It's best to store error messages (as a const) in some other file so you don't need to go digging through source code to find where you're outputting some arbitrary error message because you want to change the message itself or translate it to another language.

Also in a similar vein your Database class, based on its design, assumes it will never change. Any change you your SQL schema will require you to look through your source code to adjust the const strings to accurately represent said changes, when those should be handled by an ORM of some sort.

I can give it a more thorough look-through later, but those two stood out to me.

Dean
Dean
  • Member since: Feb. 16, 2008
  • Offline.
Forum Stats
Moderator
Level 47
Gamer
Response to Programming Regs Lounge 2013-01-24 04:11:54 Reply

At 1/23/13 06:48 PM, Diki wrote: Your error messages are in const-strings (or whatever they're called in PHP). It's best to store error messages (as a const) in some other file so you don't need to go digging through source code to find where you're outputting some arbitrary error message because you want to change the message itself or translate it to another language.

Those are actually still left over from when I was testing the functions. I was just printing strings on to a webpage so that I could see whether the functions were actually working as intended or not. I've not got any proper error handling in there yet. It's something I'll need to look into anyway because I don't think I've ever handled errors properly.

those should be handled by an ORM of some sort.

Never used or even heard of an ORM before. That's something I'll have to look into.

I can give it a more thorough look-through later, but those two stood out to me.

Thanks for the pointers.


BBS + Chat Moderator - Feel free to send me a PM if you have a problem!
Want to instant message me? [ Skype - DeanNewgrounds ]

BBS Signature
deckheadtottie
deckheadtottie
  • Member since: Oct. 21, 2003
  • Offline.
Forum Stats
Supporter
Level 59
Programmer
Response to Programming Regs Lounge 2013-01-24 11:06:31 Reply

At 1/23/13 06:04 PM, Dean wrote: It's still a long way from being done but if anyone has any comments, I'd like to hear them. Especially if they're alerting me to something I've done badly.

Looks good, Dean. I have a couple of questions/comments, though.

1) Is there a particular reason for not using access modifiers for your methods? I would have thought the idea of using these modifiers was pretty clear cut, but after a quick Google search I can see people do not like using them. I'm wondering what your reasons are to omit them. (I sound like a cock there, but I am genuinely curious).

2) Stick to one style of outputting PHP to the document. I notice you do use my preferred method[1], but then jump back to hanging braces and echo'ing out HTML[2]. Ideally you'll completely separate this logic and functionality, but I appreciate it's not always easy.

3) Unless I missed it (likely), your site is currently vulnerable to script/HTML injection. Say, if someone entered the username "<h1>deckheadtottie</h1>", that will display "deckheadtottie" in the header 1 style whenever you call it from the database.

4) I could be wrong here (again, likely), but you instantiate a lot of Database objects, but never "kill them" [3]. I've heard it is good practice to do so, but am willing to concede. I'd imagine that they would be get garbage collect anyway, but I seem to remember being told to kill the database connection once you've finished using it. If you do require that "always on" connection, you could creating the database as a singleton and you wouldn't need to instantiate different instances.

Overall, I like it, and I would definitely love to be part of a project like this. Such a shame I hardly seem to ever have the time. This summer, dammit. This summer.

[1]

<?php if ($foo) : ?>
   <p> here is some HTML, I'm easier to style for people who don't programme PHP.</p>
<?php end if; ?>

-------------------------
[2]

<?php if ($foo) {
         echo  "<p> here is some HTML, but I'm too scared to touch it in case it breaks. I only use dreamweaver.</p>";
            } ?>

-----------------------
[3]

//at them end of the document
</body>
<?php $this->db->killDB(); //your method for unsetting the connection ?>
</html>

#coys

BBS Signature
Dean
Dean
  • Member since: Feb. 16, 2008
  • Offline.
Forum Stats
Moderator
Level 47
Gamer
Response to Programming Regs Lounge 2013-01-24 14:28:13 Reply

At 1/24/13 11:06 AM, deckheadtottie wrote: 1) Is there a particular reason for not using access modifiers for your methods?

In honesty, I don't have a reason for omitting them because it wasn't a concious decision. For some reason I always forget to include the visibility of method in PHP because I've never used it in an object orientated way prior to this. They'll all no doubt just default to being public right now, I'd think. I'll look over that though.

2) Stick to one style of outputting PHP to the document.

Unless I'm mistaken, the only instances of me echoing lines of HTML will be leftovers from when I was testing the back end, prior to actually having a front end to output the function results to. You should only be seeing me echoing lines of HTML from functions that are commented as being incomplete. Either that or I am being inconsistent somewhere and just not spotted it. Problem is that I started this project months ago. I'd work on it for a little while, not touch it for weeks and then work on it again. So because of that, there may be inconsistencies that I've just not spotted.

3) Unless I missed it (likely), your site is currently vulnerable to script/HTML injection.

I wouldn't be surprised if there are security holes in it, right now I've not looked into that stuff. I've mostly been trying to get something up and running that has basic functionality. Just so I can get an idea of what the final thing might look like. Once I have the basics set up I'll look into the stuff you just pointed out.

4) I could be wrong here (again, likely), but you instantiate a lot of Database objects, but never "kill them" [3].

Yea, that's probably just me being naive. I think (could be wrong) that database connections are automatically closed after a script has executed. As for the objects themselves, I'm not sure what happens to them after the script is executed. I'd assume they'll die once the script has ran, rather than live on in memory. Again, I'm not too sure on this so it's something I'll need to look into. Maybe I should be closing database connections and killing objects as a matter of good practise anyway.

Overall, I like it, and I would definitely love to be part of a project like this. Such a shame I hardly seem to ever have the time. This summer, dammit. This summer.

I'd still really like to get some experience working on a project over the internet as part of a team. It's all good and well for me to do my own thing but it doesn't give me any experience working with other people's code. I'd be more than willing to work on some kind of summer project with you (and anyone else who's interested) if you're still up for it. Again, working as part of a team isn't something I get all too much experience of.

Appreciate the feedback, Joe.


BBS + Chat Moderator - Feel free to send me a PM if you have a problem!
Want to instant message me? [ Skype - DeanNewgrounds ]

BBS Signature
kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2013-01-26 15:58:27 Reply

So I went to the firefox os app days event today, apparently they organized a global hackathon and I knew one of the speakers that came in my town and I went there more or less to have a chat with him, then said what the heck, if I'm here might as well try and make something.
Long story short I won a developer phone and I opensourced an older game of mine that I wanted to make public for a long time now, just didn't quite find the time to make it look like something worth presenting (you can find it here)

Generally I'm happy with the way the code turned out in the end, the AI is a bit of a mess, but otherwise it (kinda) looks ok so if you want to give it a try, just fire up menu.html.

I'm gonna give you a short tutorial here because it's probably not that intuitive the first time you see it, basically you have a pawn on one side of the table, and you have to get it to the other side and so does the opponent. For this you can drag and drop your pawn and move it one tile up / down / left / right or drag a water tile from the rightmost toolbar and try to block the path of your opponent and he's going to do the same.

Otherwise the AI isn't that smart, it's a minimax algorithm, but out of laziness I only made it explore just one level in the game state tree so you can easily fool it, but the game itself is somewhat enjoyable for 2-3 minutes or so.

So yeah /rant I'd appreciate some comments if you like it though.

smulse
smulse
  • Member since: Mar. 24, 2005
  • Offline.
Forum Stats
Member
Level 31
Blank Slate
Response to Programming Regs Lounge 2013-01-31 05:14:07 Reply

At 1/26/13 03:58 PM, kiwi-kiwi wrote: Long story short I won a developer phone and I opensourced an older game of mine that I wanted to make public for a long time now, just didn't quite find the time to make it look like something worth presenting (you can find it here)

Haha awesome, congrats -


BBS Signature
Cenaf
Cenaf
  • Member since: Nov. 14, 2009
  • Offline.
Forum Stats
Member
Level 04
Artist
Response to Programming Regs Lounge 2013-01-31 13:28:58 Reply

Hi guys, im not into programming im more of a artist\animation. But i need one small script in as2 for small work. If someone can make it please do.

I have a main menu with 4 big buttons that are actually wider than flash window and dont fit all at the same time. I already have a "vcam" script already.
So the deal is that when you move cursor to the right it moves camera(movie clip) slightly to the right to show the rightest button, and so a for the left side. If possible the movement should be soft.

Thx in advance.


BBS Signature
kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2013-01-31 14:11:25 Reply

At 1/31/13 05:14 AM, smulse wrote: Haha awesome, congrats -

Thanks smulse xD

Dean
Dean
  • Member since: Feb. 16, 2008
  • Offline.
Forum Stats
Moderator
Level 47
Gamer
Response to Programming Regs Lounge 2013-01-31 14:26:49 Reply

Decided to try and learn some C++ in my spare time. I'm going to have to learn it anyway because we're expected to write a game with it sometime soon but the pace of the lectures is a bit slow. The game will be due in 7 weeks time, maximum and the lectures (we get 3 a week at most) have yet to even touch on actual game programming. So far it has just been a (slow) introduction to C++. I sat in the computer lab for 2 hours this morning and read a good chunk of the tutorial at cplusplus.com and I already feel like I've covered way more than we've been taught in the lectures. I suppose that'll be expected of us anyway but I know a lot of people who wont bother, and we're working on these games individually, not as part of a group, so I get the impression some people are going to do pretty badly.

How realistic is it to learn C++ (from limited experience with C and reasonable experience with Java) AND develop some kind of simple arcade game in a 7 week period? Keeping in mind this isn't our actual priority. I should really be putting my dissertation project before this. My plan for this game was to develop some kind of 2D side-scrolling platformer/shooter. Unsure at this stage how much work is involved in that t hat. The task is just to develop a simple old style arcade game so I might be over complicating it. Still, I'd like to learn this stuff anyway.

At 1/31/13 01:28 PM, Cenaf wrote: But i need one small script in as2 for small work. If someone can make it please do.

Action Script related stuff belongs in the Flash forum. You'll have better luck getting help over there.


BBS + Chat Moderator - Feel free to send me a PM if you have a problem!
Want to instant message me? [ Skype - DeanNewgrounds ]

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2013-01-31 14:47:03 Reply

At 1/31/13 02:26 PM, Dean wrote: How realistic is it to learn C++ (from limited experience with C and reasonable experience with Java) AND develop some kind of simple arcade game in a 7 week period?

Really depends on how much of C++ you want to learn.

If you want to become competent enough with C++ such that you would be able to put it on your resume then you don't have a snowball's chance in hell. Even with some experience with C it will still take upward of 6 months to really learn the ins and outs of C++ (possibly even more if you want to become an expert on templating, RIAA, RVO, compiler optimisations, overflows, et cetera).

But if instead you just want to learn enough such that you are able to code a game that "works", assuming it is a console text-based game, you should be fine. However since you said this:

At 1/31/13 02:26 PM, Dean wrote: My plan for this game was to develop some kind of 2D side-scrolling platformer/shooter.

I'd say that's pretty unlikely since you're going to have to learn C++, learn how to write a game in C++, learn the Windows API, and also learn how to use a game engine, as well as code an entire game, all in only seven weeks.

Seven weeks is not a long time, and C++ is a very complex language. When I was in college we spent our first semester learning C++ from scratch, and our final project was to make a text-based version of blackjack in the console with basic ASCII graphics, and that alone was a hell of a challenge.

Was it your professor's idea to have your first C++ project involve a graphical game?

P.S.
Java experience won't really help other than you already being comfortable with C-like syntax. Java and C++ are very different languages.

Dean
Dean
  • Member since: Feb. 16, 2008
  • Offline.
Forum Stats
Moderator
Level 47
Gamer
Response to Programming Regs Lounge 2013-01-31 14:50:39 Reply

Also meant to show you guys this thing called instacode, if you weren't already aware of it. It's pretty cool, albeit useless. Doesn't seem to be running very smoothly on my desktop but it worked fine on the computer I was using earlier.

Basically, you just paste some code into a text box, choose a style of output and it'll produce a hipster image of your code so that you can post it all over the internet and have people who don't program think you're well cool!

Programming Regs Lounge


BBS + Chat Moderator - Feel free to send me a PM if you have a problem!
Want to instant message me? [ Skype - DeanNewgrounds ]

BBS Signature
egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Supporter
Level 05
Game Developer
Response to Programming Regs Lounge 2013-01-31 15:09:05 Reply

At 1/31/13 02:50 PM, Dean wrote: Basically, you just paste some code into a text box, choose a style of output and it'll produce a hipster image of your code so that you can post it all over the internet and have people who don't program think you're well cool!

i'm so cool, guys! :3

Programming Regs Lounge


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2013-01-31 15:09:09 Reply

At 1/31/13 02:50 PM, Dean wrote: Also meant to show you guys this thing called instacode

I find this discovery utterly useless, yet unnaturally addictive.
I now understand what my hipster friends feel when they post food on facebook

Programming Regs Lounge

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2013-01-31 15:13:09 Reply

Also to add on to what I said earlier here's an example I like to use to show how much of a headache C++ can be.
Consider the following code:

template <class Ty>
struct Thing {
    typedef Ty value_type;
    Ty value;
};

template <class Ty>
class Container {
private:
    Ty _thething;
public:
    Ty::value_type get_thing_value() const;
    void set_thing_value(Ty::value_type);
};

template <class Ty>
Ty::value_type
Container<Ty>::get_thing_value() const {
    return _thething.value;
}

template <class Ty>
void
Container<Ty>::set_thing_value(Ty::value_type value) {
    _thething.value = value;
}

It's a pretty straight forward example of templates, something you will undoubtedly use if you're making a game.
All it does store an object in Thing (a floating point, for example) and then stores another object in Container that is assumed to be of type Thing, but could be anything that has a public value_type type and a variable called value that matches that type. Pretty simple.

However if you attempt to compile that you'll get the following errors (this might vary slightly depending on compiler/compiler settings):

error C2146: syntax error : missing ';' before identifier 'get_thing_value' (line 12)
error C4430: missing type specifier - int assumed. (line 12)
error C2061: syntax error : identifier 'value_type' (line 13)
error C2143: syntax error : missing ';' before 'Container<Ty>::get_thing_value' (line 18)
error C4430: missing type specifier - int assumed. (line 18)

And all of that is because a single keyword was missed in four places, and the errors do not help to figure out what that keyword is.
This is an error I make all the time while writing template code, and even when I know what's causing it it still gives me a headache (and makes me feel like an idiot).

See if you can figure out what the missing keyword is. :)

P.S.
This isn't some convaluted edge-case example. This is something you are likely to do. It's common to have a class depend on its templated type having a templated type as well.

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2013-01-31 15:30:57 Reply

Also @Dean 7 weeks is unfortunately a very small timespan if you're making a game for the first time, there's a lot of stuff that can go wrong when you do rendering in C++, It'd be easier for you to get yourself a starter application close enough to whatever it is you want to achieve and modify it to make your game.

For instance you can take this asteroids game and turn it into a side scroller

smulse
smulse
  • Member since: Mar. 24, 2005
  • Offline.
Forum Stats
Member
Level 31
Blank Slate
Response to Programming Regs Lounge 2013-01-31 15:52:39 Reply

Haha awesome

Programming Regs Lounge


BBS Signature
kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2013-01-31 15:53:51 Reply

At 1/31/13 03:13 PM, Diki wrote:
However if you attempt to compile that you'll get the following errors (this might vary slightly depending on compiler/compiler settings):

gcc is a lot more helpful with the errors here, but visualc also tries to tell you in it's twisted way that it can't figure out the type for Ty::value_type

Also game programmers tend to stay as far away from templates and RTTI as possible because it gets convoluted easily and when it's 2 am and you have a deadline, the last thing you want to do is to step through templated code.
I've worked for two years in a company that made games and the only templates I've seen written in the engine were some COM building blocks and std::vectors.
Kotaku has a very nice article on the subject in the form of John Carmacks' coding guidelines for Doom 3

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2013-01-31 16:51:58 Reply

this had to be done

Programming Regs Lounge

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2013-02-01 13:16:01 Reply

While we're at it, I did this today and it took me a whole 10 minutes to figure out what I did wrong

#include <vector>

class Something;

typedef std::vector<Something> TSomethingArr;
typedef std::vector<Something>::iterator TSomethingIt;

class Something
{

};

class Bar
{
public:
    TSomethingArr items;
};

void Foo(const Bar& obj)
{
     for(TSomethingIt objIt = obj.items.begin(); objIt != obj.items.end(); ++objIt)
     {
            //stuff
     }
}
Dean
Dean
  • Member since: Feb. 16, 2008
  • Offline.
Forum Stats
Moderator
Level 47
Gamer
Response to Programming Regs Lounge 2013-02-04 17:31:12 Reply

Sat down and did some work on my dissertation project today. Creating an audio chat application that will hopefully work using an ad-hoc Wi-Fi connection eventually. I've not actually started on ad-hoc yet but today I successfully captured audio from the phone's microphone, stuck it in a UDP packet, sent it across the network and then played it back on my phone.

Unfortunately I don't have access to another Android device right now so I'm currently speaking into my phone, the data is just being sent right back to my phone and played through the speakers. In theory, if I just changed the UDP packets destination address to the IP of another Android phone running this app, it should work. I see no reason why it wouldn't. However, playing back the audio on my phone is slightly irritating due to the echo effect created by the mic recapturing the audio being played through the speaker.

I'm surprised at how little delay there is between transmitting and receiving the audio though. I was led to believe there was going to be a very noticeable delay. Right now it's about half a second, probably less. Until I get access to another Android device (hoping the uni will help me out there) I'm probably going to have to try to write a Java app to run on my PC that can capture the UDP packets and play them back. At least then I'd get a better idea of what the sound quality is like because the echo/feedback makes it hard to tell how clear it actually is.

Still, I was so pleased when I spoke into the phone and the audio played back through the speaker. I still have a lot of work to do though. That app itself is pretty non-existent. All I've done so far is successfully stream live audio.


BBS + Chat Moderator - Feel free to send me a PM if you have a problem!
Want to instant message me? [ Skype - DeanNewgrounds ]

BBS Signature
Dean
Dean
  • Member since: Feb. 16, 2008
  • Offline.
Forum Stats
Moderator
Level 47
Gamer
Response to Programming Regs Lounge 2013-02-04 18:01:55 Reply

Wait, I may have just made a fool of myself. If a packet is being addressed to localhost, it's not even going to be sent across the network, is it?


BBS + Chat Moderator - Feel free to send me a PM if you have a problem!
Want to instant message me? [ Skype - DeanNewgrounds ]

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2013-02-04 20:47:58 Reply

At 2/1/13 01:16 PM, kiwi-kiwi wrote: While we're at it, I did this today and it took me a whole 10 minutes to figure out what I did wrong

Const-iterators and statically typed languages are a bitch. :)

At 2/4/13 06:01 PM, Dean wrote: Wait, I may have just made a fool of myself. If a packet is being addressed to localhost, it's not even going to be sent across the network, is it?

It will be transmitting it on your local network, so you were correct when you said that all you need to do is change the destination address.

Dean
Dean
  • Member since: Feb. 16, 2008
  • Offline.
Forum Stats
Moderator
Level 47
Gamer
Response to Programming Regs Lounge 2013-02-05 04:27:23 Reply

At 2/4/13 08:47 PM, Diki wrote: It will be transmitting it on your local network, so you were correct when you said that all you need to do is change the destination address.

Hmm. I just thought that if a packet is addressed to localhost, it wont be sent across the network because surely it will realise that the destination address is the same as the address of the device. Isn't that how a packet knows that it has arrived at the intended destination?

To try and verify my theory, I ran the application without my device being connected to the network (Wi-Fi was disabled) and sure enough, it played back the data. So it looks like I will have to write a Java application for my computer which will hopefully receive and play back the data in these packets. At least then I'll be able to see how well it operates when actually transmitting over the network.

I'm actually not expecting it to perform well when working over the network in it's current state. From what I recall, UDP does not retransmit packets which are not received (because it doesn't know if the packets are received) and there's no guarantee that packets will be stored in the intended order on the receiving device because the packet headers provide no information that would allow them to be ordered correctly. I can imagine that this would result in audio playback that just sounds like noise. UDP packet headers only consist of 8 bytes, I think, which contain the port of the sender, the port of the receiver, the total length of the packet and a checksum of the packet. Useful for applications like mine because it allows the data to be sent quicker than if I were using TCP which has to perform all sorts of reliability checks which slows down transmission time.

This means I'm going to have to look into RTP, which I think is used to make sure the packets are ordered correctly at the receiving end, amongst other things.


BBS + Chat Moderator - Feel free to send me a PM if you have a problem!
Want to instant message me? [ Skype - DeanNewgrounds ]

BBS Signature
Wolfos
Wolfos
  • Member since: Jan. 19, 2008
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to Programming Regs Lounge 2013-02-05 11:19:14 Reply

How long do you guys think a class should be at minimum?

It takes me 10 lines to implement a scrollbar with my current codebase. Is that worth it's own class?

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2013-02-05 11:55:07 Reply

At 2/5/13 04:27 AM, Dean wrote: Isn't that how a packet knows that it has arrived at the intended destination?

Yes, but you're still transmitting via a network protocol, so it's still doing the same thing it would be if you were transmitting your voice via the same protocol over the Atlantic ocean. I don't see any reason why it would stop working just because you changed the destination IP.
Though technically your protocol has no idea if the packet arrived, because you're using UDP (which you should be for VoIP). Only TCP knows if the packet arrives because that protocol guarantees no packet will ever be lost.

At 2/5/13 04:27 AM, Dean wrote: So it looks like I will have to write a Java application for my computer which will hopefully receive and play back the data in these packets.

That I do recommend doing. You'll get somewhat realistic lag, and it will eliminate the feedback loop that you've been getting.

At 2/5/13 04:27 AM, Dean wrote: From what I recall, UDP does not retransmit packets which are not received (because it doesn't know if the packets are received) and there's no guarantee that packets will be stored in the intended order

That is correct. You have to confirm that they're in the correct order yourself.

At 2/5/13 04:27 AM, Dean wrote: Useful for applications like mine because it allows the data to be sent quicker than if I were using TCP which has to perform all sorts of reliability checks which slows down transmission time.

Not only that but if a packet is lost on TCP it will block and stop handling new packets until it gets the one that it dropped which would cause your conversation/voice transmission to fall way out of sync (and possibly have the receiving end just playback silence while TCP waits).

At 2/5/13 04:27 AM, Dean wrote: This means I'm going to have to look into RTP, which I think is used to make sure the packets are ordered correctly at the receiving end, amongst other things.

UDP is typically used for VoIP, among other things, so you should be fine with using that.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2013-02-05 11:56:27 Reply

At 2/5/13 11:19 AM, Wolfos wrote: How long do you guys think a class should be at minimum?

Your classes should only be as long as they're needed to be. In my opinion making generalisations like "classes should be at least x lines" or "functions should be no more than y lines" is kinda silly because there's always exceptions, and trying to "fix" those exceptions to make them conform to a rule for the sake of conforming will just damage the quality of your code.

At 2/5/13 11:19 AM, Wolfos wrote: It takes me 10 lines to implement a scrollbar with my current codebase. Is that worth it's own class?

If it only works by you treating it as an object I'd say keep it as a class.

Wolfos
Wolfos
  • Member since: Jan. 19, 2008
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to Programming Regs Lounge 2013-02-05 15:07:52 Reply

Yeah, it kind of makes sense to just:

Scrollbar scrollbar(100,100);

and spawn a scrollbar just like that.

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2013-02-05 15:53:19 Reply

At 2/5/13 03:07 PM, Wolfos wrote: stuff

Hey wolfos, how's it going? xD

Wolfos
Wolfos
  • Member since: Jan. 19, 2008
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to Programming Regs Lounge 2013-02-05 17:30:27 Reply

At 2/5/13 03:53 PM, kiwi-kiwi wrote:
At 2/5/13 03:07 PM, Wolfos wrote: stuff
Hey wolfos, how's it going? xD

Great. You?

Momo-the-Monkey
Momo-the-Monkey
  • Member since: Oct. 15, 2005
  • Offline.
Forum Stats
Member
Level 45
Musician
Response to Programming Regs Lounge 2013-02-14 23:31:30 Reply

Wander over to Flash forum "Hmmm, slow responses."
Visit General forum. Refresh page and every post has changed. "Ahhh! Back to Programming forum."

Ahh that's better.


Hello, from the past!
[ PHP: Main ]

BBS Signature