Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

152 Neutral

About HelloSkitty

  • Rank
  1. HelloSkitty

    Printf acting weird

    Thanks for all the fast responses!  Fixed it and it works now - I should probably be thankful my compiler/runner is in safe mode :D
  2. HelloSkitty

    Printf acting weird

    I am trying to debug a program in order to find the cause of a segmentation fault.  So I commented all of the code and slowly uncommented from the start to find the location of the segmentation fault.  This was successful and I have discovered the function that is causing it.  Then, I decided to add a printf to the start of that function, and oddly enough nothing printed.  I then added printf to the calling function, and nothing printed there either.  So in the same manner of finding the location of the segmentation fault, I set about finding the place my program stopped printing.  And I did.  It was the line:   retVal->maxSize=10;   And I have no idea why.  All of the relevant code is here:   circular.h typedef struct Quote { unsigned int time; double rate; } quote; typedef struct CBuf { unsigned int maxSize; unsigned int size; unsigned int first; unsigned int last; quote* arrayPointer; } cbuf; cbuf* cbuf_init(); void cbuf_delete(cbuf* cb_ptr); void cbuf_update(cbuf* cb_ptr,unsigned int time,double rate); double cbuf_average(cbuf* cb_ptr); quote* cbuf_start(cbuf* cb_ptr); quote* cbuf_end(cbuf* cb_ptr); void cbuf_dump(cbuf* cb_ptr); void cbuf_stats(cbuf* cb_ptr);   circular.c #include "circular.h" #include <stdlib.h> #include <stdio.h> cbuf* cbuf_init() { printf("cbufinit\n"); cbuf* retVal; printf("makingretval\n"); printf("%d\n",(*retVal).maxSize); retVal->maxSize=10; printf("9\n"); retVal->size=0; retVal->first=0; retVal->last=0; quote* quotes=malloc(10*sizeof(quote)); retVal->arrayPointer=quotes; return retVal; } // More code below, but this is the only function that is called // makingretval and -72537468 are printed // 9 is not printed   main6a.c #include <stdio.h> #include <stdlib.h> #include "circular.h" int main() { printf("start\n"); printf("1\n"); cbuf *cb1 ; printf("2\n"); cb1 = cbuf_init() ; printf("3\n"); return 0 ; } // 1 and 2 are printed // 3 is not printed     Everything compiles fine, it is simply that printf does not seem to work at all following the retVal->maxSize=10; line.  In a separate run, I added a getchar call after the printf("3\n") which ran fine.  So the program is still getting to the end with no issue.  I just want to know why it is not printing.   Thanks!
  3. HelloSkitty

    Your Worst "Gotchas" ever in programming

    I once had a school project in java dealing with Strings. Well, what better name for a class dealing with a project centered on Strings than String.java? Then when I tried to use methods of java's String class, the methods weren't there (because the compiler was trying to find the methods in my String class). Took two days to figure it out and it was only because I tried to rewrite the thing with more descriptive class and variable names after being inspired by a daily WTF article.
  4. HelloSkitty

    AES Encrypting and Decrypting

    The problem with a byte array is that I am trying to get two programs to communicate over a socket and I'm using a BufferedReader and BufferedWriter which communicate mostly with Strings. I notice there's a single read method that returns an int between 0 and 65536, which would be two bytes, so should I just be using that method and using the values of n%256 and n/256 to extract the bytes?
  5. I am trying to use the javax.crypto java library to encrypt and decrypt strings of text using the Advanced Encryption Standard. Unfortunately, I seem to be doing something very wrong, as I get the error "Given Final Block Not Properly Padded". And I do not know what this means. A code snippet is here: public String encode(String s) { String encodingKey="sixteencharacter"; String result="DEFAULT STRING TO SEND"; try {SecretKeySpec key = new SecretKeySpec(encodingKey.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE"); cipher.init(Cipher.ENCRYPT_MODE, key); result = new String(cipher.doFinal(s.getBytes())); } catch (Exception e) {System.out.println("ERROR WHILE ENCODING");} return result; } public String decode(String s) { String decodingKey="sixteencharacter"; String result="DEFAULT STRING TO SEND"; try {SecretKeySpec key = new SecretKeySpec(decodingKey.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE"); cipher.init(Cipher.DECRYPT_MODE, key); result = new String(cipher.doFinal(s.getBytes())); } catch (Exception e) {System.out.println("ERROR WHILE DECODING");e.printStackTrace();} return result; } And when I try to call a line like, say, String s=decode(encode("WELCOME:BOB")); I get the error. Other Strings I have tried that do not work are "WELCOME:ALICE", "WELCOME:NEMO". However, I have also found strings that do decode properly, such as "WELCOME:HI", "WELCOME:DAVE", "WELCOME:SQUARE", "WELCOME:NOBODY". I do not know why some strings work and some don't. I modeled the decoding method to mirror the encoding, so I am at a loss to explain any of these results. Any help is appreciated!
  6. I'm currently have a Server program running with multiple sockets, which I'm testing with netcat. So I run the server, which makes a bunch of client handlers -- one for each client, and associates a socket with each. I have an infinite while loop running through and updating these handlers, and in the update code, I have this: if (!socket.isConnected()) { System.out.println("CONNECTION DROPPED"); server.handlers.remove(this); } if (socket.isInputShutdown()) { System.out.println("INPUT SHUTDOWN"); } if (socket.isOutputShutdown()) { System.out.println("OUTPUT SHUTDOWN"); } if (!socket.isBound()) { System.out.println("NOT BOUND"); } //4 methods I found in the java doc for the Socket clas So I have 4 if statements that presumably check if a socket is shut down. Unfortunately, when I kill one of my netcat test client instances, none of these if statements return a positive. Am I using these functions wrong, or is there some other function that achieves the purpose I seek? I know that it must be possible to detect a dropped connection, as when I kill the server, all of my netcat clients know this and cease their function. I just can't seem to detect when a Client dies. For those who aren't familiar with netcat, all it is is a simple program that can send messages across ports (at least, I think that's all it is).
  7. HelloSkitty

    Your first game idea - What happened to it?

    Idea: RPG/Strategy/Adventure (Like Legend of Zelda) based on Alchemical Elements How Far: Still Developing Evolving: I first had this idea about 2 years ago. At that time, I had just learned the basics of graphics with java. I got as far as map movement and bullet collision. Then I decided that it was too much work and scraped it, roughly one year ago. Then, about the beginning of this year, I learned new techniques in java that would help me with the project, but didn't want to work with the old code, so rewrote from scratch. I altered the part about Alchemical Elements to instead be colors, and decided to shape the world as a fractal. I've also recruited a friend to help the project along. Lessons: 1. Don't abandon your ideas. Give them the respect they deserve, and while at first the idea my not seem like much, you can mold it on the meta-physical anvil to always become better. 2. Get people interested in your project, because if it's a big project and nobody knows about it, you might spontaneously forget about it. 3. Designing can be just as fun as playing. 4. Do not focus on only one project if you burn out easily. If you alternate between different projects, you will tire less easily, especially if they are different types of games. Its like crop rotations to preserve soil nutrients. 5. If you haven't fully designed the game, code from bottom up to leave flexibility. 6. if you have fully designed the game, code from top down so you know how far you are to completion. 7. Coding a game is not as easy as closing your eyes and seeing it. How it Would Be Now: It is now. And Ashaman73, you just inspired me to follow my Lesson #1 by 20% more then before
  8. HelloSkitty

    Kill The NPC

    So it is probably not a good idea to let a player kill an "essential" NPC without informing them that they just reduced their chance of winning to 0. Now, one last question -- From a player's perspective (as opposed to a developer's), is there anything that can be gained from an unkillable NPC? Or should all NPCs be attackable? Of course, some, like your mentor at the beginning of the game, will be too strong to kill. The only reason I can think of to disable attacking NPCs is to prevent accidental attacks, which is why some games have an option to turn Friendly Fire off. But anything else?
  9. So I looked for ways to make individual pixels transparent rather than an entire window, and found this: jPanel1 = new javax.swing.JPanel() { protected void paintComponent(Graphics g) { if (g instanceof Graphics2D) { final int R = 240; final int G = 240; final int B = 240; Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 0), getWidth(), getHeight(), new Color(R, G, B, 255), true); Graphics2D g2d = (Graphics2D)g; g2d.setPaint(p); g2d.fillRect(0, 0, getWidth(), getHeight()); } else { super.paintComponent(g); } } } from here: http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/#Enabling-Per-Pixel-Translucency Now the problem I have is that this is drawing the transparency directly to the JFrame. This is a problem when using this with a game, because there are serious flickering issues. I tried double-buffering the transparency in the image I loop-draw, but it was no avail. public void interpolatedDensity(int i,int j) { //stuff return 150<<24 | rCol<<16 | gCol<<8 | bCol; //Partial transparency } public void paint() { for (int i=0;i<800;i++) { for (int j=0;j<800;j++) { int c=field.interpolatedDensity(i,j); dbPlasma.setElem(i+j*800,c); //The DataBuffer for BetterDoubleBuffer } } //Stuff g.drawImage(betterDoubleBuffer,0,0,null); } //Transparency ignored when painting Is there a way around this, or is there no way for a java-based (action, at least 10 FPS) game to make use of window transparency?
  10. HelloSkitty

    Kill The NPC

    Thanks for examples! However, I understand that most of these (besides Skyrim) are mmorpgs. So how does each deal with the killing of an NPC who would give a plot-important quest? Or is the main quest given right from the start? Suppose NPC Bob were going to tell me that to kill the Spider Monster I first need to go and gather Red Fruit from the Underground City of Nephilim and I killed Bob before he told me this. Would Bob respawn for me to get a second chance at getting the information, or would I have to travel until I find someone else who also knows how to kill the Spider Monster? Or would the tooltip tell me I need this red fruit while I am trying to kill the spider without it? More generally, what happens in those games when you kill an NPC who would have otherwise given you crucial information towards achieving an important goal?
  11. HelloSkitty

    Kill The NPC

    For some reason.... you rarely see the ability to kill an NPC in a game (I've yet to experience even one). Now, NPC is a rather vague term that seems to include teammates in team-based battle games (like Halo coop mode) For the sake of this, I am limiting NPC to only the characters in an rpg game that give quests or exchange helpful dialogue. And a bunch of games have ways to deal with players trying to attack an NPC. Dragon Ball Z GBA 2 - The A for melee attack is also the "talk to them" button. Energy blasts pass right through NPCs. Runescape - There is simply no option. Pokemon: You can only call out pokemon in battle mode where there are no NPCs to be found. Sonic DX: The NPCs are just walls that talk. Spins go around them, homing attack doesn't target them. Now part of this thought came from a video about "If Pokemon Were Real" where there is a weak electric pokemon fighting a strong cocoon, and the protagonist realizes, why don't I attack the actual enemy instead of his pokemon?" Is there a reason many games are so adamant about not being able to kill the NPCs (excluding killing them as part of the story as I hear how it is on God of War. I mean to deviate from the obvious plot by killing the ones who are supposed to give you the quests) Are most devs too lazy to accommodate for story impacts, is a plotline of that degree of nonlinearity just not realistic, or what? The closest that any game has come to killing NPCs as far as I know is Pokemon Mystery Dungeon Explorers of Time/Darkness where you can try to kill a shopkeeper, but the shopkeeper turns out to be almost impossible to kill (if you can kill him, you may take all items from the shop). But outside of dungeons, you can't attack anyone. Are there any better examples, or is killing NPCs just taboo?
  12. HelloSkitty

    How would you define games?

    A game is a fun way to test one's skill at something. I wouldn't say that a game needs to have a victory/loss condition, because there are many persistant games out there where there is no death and no limit to success. It does not need to involve decision making (card game: war) (in this case it tests one's skill at luck, which doesn't make a whole lot of sense, but I'm using skill loosely here) A game could just be two people competing to make good art. Totally subjective, no winner, no loser. Also doesn't need to involve other people (card game: solitaire) A game is a fun way to test one's skill at something. But then, a game isn't necessarily fun. My brother had tried to get me to join a couple of games, but I did not find them fun. They are games, nonetheless. So a game is just a way to test an aspect of someone? This would include school tests. I guess we could say school tests are games that are just not fun. But that's a super-broad definition of game... anything would be a game then.
  13. HelloSkitty


    So I made a posting in the writing section many months ago about a non-humanoid protagonist, and decided to go through with developing a game with a dot being the protagonist, in the world of the Sierpinski Triangle. And now that summer is beginning and this is my transition year between high school and college, I figure I should have ample time to make serious headway. My original idea was to incorporate the visual effects of Plasma Pong with the "Infinite World" level design of Bubble Tanks, and the "Rainbow Power" idea from Gemcraft. The visuals are nearing completion at this point, and this so far, is how I've handled both the development and advertising: [media][/media] [media][/media] [media][/media] The first video has correct shading, the second has correct physics, and the third separates red, green, and blue. There is user control, which I disabled when making videos. Songs were attached to the videos as a means of advertising (that way if someone searches the song on youtube, there's a chance that they'll find these videos and be interested) They also work as source control documentation (my plan is that every week, I run the program thus far, make a video, zip the code files, and archive so if I botch something up, I'd only lose at most a week of work) -- Now, I have a vague idea on how level design will work, but I'd like a bit of criticism on the mechanics that I plan on adding. The game will begin with a personality test to determine personality based on the MBTI. Based on personality, the player will be given a color. The player begins at the center triangle of the Sierpinski Fractal, and meets Reena Bowe (pun on Rainbow), who act as the mentor and tells the player, "Welcome to Sirenia ... left click to fire a steam of plasma ... move with arrows ... you first quest is to ..." From this center triangle, there are three doors, one on each side. The player may go through these doors to enter other triangles. A triangle may be a: *Town *Puzzle Room *Wilderness Towns have NPC that will trade (no idea what kinds of items there'll be) and give quests Puzzle Rooms require you to solve a puzzle before the 3 side doors unlock. Wilderness contains enemies. Enemy dots are of some predetermined color, and to neutralize them, the player must either shoot them with particle, or dissolve them in plasma of the same color. If enemies find themselves surrounded by plasma of a complimentary color (shooting red plasma at a cyan enemy), they will become stronger due to contrast. Higher levels allow the player to increase plasma stream velocity, have more control over plasma color, employ shields that deflect dangerous plasma that may dissolve the player, and see more doors. Initially, at level 1, you will only be able to see the 3 doors leading out of the center triangle. Each door on the side connects to an entrance to another triangle at its corner. The 3 subtriangles will appear to have no doors. At level 2, every triangle appears to triple in size (but in reality the player is shrinking). The center room will have 9 doors, and each subtriangle, 3. The sub-sub-triangles will appear to have none. The player's level dictates the level to which the Sierpinski Triangle may be traversed. Higher levels allow access to smaller triangles. That is the sum of the action/adventure mechanics. In event that I should name each triangle though, are there any algorithms that allow the generation of a random pronounceable word (something a just a little better than "pick a random number, than pick that many random letters and concatenate)? -- Additionally, I also wish to implement procedurally designed music. This http://www.ichingplu...usic-Files.html gave me a few ideas to use with java's MidiSythesizer, but I'm wondering if there are any general algorithms for making "nice-sounding music" (all my searches of music theory have turned up is how to read music sheets) -- Since this covers a bunch of different topics, I decided rather than split it up into 3 different posts into 3 different forums, I'd just put it in the general game design forum. What I'm looking for in order of importance to me: 1. Is it feasible to create this kind of game, or should I cut back on some things? 2. Are these desirable mechanics that would appeal to a number of people? 3. Is the bottom-up approach to development the best way? 4. What are the risks of not using a formal source control and instead just archiving the code after each week? 5. How does procedural music work? 6. Should there be a personality test at the beginning, or should the player be free to pick a favorite color? 7. How does procedural word generation work? I don't expect all 7 to be answered, but any insights or pointers or advice would be greatly appreciated! Thanks!
  14. HelloSkitty

    Theory: players don't know what they want

    I've seen this happen to many a game: My most notorious example is runescape. I remember maybe 5 or 6 (or 8, after this long, I lose track) years ago I started playing this game, and I immediately found myself lost. And I said to myself "I hate being lost". But I played on for a few months because that's what my friends did. Then, I learned there was a map of the world. And I wasn't lost anymore, and I always knew where I was. Well, that took away the feeling of discovering a place I've never been before. I couldn't go anywhere new, because there was always a map. But at least I could experience the boredom of moving between cities. Or not. After two years, I made use of teleportation. But at least I could still experience the troubles of walking to places between cities, because teleportation doesn't go there. Nope, fairy rings and boats. Everywhere is easily accessible. Did the game just disintegrate into teleport here, kill stuff, teleport there, kill stuff, teleport yonder, sell items, teleport, buy weapons, teleport, kill, teleport do this, teleport, teleport, teleport... They even started putting in bonus experience weekends where people could reach level 99 with half as much toil. One can imagine how those who reached level 99 before this "feature" must feel about the new, less disciplined people who think reaching level 99 is a trifle. "Why, when I was your age...." What many people don't get is that more feeling goes into planning a vacation than being at the vacation. http://www.cracked.c...ness-wrong.html Quoth: But get this -- when doing a study of vacationers[color=#000000][font=Georgia, serif], the happiest people were the ones [/font]in the weeks leading up to a vacation[color=#000000][font=Georgia, serif]. It was all about anticipation. [/font]Again[color=#000000][font=Georgia, serif], it looks like our brain rewards us more for working toward a goal than for actually arriving there.[/font] The Law of Large Numbers plays an important role here. Not the statistics version. The pinball version. "Oh, if I get more points, that obviously means I'm a better player!" Pinball makers caught wind of people who think like that, which is almost everyone, and started giving 100 points for hitting a bell instead of 10. No, 1000. 10,000! A million! 9001! People cheer at the thought of getting more points, but later regret that most of the screen is wasted, covered by the 0's in the lower decimal places. There is a symbolic meaning to that, somewhere, hello Gatsby. Economic inflation is related to this. Going back to that article, our brain rewards us for pursuing rather than arriving. When people request and demand "convenience features", that is part of the pursual of the goal. But once that feature is put into place, there is much less pursuing and more arriving, which makes things less fun in the long run.
  15. HelloSkitty

    WAV Files and Sound Creation/Recording

    Alright, thanks! I was able to get my program running with a sine wave of sound. (And then I made white noise, and didn't hear anything, to my surprise)
  • 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!