Jump to content
  • Advertisement

kodeninja

Member
  • Content Count

    55
  • Joined

  • Last visited

Community Reputation

214 Neutral

About kodeninja

  • Rank
    Member

Personal Information

  • Interests
    DevOps
    Programming
  1. The 360 is a UPnP device. I don't know if it is constantly looking for UPnP devices, but it should send out requests on UDP port 1900 over multicast (not broadcast) via the multicast group 239.255.255.250. The requests are plain text and look kinda like HTTP requests (technically speaking they are HTTPMU, or HTTP over Multicast UDP). According to the UPnP spec they will look sorta like this: M-SEARCH * HTTP/1.1 HOST: 239.255.255.250:1900 MAN: "ssdp:discover" MX: seconds to delay response ST: search target USER-AGENT: OS/version UPnP/1.1 product/version The 360 (if I remember correctly) should identify itself via the USER-AGENT as a XBox. I used to have packet captures, bute I seem to have misplaced them. If you grab a copy of Wireshark (multi platform) you should be able to see them coming from the xbox, and what triggers them. Telling the 360 to look for shared media should do it. I would also expect that when it attempts to connect to xbox live it should send out a request to set up port forwarding with the router. Hope this is helpful, good luck!
  2. kodeninja

    Getting Confused with Functions

    Looks like a typo to me: int myFunc(USHORT x, USHORT y) { if (y = 0) return -1; else return x / y; } Short Version: Change "if (y = 0)" to "if (y == 0)" Long Version: Look closely at the "if (y = 0)" part. You are using a single =, which means assignment, but what you want is ==, which tests equality. In C/C++, 0 translates to false, and any other number translates to true. Additionally, an assignment returns the number assigned, so y = 0, gets translated into 0, which is false, which means "return -1;" will never get executed. [edit]Opps, beaten to it![/edit]
  3. Ah, I see a bit better now. Yeah the code I provided should of made goodToGo() block (wait) until run was all done being called, which would of explained why your render loop would of done that. So by my current understanding you simply want timesUp to toggle back and forth between true and false? ie. on for 10 ms, off for 10 ms, on for 10 ms, etc. ? Going by that assumption, you need a loop of some sort inside your run method. When the thread starts, it calls the run method once. Once the method is completed, the thread done (and I believe, can't be restarted, thought you are free to create a new thread object pointing at your runnable class) Again, going by my assumption (and using your original code), you might want to replace your run method with something like: public void run() { // Keep looping until the thread is stopped // You could also replace this with a variable or a test // that would abort the loop, and finish the thread while (true) { try { // Wait a certain amount of time timerThread.sleep(pause); // Toggle TimesUp timesUp = !timesUp; }catch(InterruptedException e){} } } That would wait for x amount of time, change the boolean to the opposite value (false => true, true => false), then wait x amount of time again, and change it back. Anyway, hopefully I've hit closer this time. :)
  4. I'm not entirely sure what your asking, but here is my assumption: Some Function: TimerThreading tTimer = new TimerThreading("ThreadName", 1000); if(tTimer.goodToGo()){ System.out.print "Timer rings!"; } If that is the case, then the reason that goodToGo is never returning "true" is because when the function is called timesUp is still false. What you need is to cause goodToGo to block the calling thread until the state of timesUp changes. I haven't touched threading in java for a while, but I believe there are two options, either use the synchronized keyword which would look like this: public class TimerThreading implements Runnable{ private Thread timerThread; private long pause = 0; private boolean timesUp = false; public TimerThreading(String threadName, long pauseLength){ timerThread = new Thread(this, threadName); pause = pauseLength; System.out.println(timerThread.getName()); timerThread.start(); } public synchronized void run() { try{ timerThread.sleep(pause); timesUp = true; }catch(InterruptedException e){timesUp = false;} } public synchronized boolean goodToGo(){return timesUp;} } Though it feels a bit hackish to me, it should work. The "proper" way might be to use the wait/notify/notifyAll functions that are provided with every object created in java. There are many tutorials that are written on that subject here, and since I'm a bit hazy myself, I won't go into it. :P Ps. I didn't actually test the code, but that's how I remember it working. :)
  5. kodeninja

    Matchmaking Server through Router

    I think what you are looking for is a NAT punch through. The forum FAQ has some links about it: http://www.gamedev.net/community/forums/showfaq.asp?forum_id=15 Check out questions Q9, and more specifically Q24. However NAT punch through techniques are generally for UDP, and I don't know how well they work (if at all, reliably) under TCP. I suppose an other (more difficult + less reliable ?) option would be to attempt to use UPnP or NAT-PMP to attempt to configure the router dynamically to forward a port without requiring the user to do so manually. (Just remember to ask the user first! :P)
  6. kodeninja

    Basic fps of 6,000

    Just for your own piece of mind, I get ~5000 with 1GB of Ram, an ATI Radeon X850 and the same processor. Also, please realize that FPS isn't the best (read: most obvious) representation of performance as it works on a logarithmic scale. A more natural performance indicator would be the inverse (Seconds per frame, or SPF if you will), where you measure the amount of time that a frame takes to render. This works out to 0.0002s on my computer and 0.00016s on yours. Even though FPS differs by 1000, in reality it is only a difference of 0.4 milliseconds. And just for reference a FPS of 60, means it would take ~16ms to render. As for your CPU usage, that is normal for a dual core CPU. Your program is running code on only one of your 2 CPUs. As mentioned in the above post, you need to split your game loop into multiple threads. I'd suggest doing some reading on threading if your are not already familiar with it, and then a quick search on these forums or gamasutra.com will return papers and articles people have written on multi-threaded engines. Specially with the advent of the next gen consoles which sport multiple cores. This page contains some of said articles: http://www.gamasutra.com/php-bin/article_display.php?category=7
  7. kodeninja

    Clearscreen problem in SDL

    Try something like this: screen=SDL_SetVideoMode(640,480,32,SDL_HWSURFACE|SDL_DOUBLEBUF); if ( screen == NULL ) { printf("Unable to set 640x480 video: %s\n", SDL_GetError()); exit(1); } palette = screen->format; The screen var need to be set by SDL_SetVideoMode before you can access it, also as far as I know C/C++ does not allow code outside of functions/procedures. Of course another alternative would be instead of: SDL_FillRect(screen, NULL, SDL_MapRGB(palette, 0, 0, 0)); try SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); (and just get rid of the palette var all together) Either of the two should work...
  8. kodeninja

    Probobly something simple? Perspective 3d

    Also make sure your using something like gluPerspective() or glFrustum() to setup the viewport rather then glOrtho glOrtho will not render with perspective, its mostly used in stuff like CAD programs for example where you really don't want perspective.
  9. kodeninja

    How do you use transparency in OPENGL

    You need to have enabled blending for the alpha channel (your 0.95f value) to be used. Take a look at some of Nehe's tutorials ( http://nehe.gamedev.net ) Mainly tutorials: 8 - http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08 19 - http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=19 20 - http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=20 Or try looking up glEnable(GL_BLEND) and glBlendFunc(); Note when GL_BLEND is enabled you must also disable GL_DEPTH_TEST. And finally proper rendering of blended areas should always be rendered after the solid object (no transparencies) and should be sorted from back (rendered first) to front (rendered last) since blending uses what is allready rendered on the screen. And don't worry its not as hard as it sounds :P
  10. kodeninja

    Something simple (killing a terminal)

    I think you may be slightly confused. Usually when you start up a *nix machine and enter the first console, the others are started automatically. All Alt-Ctrl-Shift-Fn (Or variation of such) does is switch between the other consoles that are allready running rather then creating a new one. Now if you wish to actually have less consoles starting up and get rid of them completely, (carefully!) edit your inittab file and look for the consoles section. Mine looks like this:# TERMINALS c1:12345:respawn:/sbin/agetty 38400 tty1 linux c2:2345:respawn:/sbin/agetty 38400 tty2 linux c3:2345:respawn:/sbin/agetty 38400 tty3 linux c4:2345:respawn:/sbin/agetty 38400 tty4 linux c5:2345:respawn:/sbin/agetty 38400 tty5 linux c6:2345:respawn:/sbin/agetty 38400 tty6 linux If i wanted to get rid of the last one i would simply comment it out, for example:# TERMINALS c1:12345:respawn:/sbin/agetty 38400 tty1 linux c2:2345:respawn:/sbin/agetty 38400 tty2 linux c3:2345:respawn:/sbin/agetty 38400 tty3 linux c4:2345:respawn:/sbin/agetty 38400 tty4 linux c5:2345:respawn:/sbin/agetty 38400 tty5 linux #c6:2345:respawn:/sbin/agetty 38400 tty6 linux I'm not too familar with the formatting of inittab, but i do know the second column of numbers (i.e 12345) is which run levels these consoles should spawn in. So in the first example, only the first console would be active on the first run level, while on run levels 2-5, all of them would be active. Also note I'm running a Gentoo machine so my inittab prolly looks slightly different then say a RedHat machine. I hope this answers your question.
  11. kodeninja

    Copywrite

    While I'm not a fan of this kinda thing my self, One solution is to have the game talk to a webserver ( a php or cgi webpage for example) when they enter the serial number. Get the game to send the serial number and some sorta machine generated key (for example the serial number of the harddrive) to the site and the site logs them. If someone else trys to register with the same serial but a different machine generated key, then it stops them from playing the game and askes them politely to purchase a key. Also if the serial key check is done server side then it would be much harder for someone to create their own key generator. Everyone pretty much has some connection to the internet, so it shouldn't be that limiting. Again, no matter what the protection placed on a game there will be a way around it, therefore pretty much making any copyright protection useless in the first place. But for a highschool setting, I'm not sure you would have to worry too much, unless your serial keys really are easy to guess I suppose.
  12. kodeninja

    IPv6 Tunnel Sit0

    I don't know if you got a reply yet, but as far as I know that tunnel is created by a kernel option under the IPv6 configuration. I think it is there simply because there is not widespread IPv6 network. The internet is still pretty much IPv4. In order to connect to IPv6 servers and the such on the internet you need to tunnel your IPv6 connection over an IPv4 to an IPv6 tunnel provider. sit0 is the default name for the tunnel. As a side note a tunnel is basically a connection inside a connection. In this case a IPv6 over IPv4 tunnel is a "normal" IPv4 connection but the packets actually contain the IPv6 packet layer and up. I can't say I'm an expert, but that is my understanding of it. Its pretty harmless as it requires you to actively setup the tunnel.
  13. kodeninja

    [web] SQL - COUNT() Help

    I may be misunderstanding the problem a little, but couldn't you just use "AS"? For example: SELECT COUNT(*) AS Group_Count FROM table_1 WHERE Group = 'A' Creates a column called Group_Count which you can query from the result. You can replace Group_Count with anything you want as long as is valid name (ie. if it was an actual column). [EDIT] Sorry, I re-read it and realized I did misunderstand. evolutional is correct you need to use a GROUP BY directive. for example (mixed with what I said above): SELECT Group, COUNT(*) AS GroupCnt FROM table_1 GROUP BY Group; will return +-------+----------+ | Group | GroupCnt | +-------+----------+ | A | 2 | | B | 2 | +-------+----------+ By the way, I'm surprised you have a column called "Group", I mean if your careful then no problem, but i could see that causing some odd bugs later on :P [/EDIT] [Edited by - kodeninja on October 24, 2005 11:28:55 AM]
  14. kodeninja

    Help with my mmorpg

    As an unrelated note, when taking form input and throwing it into a database it is suggested that you use the mysql_real_escape_string() function. This function removes anything dangerious that might be used to exploit your script. More specifically the attack is called a SQL code injection or something similar. Look up the php page on the function here: http://www.php.net/manual/en/function.mysql-real-escape-string.php
  15. kodeninja

    fdisk problems

    To be honest, I wouldn't expect the state of your harddrives to crash the XP setup cd. Being a laptop, it must have a vendor recovery CD, are you using that or a generic windows XP cd? You may have some different hardward that the normal XP cd does not support which means you'll HAVE to use the recovery cds, but those CDs should take care of the partitions anyway (depending on how they were made) But failing that you could just use the fdisk on one of the linux distributions that are on UBCD ( link in my first post )
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!