• What Are You Working On? V13
    5,003 replies, posted
[QUOTE=Chandler;25202322]In C, and C++, you can check for NULL by prefixing the ! unary operator. i.e. if(!some_object) { /* some object is null */ } I believe this works in C# as well.[/QUOTE] I think they specifically took that out for some reason.
It's called the null-coalescing operator. [url]http://msdn.microsoft.com/en-us/library/ms173224.aspx[/url]
[QUOTE=Chandler;25202322] I believe this works in C# as well.[/QUOTE] It doesn't, because the unary ! operator is overloadable, it would cause all kinds of confusion.
[QUOTE=CarlBooth;25195781]What do you guys (and gals if there are any) listen to when coding? I'm quite susceptible to getting songs stuck in my head so I generally listen to them on repeat until it's no longer stuck. It seems to help me concentrate.[/QUOTE] I listen to hip hop and producer only tracks, like stuff from RJD2 and MF DOOM. :v:
[img]http://filesmelt.com/dl/deathplotupdate2.png[/img] Better?
[QUOTE=VeryNiceGuy;25203175][/img] Better?[/QUOTE] Looks far better. Also, Transparent PNG exporting :D From this: [media]http://www.youtube.com/watch?v=DKAEamARW-s[/media] To this: [img]http://dl.dropbox.com/u/286964/TuneTiles/PNGExport.png[/img] I think I will work on putting a stack in each bug so they can be programmed. The Piano sound on the AVS-10 is so close to the sound in the original sim tunes in the higher registers :o
[QUOTE=Robert64;25202403]I think they specifically took that out for some reason.[/QUOTE] Yeah, because it's confusing.
[QUOTE=Ortzinator;25202471]It's called the null-coalescing operator. [url]http://msdn.microsoft.com/en-us/library/ms173224.aspx[/url][/QUOTE] Interesting. Python has this as well, but it involves the use of the "or" keyword (stealing a bit from their example) [code]y = x or -1 # y = x, unless x is None, in which case y = -1[/code]
[QUOTE=SamPerson123;25200556]I've been learning Java. Maybe someday I'll build up the motivation to look up how to display things using stuff other than text.[/QUOTE] I was going to suggest an ASCII mandelbrot fad earlier on :tinfoil:
[QUOTE=VeryNiceGuy;25203175][img]http://filesmelt.com/dl/deathplotupdate2.png[/img] Better?[/QUOTE] I think the text needs to be SLIGHTLY brighter, it strains the eye a bit to read it. Other than that, it looks awesome. In other news, I just spent 3 hours battling the dreaded "application configuration is incorrect" message - I tried everything, from changing to static linked runtime libraries and copying dlls everywhere possible. Turns out I accidentally compiled the ogg vorbis lib files in debug mode rather than release mode and was linking debug libs. Oh well, it was time well spent I suppose, now my game engine works on other computers and not just my own :v:
How can I check how many bytes are available on a Datagram Winsock? Is there a better way to check how many commands there are available? Should I check Quake Worlds's source code? I'm basing it off this by the way: [url]http://www.fabiensanglard.net/quakeSource/quakeSourceNetWork.php[/url].
[QUOTE=DevBug;25205243]How can I check how many bytes are available on a Datagram Winsock?[/QUOTE] Do you mean how much data is in a specific received datagram, or the maximum datagram size for WinSock? (which isn't actually determined by WinSock) [QUOTE=DevBug;25205243]Is there a better way to check how many commands there are available?[/QUOTE] ... what exactly do you mean by "commands"?
[QUOTE=Chandler;25203990]Interesting. Python has this as well, but it involves the use of the "or" keyword (stealing a bit from their example) [code]y = x or -1 # y = x, unless x is None, in which case y = -1[/code][/QUOTE] I can't read the original article, but I think that's a whole different subject. [url]http://en.wikipedia.org/wiki/Short-circuit_evaluation[/url]
[QUOTE=jA_cOp;25205526]Do you mean how much data is in a specific received datagram, or the maximum datagram size for WinSock? (which isn't actually determined by WinSock)[/QUOTE] The first. [QUOTE=jA_cOp;25205526]... what exactly do you mean by "commands"?[/QUOTE] A command is command id paired with 256 bytes of data. [code] struct Command { unsigned short ID; unsigned char Data[256]; }; [/code] I just need to get the amount of available bytes from the datagram (how much I can read from the socket).
I am so alone :( skype: high868 steam: high6 Have no friends(that I talk to daily) that know anything about programming *cries*.
I'll talk to you about programming, if you want :3:
Lol why dont we make a skype programing group :P
[QUOTE=Richy19;25207783]Lol why dont we make a skype programing group :P[/QUOTE] How would that work O.o
[QUOTE=efeX;25207920]How would that work O.o[/QUOTE] In skype -Contacts --Create new group -Name Group: Facepunch people -add people from the programming section
[QUOTE=Chandler;25203990]Interesting. Python has this as well, but it involves the use of the "or" keyword (stealing a bit from their example) [code]y = x or -1 # y = x, unless x is None, in which case y = -1[/code][/QUOTE] But isn't that just because null evaluates to false?
[QUOTE=DevBug;25206664] I just need to get the amount of available bytes from the datagram (how much I can read from the socket).[/QUOTE] When you use recv on a UDP socket, a single datagram is taken from the queue and written to your buffer. If the buffer provided is too small, it will fill the buffer and discard the rest of the datagram - recv returns SOCKET_ERROR and WSAGetLastError returns WSAEMSGSIZE (this is WinSock specific behaviour). In case of success, the amount of bytes written is returned from recv (which is the size of the received datagram!). You can't actually check the size of an incoming datagram in the socket model, but you have a few useful alternatives. The best way is to check the application protocol's maximum datagram size and always have that much space available when you call recv. Then if you get a datagram that is too big, you had best ignore it because it's not valid. The other option works if the size of the datagram content is stored somewhere in the beginning of the datagram. You'd then use peek to read up until you have enough to check the size (because peek doesn't remove the datagram from the read queue), then call recv now that you know the required buffer-size. edit: There is a last solution, but it's not as elegant. The maximum size of UDP datagrams is 64kb, so there's nothing stopping you from keeping a buffer of that size around to receive incoming datagrams.
Currently porting my SDL based engine to SFML. It's not going so well. Roadmap: Finish SFML intergration and input. Audio Make Tic Tac Toe. Camera system. Box2d intergration. Python intergration. Gwen, or some other library.
I coded tic-tac-toe in python for my computing class the other day, complete with AI to play against. It's only text based though, I'd love to add a UI and graphics but there's pretty much no libraries available for me to use on the college's network. PyQt is in the start menu but empty and when I try to import it I get 404'd. So meh :/
[QUOTE=Richy19;25207783]Lol why dont we make a skype programing group :P[/QUOTE] Or we use mumble, like normal people.
[QUOTE=layla;25210518]Or we use mumble, like normal people.[/QUOTE] Mumble is shit, the chat makes me want to strangle something.
[QUOTE=high;25210563]Mumble is shit, the chat makes me want to strangle something.[/QUOTE] yeah, criticise the chat function of a voip program
[QUOTE=thelinx;25210597]yeah, criticise the chat function of a voip program[/QUOTE] If people cant chat, they tend to not join.
Here's my Turing machine game I mentioned last page, with 15 levels blatantly copied from Manufactoria. [url]http://anyhub.net/file/turingmachines.7z[/url] Current commands are: [code]Read [colour][/code] If the symbol at the start of the tape matches the one specified, the symbol is read off and the code progresses one line. Otherwise the code jumps to the relevant End command (imagine an if-end combination). [code]End[/code] The end of a read block, see above. [code]Write [colour][/code] Writes a coloured symbol to the end of the tape. [code]Goto [line number][/code] Jumps to the given line. [code]Output[/code] Outputs / Accepts the tape as it is, ending the test. [code]Discard[/code] Discards / Rejects the tape, ending the test. Some levels will want you to either accept or reject a tape based on whether is passes certain requirements, and some will want you to manipulate the tape and output it. You can add commands with the builder or edit the plaintext file in Solutions/. [editline]01:31AM[/editline] If you type the first letter of a colour in the arguments table when a colour is needed, it will autocomplete it when it loses focus. [editline]01:33AM[/editline] It should be pretty easy to add your own levels, just write a class that extends Level that's called Level_# where # is the level number. Then put it in a .cs file in Levels/. Take a look at the other level files for examples.
[QUOTE=jA_cOp;25208925]When you use recv on a UDP socket, a single datagram is taken from the queue and written to your buffer. If the buffer provided is too small, it will fill the buffer and discard the rest of the datagram - recv returns SOCKET_ERROR and WSAGetLastError returns WSAEMSGSIZE (this is WinSock specific behaviour). In case of success, the amount of bytes written is returned from recv (which is the size of the received datagram!). You can't actually check the size of an incoming datagram in the socket model, but you have a few useful alternatives. The best way is to check the application protocol's maximum datagram size and always have that much space available when you call recv. Then if you get a datagram that is too big, you had best ignore it because it's not valid. The other option works if the size of the datagram content is stored somewhere in the beginning of the datagram. You'd then use peek to read up until you have enough to check the size (because peek doesn't remove the datagram from the read queue), then call recv now that you know the required buffer-size. edit: There is a last solution, but it's not as elegant. The maximum size of UDP datagrams is 64kb, so there's nothing stopping you from keeping a buffer of that size around to receive incoming datagrams.[/QUOTE] Thanks for such a detailed reply, I really do appreciate it.
[QUOTE=Robert64;25211016]awesome turing machine[/QUOTE] I can't seem to progress pass level 2, am I missing something? I don't see how to do it without variables. I feel like an idiot.
Sorry, you need to Log In to post a reply to this thread.