2D Rpg

Ooooooo

  • (2 Pages)
  • +
  • 1
  • 2

28 Replies - 11046 Views - Last Post: 22 May 2017 - 05:00 PM

#16 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 01 December 2011 - 03:19 PM

Okay I don't know how to show images in a post still so he's a link to one that shows what they map can look like.

http://www.freeimagehosting.net/53a9f

All the data for the map reads from an external file. I had this working in a very old version and decided to upgrade it slightly and add it to the main project. The old Map function did able to load different tiles for terrain depending on which tileset was selected. So if you wanted for some reason to have terrain based on the moon you could do that. It also speeds things up slightly since you only hav to load the graphics for the tiles you want, and not all of them.

oon I also plan to make a map editor for this to speed up....well, making maps. It took 10 minutes to do that example above and thats only 8 by 8. or hint hint...someone else may wish to assist on this ...... for example...... YOU! :)

Anyway, other things that I will work on regarding maps is the terrains features. so where aat the moment I only have the base terrain, grass, dirt, water, the features wil be things such as trees, rocks, or and physical object that could exist in the world.

I might also make a nice onHover event for when you are over a certain tile. I was going to just change the black borders on the tiles to white ones. since they both stand out easilly enough. Anyone got any thoughts on what colours I should use?


1634
Was This Post Helpful? 0
  • +
  • -

#17 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 23 December 2011 - 06:39 AM

Three updates in the space of a month!

Think this will be a short one, I've done what I intended to do in my last post although this wasn't much I am pleased that I have actually done sommething I set out to. So now we have OnHover() events for the map tiles. at the moment I just change the tile borders from white to black.

I have a problem though in that the engine dosnt automaticly swithch the colours back when I scroll the map so the tiles are no longer under the mouse.

Also made some map scrolling not very good at the moment though. the mouse event may as well not be there and the key presses get a bit tedious after a while.

I'm using this

        int xoffset =0;
	int yoffset =0;

	void MouseScreen() {
		Uint8* keys;
		if(event.type ==SDL_MOUSEMOTION) {
			int xoff;
			int yoff;

			xoff = event.motion.x;
			yoff = event.motion.y;
 
			if(xoff == 0)   { xoffset = xoffset -1; } 	
			if(xoff == 800) { xoffset = xoffset +1; }
			if(yoff == 0)   { yoffset = yoffset -1; }
			if(yoff == 600) { yoffset = yoffset +1; }

		}
		keys = SDL_GetKeyState(NULL);
		
            if(keys[SDLK_LEFT])  { xoffset = xoffset -1; }
            if(keys[SDLK_RIGHT]) { xoffset = xoffset +1; }
	    if(keys[SDLK_UP])    { yoffset = yoffset -1; }
	    if(keys[SDLK_DOWN])  { yoffset = yoffset +1; }
		
	}


then this
    if(SDL_PollEvent(&event)) {
            MouseScreen();
     }

then this to move the tiles
for(int i=0; i< cmap.getTotalTiles(); i++) {
        cmap.tiles[i].tileterrain[0].setX(cmap.tiles[i].getX()*32+xoffset);
        cmap.tiles[i].tileterrain[0].setY(cmap.tiles[i].getY()*32+yoffset);
        cmap.tiles[i].tileterrain[0].CLoadImage();
     }



Other things that I have done are to update and add in the old animation code, this works fine from what I can seem although there is only one type of animation so far an is currently abit restrictive in the number of images you may use.
Also finaly discovered what was wrong with some of my OnHover events, so now those have been sorted.
A few other change happed see below for more. Until next time

version 0.1.29
-Gave the map tiles onHover events, kind of
-Implemented rough code for map scrolling.
this works by using arrow keys and the mouse.
mouse code is still sketchy
arrow keys work better but sometimes are not very responsive

version 0.1.30
-Animation returns.Waiting animations only though.
-Fixed bug that exexuted events with the wrong icons. (see version 0.1.27)
-Units icons now get information from the nations unitslots icon list.

N.B.
-Still need to change this to a vector so each unit can have its own desired animation steps.
-5 images is currently what is needed for the .exe to function.
-Set up temp set of image names in the code, these will later need to be changed so they are read from
unit files and passed through nations and unit creatation stages.
-Waiting animations are the only type so far and there is nothing to change between different
forms of animation.
-Data for icons only works for [0] isn't looped yet.

This post has been edited by xnewix: 23 December 2011 - 07:19 AM

Was This Post Helpful? 0
  • +
  • -

#18 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 05 January 2012 - 01:58 PM

Okay So i'd thought I'd update you on ome new changes.

A unit may now have any number of frames for its animations as it likes, they are no longer consticted to just 5 images.
I also moved the animation code that I have in the Unit class to higher up, it is now a class of its own and appears in the UnitData class instead.

Sofar I have only enabled 2 different types of animations for waiting and walking actions. each action also has different images for the direction it is facing.

class Animation {
private:
	std::vector <std::string> north;
	std::vector <std::string> south;
	std::vector <std::string> east;
	std::vector <std::string> west;

public:
	
	void setNorth(std::string newanimation) { north.push_back(newanimation); }
        void setSouth(std::string newanimation) { south.push_back(newanimation); }
	void setEast(std::string newanimation)  { east.push_back(newanimation);  }
	void setWest(std::string newanimation)  { west.push_back(newanimation);  }
    
	std::string getNorth(int pos) { return north[pos]; }
	std::string getSouth(int pos) { return south[pos]; }
	std::string getEast(int pos)  { return east[pos];  }
	std::string getWest(int pos)  { return west[pos];  }
	
};


However I still havent written code that enables the animation code to be read into the game like the other data files are. I'm sure I can do it but it would probably look something like this

<animation>_waiting_east archer_waiting_east_001.jpg
<animation>_waiting_east archer_waiting_east_002.jpg

blahh...

It would get annoying, quickly.

But I guess its better than having a load more of these in the code

test[0].UnitStack[0].UnitAnimations[0].setNorth("archer1.jpg"); // Waiting animation, north direction, frame_1
	test[0].UnitStack[0].UnitAnimations[0].setNorth("archer2.jpg"); // Waiting animation, north direction, frame_2
  	test[0].UnitStack[0].UnitAnimations[0].setNorth("archer3.jpg");
        test[0].UnitStack[0].UnitAnimations[0].setNorth("archer4.jpg");
	test[0].UnitStack[0].UnitAnimations[0].setNorth("archer5.jpg");
                             // Action         // Direction   // frame
	test[0].UnitStack[0].UnitAnimations[0].setEast("archer1.jpg"); // Waiting animation, east direction, frame_1
	test[0].UnitStack[0].UnitAnimations[0].setEast("archer2.jpg"); // Waiting animation, east direction, frame_2
  	test[0].UnitStack[0].UnitAnimations[0].setEast("archer3.jpg");
        test[0].UnitStack[0].UnitAnimations[0].setEast("archer4.jpg");
	test[0].UnitStack[0].UnitAnimations[0].setEast("archer5.jpg");


But then again i did make the action deciding of which frames to use nicer. :)

		if((currentscreen ==1) && (test[0].UnitStack[0].slotTaken ==true)) {
			std::cout << "Name_aanimattion" << test[0].UnitStack[0].loadgraphics[0].getName();

			// Decide which animatons to use
			// According to the units current action and direction
			if(test[0].UnitStack[0].getDirection() ==0) { // direction is north
                test[0].UnitStack [0].loadgraphics[0].setName(test[0].UnitStack[0].UnitAnimations[test[0].UnitStack[0].getCurrentAction()].getNorth(test[0].UnitStack[0].getanimationnumber()));
            }
			if(test[0].UnitStack[0].getDirection() ==1) { // direction is east
				test[0].UnitStack [0].loadgraphics[0].setName(test[0].UnitStack[0].UnitAnimations[test[0].UnitStack[0].getCurrentAction()].getEast(test[0].UnitStack[0].getanimationnumber()));
       		}
			if(test[0].UnitStack[0].getDirection() ==2) { // direction is south
				test[0].UnitStack [0].loadgraphics[0].setName(test[0].UnitStack[0].UnitAnimations[test[0].UnitStack[0].getCurrentAction()].getSouth(test[0].UnitStack[0].getanimationnumber()));
       		}
			if(test[0].UnitStack[0].getDirection() ==3) { // direction is west
				test[0].UnitStack [0].loadgraphics[0].setName(test[0].UnitStack[0].UnitAnimations[test[0].UnitStack[0].getCurrentAction()].getWest(test[0].UnitStack[0].getanimationnumber()));
       		}
            
			// test[0].UnitStack[0].loadgraphics[0].setName(test[0].UnitStack[0].getwaiting_animations(test[0].UnitStack[0].getanimationnumber()));
			test[0].UnitStack[0].loadgraphics[0].setImage(0,test[0].UnitStack[0].loadgraphics[0].getName());

			test[0].UnitStack[0].loadgraphics[0].CLoadImage();
			if(test[0].UnitStack[0].getanimationnumber() < test[0].UnitStack[0].UnitAnimations[0].getListSize())  { test[0].UnitStack[0].setanimationnumber(test[0].UnitStack[0].getanimationnumber()+1); }
			if(test[0].UnitStack[0].getanimationnumber() ==5) { test[0].UnitStack[0].setanimationnumber(0); } 
		}


Now all I have to do is get my head round pathfinding and I might be getting someewhere. :(

Things for next time

look at improving terrain code, I'd like to have something other than grass or dirt in my maps. A tree would be nice. I might have to look at how obkects in general are displayd as the map still needs toknow there there.
so basicly I need to decide whether i'm going to keep rocks and trees seperate from bill and his pet goat.

maybe map elevation or perhaps Im getting ahead of myself there. not sure how i'd do it on a square grid

and maybe a nicer menu.

untill next time .....
Was This Post Helpful? 0
  • +
  • -

#19 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 19 February 2012 - 10:13 AM

Another smallish update

Added a class for Natural Objects, such as rocks, trees and animals. These can be scripted into the game using the same methods that are used for loading units, weapons etc.....

I also had enough time to test linking the trees to the map. it .... kinda works.
bill the goat also exists, but he looks like a rock, couldn't find any goats I liked.

I also had a fiddle with the resource display, it looks much better now. Although I still havent managed to work out how to make the boxes around text transparent. its really strating to get anoyying. now.

probably not going to update for a while now, going to be rather busy with other suffs.
so for now, goodbye.

version 0.1.31
-Added a class for Natural Objects.
-A nice trees and bill the goat are now scripted in!
-Made the resource display nicer. Resource information is now displayed at the top of the
screen and correctly spaced. It even got its own background pannel.

-Moved the animation class to its own seperate file
-Natural objects also have animation avalible.
Was This Post Helpful? 0
  • +
  • -

#20 ThatUselessMan  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 16
  • Joined: 23-February 12

Re: 2D Rpg

Posted 23 February 2012 - 01:57 PM

Hey I just finished making my 2D RPG too!
http://www.dreaminco...pg-game-engine/
Was This Post Helpful? 0
  • +
  • -

#21 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 29 December 2012 - 09:33 AM

Wow, this still exists! haven't posted here in a while. I stopped for a bit last year as I accendently fried my project, aka deleted, not on purpose. Turned out I'd also managed to reagrange my svn soureforge reposetiaty too, so couldn't recover the extra code. was rather annoyed.

I still have most of the file loading code though and have been casualy programing thoughout the year, mostly with opengl.
have been focusing manly on terrain and 3dobjects

So heres an image of a 3D grid

Posted Image

Posted Image

This post has been edited by xnewix: 29 December 2012 - 03:00 PM

Was This Post Helpful? 0
  • +
  • -

#22 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 04 January 2013 - 05:37 AM

Mwwhahahha. Okay a quick update.

lighting, its not great and I think i have a few problems with normals, still.
there is now some code to give elevation to the grid. Until I find out how to load a bmp file as a heightmap.
textures can be asssiged to the grid based on a tiles average height, again not great but it will do until I find som better formulars.
objectloader. I coppied this from a you-tube video so its not mine. works okay just to see something other than bumpy squares. I even made some 3d models, 10 points if you can guess what they are.


Posted Image


plans,
stuck between whether i want to start with height maps, or program generated terrain. honestly I think heightmaps would be easier....
the terrain looks blocky, can't decide whether this is because of the size of the squares or my bad lighting. i thought shading or shadows might make this better but i dont know much about this, what i've read seams pretty complicated.
i can make the squares smaller at the moment but this doesnt solve the problem,

I did consider looking at doing some water effet but they seamed to follow the same idea as shadows. so thats out.
I'd like to have some collison detection done soon and perhaps some better texuring.
A lot to think about I guess.

This post has been edited by xnewix: 04 January 2013 - 05:40 AM

Was This Post Helpful? 0
  • +
  • -

#23 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 09 January 2013 - 09:45 AM

Okay so i can now do this

Posted Image

It looks a bit better with a real landscape, but is still blocky if you zoom in. Also repeats ireland on the left side of the screen.

having problems with large maps, they take an age to load and then render.

largest size I can do is 256x256, even thats starting to suffer now. :(

I did manage a 2048x2048 before, but fell asleep waiting for the camera to change position. think it has something todo with 4,194,304 square instances, 8,388,608 triangles made from 25,165,824 vertices which is 75,497,472 individual coordinate.....hum

This post has been edited by xnewix: 09 January 2013 - 09:53 AM

Was This Post Helpful? 0
  • +
  • -

#24 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 10 January 2013 - 06:22 AM

I think I've managed to speed things up a little,

I can load 1024*1024 sized maps now, this is still slow but stutters rather than pauses.
Still using the average y heights to decide what texture to use. Must be a better way, but it looks okay from a distance.

I plan to work on fixing the problem with the map loading, as it still repeats. I think I may have to look at how my coordinatees are set. :( gunna be slow.
I also plan to look at how LOD works and somehow only draw the points that are in view. This should speed things up I think.
Since I have kind of gotten the heighmap to work I may have a go at collision stuff, and prhaps start to put things in the map.

Here is a heightmap of sicily, with weird teexturing.

Posted Image
Was This Post Helpful? 0
  • +
  • -

#25 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 17 January 2013 - 09:25 AM

Okay so I fixed the bmp loading function, so no more repeats. still working on a method to increase the LOD and peerformance.

I think reducing the number of vertices is my priority now. Haven't really been able to focus on anything else.
I also think that culling would help, so i'll probably look at that too.

this is an image to show how multiplying the rgb values of a bitmap affects the smoothness of the scene. I think it looks a lot better from the previous screenshots.

Posted Image

This post has been edited by xnewix: 17 January 2013 - 09:54 AM

Was This Post Helpful? 0
  • +
  • -

#26 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 21 January 2013 - 10:10 AM

Okay, so now i'm fustrated. after hours, no days of trying to solve my problem i've not gotten anywhere substantial. Basicaly my attempt at LOD was a faliure. In fact I failed so badly that performance is actualy better without it. i suspect I am going about the problem the wrong way.

A few days ago I had the good idea(not so good inhindsight) to decrease the number of triangles drawn the futher away the mesh was. I kinda got this to work using my previous impllentation of grid.squares.triangles.points but had trouble getting the correct z values for the triangles. Sooo i decided to try another way.

Now i've no idea if this is correct, but I had heard about using quadtrees to split a terrain into segments. so i though hey why don't I do that. The maths and the number of calculations that followed where not pretty, in fact they where hidious.

What i did was make a class called nodes, which could contain more nodes, well 4. this was fine at least I think it was until I started trying to set the correct values to each square and their correct position on the screen. Performance also drops like a rock, tbh this, new method for drawing 256*256 sized grids only fairs sligtly better than the 1024*1024 maps i was loading before using the old version. And I haven't even loaded the heightmap yet, I hate to think how long its going to be for me to find a way to correctly assign all those heights....sigh.

Anyway here's my hidious implmentation

Posted Image

class point {
private:
	float x,y,z;
public:
	void setvalues(float nx,float ny, float nz) { x=nx; y=ny; z=nz; }
	float getx() { return x; }
	float gety() { return y; }
	float getz() { return z; }
};
class node {
private:
	int x,y;  
	float px,py;
public:
	node() { 
		for(int i=0; i<4; i++) { 
		    test[i] = NULL; 
		}
	}
	~node() {}

    node *test[4];
	point fourpoints[4];
	point centrepoint[1];

	void usenodes() { 
		for(int i=0; i<4; i++) { 
			test[i] = new node; 
		}
	}
	void setcoord(int nx,int ny) { x=nx; y=ny; }
	void setpoint(float nx, float ny) { px=nx; py=ny; }
	int  getcoordx() { return x; }
	int  getcoordy() { return y; }
	float getpointx() { return px; }
	float getpointy() { return py; }
};

class terrain {
private:
public:
	
	static const int  nnodes=16; //*4
	static const int  kn    =8;  //*2
	static const int  rn    =4;  //*2or*self
	node testnode[nnodes];
void setterrain() {
		
		float squaresize=4;
		int counter=0;
		for(int j=0; j<nnodes; j++) { // j number of nodes
		testnode[j].usenodes();
	    for(int i=0; i<4; i++) { // 4?
	        testnode[j].test[i]->usenodes(); //2ndlevel
	    }
	}	
	int k=0;
	int l=0;
	for(int j=0; j<nnodes; j++) {	//*4	
		for(int i=0; i<4; i++) {
			testnode[j].test[i]->setcoord(k,l);
			testnode[j].test[i]->setpoint(k*squaresize,l*squaresize);
			k++;
			if(k==kn) {k=0; l++; } // *2
		}
		
	}
	
	for(int j=0; j<nnodes; j++) {
			
		for(int i=0; i<4; i++) {
	        testnode[j].test[i]->fourpoints[0].setvalues(testnode[j].test[i]->getpointx()-(squaresize/2),0,testnode[j].test[i]->getpointy()-(squaresize/2));
			testnode[j].test[i]->fourpoints[1].setvalues(testnode[j].test[i]->getpointx()-(squaresize/2),0,testnode[j].test[i]->getpointy()+(squaresize/2));
			testnode[j].test[i]->fourpoints[2].setvalues(testnode[j].test[i]->getpointx()+(squaresize/2),0,testnode[j].test[i]->getpointy()+(squaresize/2));
			testnode[j].test[i]->fourpoints[3].setvalues(testnode[j].test[i]->getpointx()+(squaresize/2),0,testnode[j].test[i]->getpointy()-(squaresize/2));

            // 16 nodes  // 16    // 64    // 256 vertices
			testnode[j].test[i]->test[0]->fourpoints[0].setvalues(testnode[j].test[i]->getpointx()-(squaresize/2),0,testnode[j].test[i]->getpointy()-(squaresize/2));
			testnode[j].test[i]->test[0]->fourpoints[1].setvalues(testnode[j].test[i]->getpointx()-(squaresize/2),0,testnode[j].test[i]->getpointy());
			testnode[j].test[i]->test[0]->fourpoints[2].setvalues(testnode[j].test[i]->getpointx(),5,testnode[j].test[i]->getpointy());
			testnode[j].test[i]->test[0]->fourpoints[3].setvalues(testnode[j].test[i]->getpointx(),0,testnode[j].test[i]->getpointy()-(squaresize/2));

			testnode[j].test[i]->test[1]->fourpoints[0].setvalues(testnode[j].test[i]->getpointx()-(squaresize/2),0,testnode[j].test[i]->getpointy());
			testnode[j].test[i]->test[1]->fourpoints[1].setvalues(testnode[j].test[i]->getpointx()-(squaresize/2),0,testnode[j].test[i]->getpointy()+(squaresize/2));
			testnode[j].test[i]->test[1]->fourpoints[2].setvalues(testnode[j].test[i]->getpointx(),0,testnode[j].test[i]->getpointy()+(squaresize/2));
			testnode[j].test[i]->test[1]->fourpoints[3].setvalues(testnode[j].test[i]->getpointx(),0,testnode[j].test[i]->getpointy());

			testnode[j].test[i]->test[2]->fourpoints[0].setvalues(testnode[j].test[i]->getpointx(),0,testnode[j].test[i]->getpointy());
			testnode[j].test[i]->test[2]->fourpoints[1].setvalues(testnode[j].test[i]->getpointx(),0,testnode[j].test[i]->getpointy()+(squaresize/2));
			testnode[j].test[i]->test[2]->fourpoints[2].setvalues(testnode[j].test[i]->getpointx()+(squaresize/2),0,testnode[j].test[i]->getpointy()+(squaresize/2));
			testnode[j].test[i]->test[2]->fourpoints[3].setvalues(testnode[j].test[i]->getpointx()+(squaresize/2),0,testnode[j].test[i]->getpointy());

			testnode[j].test[i]->test[3]->fourpoints[0].setvalues(testnode[j].test[i]->getpointx(),0,testnode[j].test[i]->getpointy()-(squaresize/2));
			testnode[j].test[i]->test[3]->fourpoints[1].setvalues(testnode[j].test[i]->getpointx(),0,testnode[j].test[i]->getpointy());
			testnode[j].test[i]->test[3]->fourpoints[2].setvalues(testnode[j].test[i]->getpointx()+(squaresize/2),0,testnode[j].test[i]->getpointy());
			testnode[j].test[i]->test[3]->fourpoints[3].setvalues(testnode[j].test[i]->getpointx()+(squaresize/2),0,testnode[j].test[i]->getpointy()-(squaresize/2));
		}
	}
}
};

This post has been edited by xnewix: 21 January 2013 - 10:13 AM

Was This Post Helpful? 0
  • +
  • -

#27 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 12 July 2014 - 10:40 AM

Well I sure haven't updated this in a while. I've pretty much been working on the same project now for the last year.

I am currently I'm focusing on terrain generation. I have tried several methods but have settled on a grid of fans. I am happy with the way the terrain looks, for now, but am still having problems with performance.

The performance increases have come from merging co-planer triangles within a 2*2 square. Unfortunately I haven't come across any explanations of how to reciprocate this effect over a larger area, so although this cuts out some of the unnecessary triangles, it leaves a lot in that could otherwise be merged.

I'm no longer using .bmp image files as height-maps, this was mainly due to the ungodly amount of space they took up on my disk and the parsing was soooo slow. Now i'm just using binary .HGT files which are at least 1/10th of the size. The .HGT files are data representing the elevation of the earth in meters, and the length along the ground measures at 90 meters per square. For more info search Shuttle Radar Topography Mission (SRTM).

I have also implemented vertex normal lighting, or at least my distorted interpretation of it, which I think has improved the quality of the terrain significantly, see image from 5 posts back for comparison. Although in places the output can look blurry. I'm not sure if this is something to do with the way I calculated vertex normal's or some other factor I set in the lighting attributes.

Posted Image

Posted Image

I breifly tried to implement a algorimtm to change the colour of the terrain depending on its gradient, but ran into lots of maths problems. From what I remember it was a similar method to my vertex normal calculator with an additional step thrown in to consider the terrain heights. I only seamed to work for extremes which wasn't what I wanted, areas such as the alps where being shaded as having a gentle gradient......seriously it was naff.

I have also been working on several other mini projects too, one being a parser to load Open Street Map Data, although this has taken more time than I wished. I'm not too keen on the format that the data is in and on top of that it can be quite hit and miss on finding an area of the world that is complete. I have kind of postponed this one for now as I got distracted by the possibility of procedural building generation.....yeah that went right over my head too.

This post has been edited by xnewix: 13 July 2014 - 02:26 AM

Was This Post Helpful? 0
  • +
  • -

#28 xnewix  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 211
  • Joined: 23-May 09

Re: 2D Rpg

Posted 30 April 2017 - 02:09 PM

Yes, it has been some time.

Here are a few screens of my attempt at procedural terrain generation.

It's not perfect but i am surprised at how a few random sin waves can produce these results.

The images show the current stages of generation.

Step 1 I start with a basic sin wave which is offset between 1 and 6 radians,

Step 2 I add in a bunch of different frequencies with their inverse amplitudes.

Step 3 is my attempt at hiding the sin waves true nature. Here I create four different waves per octave and offset them in different directions and average the result.

Step 4 I apply a exponent to suck all the lower heights down.


Posted Image Posted Image Posted Image

Posted Image



if people can spot any unnatural repetitions please let me know.

I am going to tweak a few of the input values and post some more screens shortly. hopefully i can get my scaling correct so i can patch together a few 512 x 512 tiles.

This post has been edited by xnewix: 30 April 2017 - 02:47 PM

Was This Post Helpful? 0
  • +
  • -

#29 s23bog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 79
  • Joined: 02-May 17

Re: 2D Rpg

Posted 22 May 2017 - 05:00 PM

Anyone interested in helping me with my 3D chess interface and game?

Anyone interested in helping me with my 3D chess interface and game?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2