• Content count

  • Joined

  • Last visited

Community Reputation

141 Neutral

About Exessuz

  • Rank
  1. Using tiles for more than just maps?

    its not a good idea to keep a copy of the sprite that each tile represent instead you want to keep just a index of the tiles, what you should do its create a class that works like an atlas and load all the sprites once so you keep just 1 copy of the img, also its not a good idea to test collision against all the currents tiles in the map. for example if you are going to make the map SIZEX and SIZEY and lets say that you have N tiles images stored in an class call obj. the class obj could load all the imgs and keep them in a vector or an array for example. vector<obj> images; the map is an array of for example short map[SIZEX*SIZEY]; each slot of the array will represent an index to the atlas images array, lets say that the first tile is grass ID 0 second dirt ID 1 and stone ID 2 the map should be {0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,2,2,2,1,1,1,0,0... at the moment of rendering the map you will just get the current index in the map and get the image from the atlas with that index. regarding collision as a said not a good idea to test all the map read this topic, i alrdy posted something related to collision http://www.gamedev.net/topic/630073-map-coordinates/
  2. Smooth player movements?

    yes you can animate a sprite and interpolate each frame as an animation, and move using delta time. this link is for c++ but you can get the idea http://www.programmersheaven.com/2/time-fps ej currentpos += dir*deltatime;
  3. Making Chunks load?

    http://vterrain.org/LOD/Implementations/ this site has many implementations of LODs algorithms
  4. try something like this, havent t [CODE] std::vector<int> somevalues; std::vector<int> somevaluesTocheck; bool status = false; for(int i = 0 ; i < (int)somevaluesTocheck.size() ; i++){ status = false; for(int j = 0; j < (int)somevalues.size(); j++){ if(somevaluesTocheck[i] == somevalues[j]){ status = true; } } if(!status){ somevaluesTocheck.erase(somevaluesTocheck.begin() + i); } } [/CODE]
  5. Raycasting

    I think you should try with ray / plane collision , for example an Axis Aligned box or a OOB the idea is to cast a ray from the eye or from a click point and check if the ray intersect the plane a ray is defined by P= Ro + (Rd*t) Ro = camera eye for example Rd = ray dir; t = distance or time and a plane (P - Po). n = 0 n = plane normal (Ro + Rd.t - Po).n = 0 Rd.t.n + (Ro - Po).n = 0 t = (Po - Ro)n / Rd.n If the line starts outside the plane and is parallel to the plane, there is no intersection. In this case, the above denominator will be zero and the numerator will be non-zero. If the line starts inside the plane and is parallel to the plane, the line intersects the plane everywhere. In this case, both the numerator and denominator above will be zero. In all other cases, the line intersects the plane once and t represents the intersection as the distance along the line from Ro
  6. c++ file reading

    try with something like this. a 3.5 3.5 yay_some_text a 3.2 4.5 yay_some_more_text [CODE] ifstream f; f.open(file); char dat[256]; for(;;){ if(!f){ break } f >> dat; if(strcmp(dat,"a") == 0){ float x, y; char txt[256]; f >> x >> y >> txt; } } [/CODE]
  7. Map Coordinates

    if you want to make a 10 x 10 map , lets say that each tile is 32 x 32 px i used to make a linear array holding all the tile ids int width = 32; short map[100]; -> 10x10 supposing that you are drawing Y first for(int x =0 ; x < 10; x++){ for(int y =0 ; y < 10; y++){ RENDER() } } int x = click.x / 32; int y = click.y / 32; then the tile is int id = x*width + y; map[id].selected;
  8. Where should I start

    I started some years ago with ALLEGRO/SDL and c++, both lib are very intuitive, do some small games, something that you can achieve. and if you get frustated (you probably will, like we all did xD) keep trying. SDL Tutorials -> http://lazyfoo.net/SDL_tutorials/index.php Allegro TUtorials -> http://www.loomsoft.net/resources/alltut/alltut_index.htm good luck