• Content count

  • Joined

  • Last visited

Community Reputation

104 Neutral

About deepDweller

  • Rank
  1. I'll admit that I'm not quite sure what a quadtree is, but I think what Kyan is getting at is that if you have a bunch of objects that don't actively move around the screen (such as doors as were his example), then you may be able to have those objects themselves process, in their own code, the camera offset and apply it to their draw position, saving you the trouble of storing them in a container and looping through them whenever the big camera shift function is called.
  2. Java 2d game engine

    Recently I've been learning some Java in order to make some simple 2d games for the android platform, but this is my first time hearing about slick2d. It seems very nifty, but a google search seems to come up with people having problems getting it to work on the android. Oh well.
  3. [quote name='return0' timestamp='1333413943' post='4927721'] An alternative to a cdn? A crappy one would be renting a machine in the cloud (or in your bedroom), getting its address and serving stuff off there... A server stack is your back end technology for your web game. If it was a facebook style zynga affair, probably a standard http lamp stack would do? Not sure about as3 - generally for getting static data do an http get to your content store, for updating data do an http post to your web server. [/quote] Awesome! [quote name='wolfscaptain' timestamp='1333423955' post='4927757'] Disregarding where the files originally came from, store them in the local cache with HTML5/ECMAScript 5, or at least encourage the broswer to do it with HTTP headers. That removes both loading times and strain on the web server. [/quote] Is that possible? Do you think it would be considered dishonest to store game-related files on a player's computer through the use of browser scripts?
  4. [quote name='return0' timestamp='1333324859' post='4927317'] Don't serve static data through your web server stack, serve it from a static store (preferably a cdn). [/quote] I looked up the acronym and I assume you're referring to this? Are there other alternatives to this? What would be another example of a "static store"? I suppose one of my problems is that I don't really know how a "web server stack" works. Would firing a URLRequest from a flash player be the same as requesting a direct file download from the website?
  5. Hi gamedev. I want to clarify something here before I attempt to implement it. I'm making a flash RPG, and in order to avoid long loading times, I want to make use of the LoadExternal and URLRequest classes provided with the Flex API in order to dynamically load music and level layouts from an outside source, rather than embedding them in the .swf file itself. With this in mind, can anyone tell me the downsides of storing the required music/level files on a web server, and having the swf dynamically load them via URL? Will this cause strain on the web server, considering there will, ideally, be many people playing the game at the same time? Thanks in advance!
  6. Holy crap, thank you Wooh and alvaro for your comments! I looked into the subject of memory corruption, and read through the Valgrind website. It got me thinking - I went back to my program and combed through some of my older code with the search function, and it turns out, at some point I tried to incorrectly delete a stringstream object that was initialized early on in the program. Got rid of that line and everything is now working perfectly! I'm so glad I made this thread, even though I probably look pretty dumb right now. [quote]even throwing out a little comment could potentially give me an idea to help solve the problem. [/quote] looks like I was right about that, at least
  7. Hi, my name is james and I usually only come here in moments of dire need, as I like to think of myself being perfectly capable of solving most programming problems on my own with a little google-fu and common sense. However, for the past two weeks, the project I've been tirelessly working on for the past five months has been put on hold because of a mind-boggling problem that has completely shut down my program and eluded any of my attempted fixes. The problem takes place when the program calls a login validation function that has been working perfectly fine for about three months: [code]int validateLogin(string inputName, string inputPass, list<USER> &userList)[/code] Now I know that people are going to tell me that if my function has been working for three months and only recently started malfunctioning without any changes, then it must mean that the problem lies elsewhere in my program. I know that's probably the case, and I don't expect you guys to be able to fix my problem just by looking at this one function itself. I came here because I'm completely at a loss for what to even look for. My program is a shredded, bloody mess - I've ripped out and reverted nearly two months of progress trying to find anything that could have possibly been causing the crash, to no avail. I'm at my wits end, and all enthusiasm for this project is dwindling. My last hope is that someone reading this post will give me some sort of hint as to what other parts of my program I can eradicate to find the source of the problem. Anyway - the problem. The purpose of this validateLogin function is to check a text file where all the account information is held, and match it up with the inputName and inputPass arguments provided from the user, and then, if the name and password match up with a user described in the text file, the function will create a USER object with that information and add it to the userList. The userList (an std::list<USER> container) is passed by reference to this function so other classes are able to access it after it adds the new USER object. That's where the problem comes in. [b]Whenever the validateLogin function declares an ifstream to read from the file, the list<USER> userList becomes unaccessable from any other part of the program without causing a crash.[/b] I know the ifstream is causing the problem because I've tested the function with EVERYTHING commented out except for this line: [code]int validateLogin(string inputName, string inputPass, list<USER> &userList) { ifstream fromFile; };[/code] When trying to cout the userList.size() after calling this function, the program still crashes, a windows box popping up to alert me that the program needs to close. Before I came here I tried making a new piece of code just to test lists and ifstreams working together, to make sure I hadn't missed anything obvious, and to see if a simplified replication of my original code would work without any crashing: [code]#include <iostream> #include <list> #include <fstream> using namespace std; class Foo { public: int number; Foo() { number = 1; }; }; class Derp { public: int number; Derp() { number = 2; }; int performActionsWithList(list<Foo> &fooList) { ifstream fromFile("db_accounts.txt", ifstream::in); fromFile.close(); return 1; }; void passListHere(list<Foo> &fooList) { int hello = performActionsWithList(fooList); cout << fooList.size() << endl; }; }; int main() { Foo fooOne; Foo fooTwo; Derp derp; list<Foo> fooList; fooList.push_back(fooOne); fooList.push_back(fooTwo); derp.passListHere(fooList); return 0; };[/code] It works fine, outputting the number 2. I know this isn't very much information about my code itself, so it will probably be difficult to give me any good advice on what to do next. I'm hoping that someone just has some kind of general knowledge about ifstreams and lists that could point me in the right direction. ie: have you experienced ifstreams crashing a program before? Could there be something wrong with the text file? Is the std::list the problem? Could the problem be something completely unrelated to both ifstreams and lists? Thanks for reading my long post - any help is appreciated; even throwing out a little comment could potentially give me an idea to help solve the problem. -james
  8. Haha, I knew it would be something painfully simple! I stuck thingVector.reserve(10) in there and everything worked perfectly. However, your suggestion is appreciated - I read all about deques and lists after seeing your post, and have altered my original program accordingly so that this kind of thing doesn't happen again. Thanks for your help. As for smart pointers - I've been hearing a lot of praise about these, but I never even knew they existed. Are they part of the STL? I heard about there being some kind of boost container for smart pointers, but I'm not sure if I'm thinking of the same thing.
  9. Hi I've been working on a project and have been making a lot of progress, but for the past few days I've been stuck and haven't been able to find a solution. It seems like I'm lacking understanding of how vectors of pointers to objects work, because my program crashes whenever I try to push back new pointers to the vector. I'll illustrate my problem with this example code: [code]#include <iostream> #include <vector> #include <string> using namespace std; class Thing { public: string m_name; Thing(string name) {m_name = name;}; }; class GroupOfThings { public: vector<Thing*> mp_thingVector; string pointerNames(); }; //pointerNames(): Returns an easy to read list of the names of elements pointed to in the mp_thingVector. string GroupOfThings::pointerNames() { string newString; vector<Thing*>::iterator itr = mp_thingVector.begin(); while ( itr != mp_thingVector.end() ) { newString += ( (*itr)->m_name + "\n" ); ++itr; }; return newString; }; int main() { vector<Thing> thingVector; GroupOfThings newGroup; string line; getline(cin,line); while (line != "EXIT") { Thing newThing(line); thingVector.push_back(newThing); newGroup.mp_thingVector.push_back( &thingVector.back() ); cout << "Element names stored in thingVector: " << endl; for (int b = 0; b < thingVector.size(); b++) { cout << thingVector[b].m_name << endl; }; cout << endl; //Outputs the elements in the newGroup.mp_thingVector cout << "Element names stored in newGroup.mp_thingVector: " << endl; cout << newGroup.pointerNames(); getline(cin,line); }; return 0; }[/code] What happens: I input one string. A "Thing" object is created with my string as its m_name. The Thing is added to the thingVector that was declared earlier in main(). A pointer to thingVector.back() is added to newGroup.mp_thingVector. The program outputs the m_name of all of thingVector's elements, and the m_name of all the elements referenced in newGroup.mp_thingVector. [b]The important part (I would assume) is that the program works on the first iteration, but crashes on the second.[/b] It correctly outputs the content of both vectors for the first iteration, but during the newGroup.pointerNames function on the second iteration, it crashes. Can anybody get to the bottom of this for me? I've spent days on this and am running low on sanity. Thanks in advance! [i](Quick edit: I suppose it would help clarify things to say that, yes, my intention is to have a vector of pointers that reference objects within another vector. Am I doing it wrong?)[/i]