Worklog for Pakz
Civ Clone
Return to Worklogs
| ||
I added a couple of screenshots to the worklog in older posts. I did
not know of tinypic then so there where only video's. I still do not
know how to show the video's directly in the posts. I am currently taking a break from skyrim and want to spend the coming time doing some programming. |
| ||
I have not done a lot of work on the civ clone the last month. I started playing Skyrim and Aoe2. Yesterday I almost started retyping part of the last work but I then saw that Sonar and Music creator 6 and the synths were on sale with steam. I have then started making music. I have no idea when I will continue on this project. I need to get motivated :) |
| ||
I have been typing in parts of the civ clone again. I improved on a
couple of things. This time I made a map with cities where around the
cities the fog of war has been lifted. ![]() Here the youtube video: http://youtu.be/msbmcQO8lS8 |
| ||
I am using tinypic now for images in this worklog. Here a image of a huge world I created using the code on this log. ![]() Here a image of a medium world. ![]() Here a older Image from when I was tinkering with the a* and movement variables. ![]() Here a image of when I started programming with the civ clone. Here some roads and cities. Automated settlers. ![]() |
| ||
I made a new map generator. This time I fil the map with randomly sized
ovals and increase the map value by 1 if they are in the circle. I end
up with levels like you can see in the video.![]() Here a video of the output of the code below. : http://youtu.be/ZZFMujopJ-0 Here a video with big worlds : http://youtu.be/8QAGr50oBNg I will use this map generator code for the next experiments. I recently also improved upon the a* code to. I was able to remove a couple of things that were not needed. If I stay up late tonight I might make a experiment where I have a map that has two ai players that attack each other. It wil be simple. Build unit and send to nearest enemy city. If next to enemy object and have moves left then attack. This wil get me some insight in what else can be done to make more complex ai. |
| ||
I decided to see if I could program the units scrolling movement. It
went pretty good without many errors to get the end result. The units move one after another and slowly move from tile to tile. Roads cost 0.3 points and other map tiles cost 1 movement cost per tile. I am sure I will program a lot more small programs to learn the ins and outs of civilization 1 2 and. Below is the video of the last thing and the code to (<500 lines) ![]() Here the video : http://youtu.be/C8s3g6F6BIA Here the code : (b3d b+) |
| ||
I was able to remove a couple of lines from the a* algorithm. I had not noticed that it was doing things that were not needed. Below is a map creation method that I was messing with. ![]() Here a video of a map creation method using the a*. http://youtu.be/gLgZ7jE9-OY Here is the b3d b+ code |
| ||
The last days I have been following the soccer. I did make time to
practise typing useable a* routines. Today I retyped the a* one time
and I am about to type it in again. I keep finding things to improve. I
rarely make mistakes now after the dozens of times that I retyped the a*
code. I have not spend a lot of time figuring out what to type in for the civ clone project. Sometimes I get a idea for a small project but I need to write that down for I keep forgetting what it was. I have that microsoft note system for writing down things but I rarely use it. The last time I had it open I added a couple of screen shots of strategy games. I can look at it to get ideas out of. There is so much that can be added in a strategy game but it is so difficult to find something that I could type in. I think I need to watch more youtube or twitch video's of civ 1 and 2 and 3. One note that I just made was that I will need to store the sizes of the water and land area's in a array. In civ 2 sea units were placed into small 1 tile oceans. I think it is useful to know the size. For logical amount of units on a area and such. One thing I could make is a project where I have units explore the map. I can make a fog of war map and have units remove that. That project wil probably teach me a few things that I need to know. One thing I could also make is part where the user moves the units. The a* I could then also use. This based on the later civ versions. Here the movement part that I just made. b3d, b+ code. ![]() Here a video of it in action : https://www.youtube.com/watch?v=fofuWP8LW60 I made another version of the one above. This time with more units. Each unit can be selected and be assigned a path with. The right mouse button deselects a unit and the left mouse button assigns a path and starts the movement. The enter key(28) for the next turn. The units after selecting a path move until they get to the end of the path. They can be selected to change the path. Here a video of it in action : http://youtu.be/aa1bMapG6Zs |
| ||
I have begun programming a short program with things for the civ clone.
I want to type in a map with roads between cities. I had increased the
speed of my a* algorithm and will see if a lot of roads now are
generated faster. I will put the code in a codebox here in this message or a next entry. Step 1 : Setup the a* code. Step 2 : generate a simple heightmap Step 3 : Draw the heightmap to see if everything went good. Step 3 : Find 2 coordinates for the pathfinding. Step 4 : create the functions for the pathfinding algorithm. Step 5 : Create the pathfinding function Step 6 : Test to see if everything worked. Step 7 : Create the cities Step 8 : create the roads Step 9 : Check if everything works Here a video of the creating of the roads : http://youtu.be/la0ChJHIV04 The code is b3d and b+. Above is a simplified map of a ai country with cities and roads. I will include a feature in my civclone where you can select to play from in a advanced time in the game. Where the ai has already expanded. If I start programming small tests for the ai and its land expansion and city settling part I will test more. Then I will test to see if I need to create a road to the closest city or roads between all of the cities. I will see how it looks. The speed of the road creation is pretty fast. I think it is faster then when the pathfinding had no direct array coordinates lookup but lists in types that needed to be cycled through to check if they were present. I am now thinking of creating a test where you have islands/continents. I want to make a transport unit and see if I can make it so that a unit can travel to any point on the map. If the path gets across the sea then a transport unit wil be moved towards the unit and will be picked up and transported to the next land/sea tile on the path. I need to figure out how to do this in the code. I programmed the part where the islands are given a number. I created a array where this is written in. This example has 3 islands numbered from left to right and down 1 to 3. Run it to see it, Here a video of the process : http://youtu.be/5i66B9s3HTc When you get more features in a game like this then you need to know for instance if a unit can travel from landmass 1 to landmass 2. You can check it simply with the array. I also used this for the automated workers. I made the first attempt at sea transports. I made code where 1 unit moves to the shores and waits for the transport then boards that transport. The transport then travels to the dropoffpoint and from there the unit continues to its destination. It took me quite a while to make. But I hope to have learned something. Here a video of the experiment : http://youtu.be/0FIFON0LEyQ here the code in bb+ In the next code I made it so that there are a couple of cities on the map and a group of enemy units. The zone around the enemy units is drawn and the borders are used to place units in a defensive line. The cities build units and send them to the defensive line until there are enough units there. Here a video of it in action : http://youtu.be/o7jVdpzr7DU bb+ bb3d code The next thing I made is the ai that expands the country. The settlers are build and travel from close position spots to the entire map positions and create cities that build more settlers. Here a video for the example : http://youtu.be/xx01VoM1nsQ |
| ||
I have not updated the worker automation log in a while. I have not
done a lot of thinking for that the last few weeks. I started this
worklog for a civ clone that I want to make. I intend to spend a lot of
time working on small things for the clone. I have no idea how long a
big complete version wil take and be playable. At the moment I have no
intention of starting the main project. I have read though the freeciv wiki for the ai and found not a lot of information. It seems the ai is pretty basic. I have not played freeciv a lot though and it could be that the code has more features then seen in the documentation. Yesterday I have found a way for the ai player to create defensive lines. I want to create a oval zone on a unit in memory and have the outer edges set for defensive destinations. I still need to think this through more. I might create a small test program for this. I think I need to do a little bit of line of sight to get the edges right. I have not done a lot of programming the last month. Today I retyped the a* code twice and found a couple of improvments for the code. The cat of my parents that was run over by a car is fine. She recovered. Last night she brought back a tiny bird that fell from its nest into my parents home. Bad kitty :) |