gamechampionx

Members
  • Content count

    620
  • Joined

  • Last visited

Community Reputation

140 Neutral

About gamechampionx

  • Rank
    Advanced Member
  1. Hi! I just finished up a first release of my first ever roguelike game called "Robot Zombie Ninja Wizard". In this game, you take on the role of a robot, zombie, ninja or wizard, each with their own spells which can be used to traverse and conquer a randomly-generated dungeon. The game gives the player quite a bit of freedom to build their character in different ways, and has a decent selection of equipment and items to find along the way as well as enemies to fight.   The JAR file for running the game can be found here: https://github.com/bprollinson/robotzombieninjawizard   It should be runnable on Java 1.8 or Java 1.9. I'm simply looking for people to try the game out and give feedback. In general, what is a good process for finding beta testers for a game?
  2. pthread Question

    I'm learning how to use pthreads for the first time, trying to use a Round Robin scheduling setup: #include <pthread.h> #include <iostream> using namespace std; void* client(void* ptr) { for(int i = 0; i < 1000000; i++) { cout << "client " << i << endl; } } void* server(void* prt) { for(int i = 0; i < 1000000; i++) { cout << "server " << i << endl; } } int main() { pthread_t client_thread, server_thread; pthread_attr_t client_attr, server_attr; pthread_attr_init(&client_attr); pthread_attr_init(&server_attr); //pthread_attr_setscope(&client_attr, PTHREAD_SCOPE_SYSTEM); //pthread_attr_setscope(&server_attr, PTHREAD_SCOPE_SYSTEM); pthread_attr_setschedpolicy(&client_attr, SCHED_RR); pthread_attr_setschedpolicy(&client_attr, SCHED_RR); pthread_create(&client_thread, &client_attr, &client, 0); pthread_create(&server_thread, &server_attr, &server, 0); pthread_join(client_thread, NULL); pthread_join(server_thread, NULL); cout << "Done" << endl; return 0; } On my computer, the "client" thread runs for 20-30 seconds, followed by the "server" thread. The execution appears to be completely serial in that regard. "Done" is spit out at the end as expected. I'm a little boggled as to why the "server" thread is waiting for the "client" thread to complete. 20 seconds, from my understanding, should be far beyond any time slice. I'm not too concerned with exact equal execution, but I'm concerned about thread starvation. Help is appreciated.
  3. C++ "glint double free or corruption"

    Thanks bud, I'm mostly a Java programmer so I had an incorrect assumption that uninitialized members are set to null. Your suggestion fixed the problem.
  4. C++ "glint double free or corruption"

    I'm getting back into c++ after not using it for a while and I'm running into a strange memory-related error. Code: main.cpp #include &lt;iostream&gt; #include "localdatabase.h" #include "localdatabase.cpp" #include "externalconnectionslist.h" #include "externalconnectionslist.cpp" using namespace std; int main() { LocalDatabaseFactory* f = new LocalDatabaseFactoryImpl(); LocalDatabase* ldb = f-&gt;getInstance(); cout &lt;&lt; ldb &lt;&lt; endl; delete ldb; cout &lt;&lt; f &lt;&lt; endl; delete f; ExternalConnectionsListFactory* fact = new ExternalConnectionsListFactoryImpl(); ExternalConnectionsList* l = fact-&gt;getInstance(); cout &lt;&lt; l &lt;&lt; endl; delete l; cout &lt;&lt; fact &lt;&lt; endl; delete fact; return 0; } localdatabase.h: #ifndef LocalDatabaseHeader #define LocalDatabaseHeader class LocalDatabaseEntry { }; class LocalDatabase { }; class LocalDatabaseFactory { public: virtual LocalDatabase* getInstance() = 0; }; #endif localdatabase.cpp #include "localdatabase.h" #include &lt;iostream&gt; using namespace std; class LocalDatabaseImpl : public LocalDatabase { }; class LocalDatabaseFactoryImpl : public LocalDatabaseFactory { public: LocalDatabase* getInstance(); void barf(); private: LocalDatabase* instance; }; LocalDatabase* LocalDatabaseFactoryImpl::getInstance() { if(instance == 0) instance = new LocalDatabaseImpl(); return instance; } externalconnectionslist.h: #ifndef EXTERNAL_CONNECTIONS #define EXTERNAL_CONNECTIONS class ExternalConnection { public: char* getUserName(); }; class ExternalConnectionsList { public: virtual ExternalConnection* getNameServer() = 0; virtual int getNumPeers() = 0; virtual ExternalConnection* getPeer(int index) = 0; }; class ExternalConnectionsListFactory { public: virtual ExternalConnectionsList* getInstance() = 0; }; #endif externalconnectionlist.cpp #include "externalconnectionslist.h" char* ExternalConnection::getUserName() { return 0; } class ExternalConnectionsListImpl : public ExternalConnectionsList { public: ExternalConnection* getNameServer(); int getNumPeers(); ExternalConnection* getPeer(int index); }; ExternalConnection* ExternalConnectionsListImpl::getNameServer() { return 0; } int ExternalConnectionsListImpl::getNumPeers() { return 0; } ExternalConnection* ExternalConnectionsListImpl::getPeer(int index) { return 0; } class ExternalConnectionsListFactoryImpl : public ExternalConnectionsListFactory { public: ExternalConnectionsList* getInstance(); private: ExternalConnectionsList* instance; }; ExternalConnectionsList* ExternalConnectionsListFactoryImpl::getInstance() { if(instance == 0) instance = new ExternalConnectionsListImpl(); return instance; } This code isn't pretty or particularly well-designed, I'm just testing out some classes as showing. I keep getting the following error: 0x804a018 0x804a008 0x804a018 *** glibc detected *** ./a.out: double free or corruption (fasttop): 0x0804a018 I don't get how I could be double-deleting a pointer as I've already deleted ldb before even declaring l. This completely boggles me. I'm probably doing something really horrible with pointers without realizing it, but this message isn't really helping me much. Is there a way to get more info about these errors? My pointer appears to be on the heap which is where it should be as far as I can understand.
  5. [web] Div Issues

    OK, I figured out how to make the document body extend to the window by using: "border: 0; margin: 0;" on the document body. What I'm still struggling with is vertically resizing divs to fit the entire parent container. From experimenting here: http://www.etherealdivine.com/newsite/simpletest.html, it appears that setting the height of a div within the main body of a page uses the window size, and not the actual contents of the page. More specifically, the page has only three lines of test, so I was expecting 100% height to correspond to about three lines but instead it fills exactly one page. <html> <head> <title>Blah</title> </head> <body style="height: 100%; border: 0; margin: 0;"> <div style="height: 100%"> <div style="float: left; width: 20%; height: 100%; background-color: red;"> test </div> <div style="margin-left: 20%; background-color: green; width: 80%; height:100%"> test2<br> test3<br> test4 </div> </div> </body> </html> Also, I was messing around with the height attribute of the body style and it appears that it also works with respect to the window size and not the contents of the page. Is there a way, without javascript, to work based on content size rather than window size?
  6. [web] Div Issues

    I've been recently trying to brush up on some html and I've been working on a prototype for a site layout. Here's what it looks like so far: [url]http://www.etherealdivine.com/newsite/proto_unvalidated.html[/url]. I do eventually want to get get the menu to fill the same height as the body of the document and vice versa. I've been having a bunch of trouble trying to figure out how to do this. I've tried using CSS to set the height to 100% but from what I've seen, that's all relative to the page size and any container applied to the div (such as another div). Code: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Prototype</title> <style type="text/css"> #title { background-color: yellow; float: left; width: 100%; height: 20%; } #menu { background-color: blue; float: left; width: 20%; } #main { background-color: green; margin-left: 20%; width: 80%; } #pic { background-color: red; float: left; width: 100%; height: 20%; } #contents { background-color: orange; float: left; width: 100%; overflow-y: auto; } #bottom { background-color: green; float: left; width: 100%; } </style> </head> <body style="background-color: black"> <div id="title"> Title <div id="menu"> Menu <div id="main"> <div id="pic"> Cool Picture <div id="contents"> 1111111111111111111 11111111111111111111111111 1111111111111111111111111111 1111111111111111111111111111111 111111111111111111111111 111111111111111111111111111 11111111111111111111111 111111111111111 11111111111111111<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> a<br/> <div id="bottom"> ©Amber & Bren, put contact info here </body> </html> Any tips on getting this to work would be greatly appreciated. Also, when I add the following doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> the behavior changes and the height of the title section is shrunk. [url]http://www.etherealdivine.com/newsite/proto_validated.html[/url] Validation info: [url]http://validator.w3.org/check?uri=http%3A%2F%2Fwww.etherealdivine.com%2Fnewsite%2Fproto_validated.html&charset=(detect+automatically)&doctype=Inline&group=0[/url] Any help on either of these issues would be great help. The last time I tried to align anything in HTML, it was using tables lol. Thanks in advance.
  7. Funky Error

    It was all because of a missing function prototype in the header. Fun times.
  8. Funky Error

    I'm compiling some C++ code and I'm getting the following: /fsys/.software/arch/gcc-3.4.2/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/sparc-sun-solaris2.8/bits/c++config.h:57: error: expected init-declarator before "namespace" /fsys/.software/arch/gcc-3.4.2/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/sparc-sun-solaris2.8/bits/c++config.h:57: error: expected `,' or `;' before "namespace" /fsys/.software/arch/gcc-3.4.2/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/sparc-sun-solaris2.8/bits/c++config.h:61: error: expected namespace-name before ';' token /fsys/.software/arch/gcc-3.4.2/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/../../../../include/c++/3.4.2/sparc-sun-solaris2.8/bits/c++config.h:61: error: `<type error>' is not a namespace I have absolutely no idea what this means. Help appreciated.
  9. Transport Endpoint Not Connected

    Shutdown didn't seem to do the trick. It's failing on the first read. I'm actually using the read method for the time being and the result of something like (val = read(...)) > 0 is false. The error message results from the perror("read").
  10. Transport Endpoint Not Connected

    The server had the accept thing in there and it returns a positive result. For some reason, I just keep getting that error. Might have something to do with the fact that after the write, the client just terminates - not sure if that's an issue.
  11. Transport Endpoint Not Connected

    I'm trying to do a simple socket connection client/server in C and I get this every time I try to do a read. Client: -socket -connect -send Server: -socket -bind -listen -read There's got to be some important step I'm missing or something. Google was not very much help with this error.
  12. I'm wondering if there are any good tutorials about searching through file content. Google was very scarce in info. I'm trying the following: $contents = file_get_contents($path); if(strpos($contents, $string) !== false) { echo "Found!"; } as the general strategy. I know that $path represents a valid HTML file but it just plain doesn't work. I'm having trouble checking the contents read in, though I verified the file lengths to be about right - outputting them is problematic because of javascript contents. Thanks.
  13. [web] PHP Newline Funkyness

    Thanks, that fixed the issue. I guess you only need to learn these things once.
  14. I've got the following code in PHP: $fs = fopen( 'config.txt', 'w' ); fwrite($fs, 'title_style:' . $title_preference . '\r\n'); fwrite($fs, 'main_title:' . $default_title . '\r\n'); fwrite($fs, 'title_font:' . $title_font . '\r\n'); fwrite($fs, 'title_bg_color:' . $title_bg_color . '\r\n'); fwrite($fs, 'title_color:' . $title_color . '\r\n'); fwrite($fs, 'menu_bg_color:' . $menu_bg_color . '\r\n'); fwrite($fs, 'menu_title_color:' . $menu_title_color . '\r\n'); fwrite($fs, 'menu_text_color:' . $menu_text_color . '\r\n'); fwrite($fs, 'menu_title_font:' . $menu_title_font . '\r\n'); fwrite($fs, 'menu_font:' . $menu_font . '\r\n'); fclose($fs); echo($fs = fopen( 'config.txt', 'r' )); while( ! feof( $fs ) ) { $tmp = fgets( $fs ); echo $tmp; } fclose($fs); It writes to a file, and then reads it back in and spits it out to the page. Now, the problem is that the newlines aren't working. I get output like: 3title_style:both\r\nmain_title:Default\r\ntitle_font:Times New Roman\r\ntitle_bg_color:white\r\ntitle_color:black\r\nmenu_bg_color:white\r\nmenu_title_color:black\r\nmenu_text_color:black\r\nmenu_title_font:Times New Roman\r\nmenu_font:Times New Roman\r\n The \r\n's aren't being correctly interpreted. I worked the above code off a tutorial for newlines, and I was pretty sure it would just work. I believe the server is unix-based if that matters. Help is greatly apprecitated.
  15. [web] PHP / Javascript Behaving Weirdly

    Thanks for the tip. Using the default IE behaviour is hell because it loves to tell me that the error is on "line 2, character 93049302349302423043". Viewing the actual generated javascript was invaluable. I'm more of a programmer than a web developer so I'm making all the right mistakes to learn the territory which isn't such a bad thing.