Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Knights of the square [Unfinished game]

  • 08-03-2015 7:14pm
    #1
    Registered Users, Registered Users 2 Posts: 32


    Today, a few months after being pretty much done with this project I decided to open it up again and try to put some finishing touches and make everything fit together. I’ll probably never publish this but that was never the idea, there was a load of interesting problems in making it that made it pretty hard for me, but in a good way. I couldn’t have gotten this far if it weren’t for you guys, so thanks! (<- that wasn't me being cheesy, some people really helped me out with Ai and other bits and pieces i was having trouble with.)


    The game has evolved so far since i started it, the original idea had no regions, but instead you controlled groups of ranged or melee units by dragging an arrow to guide them, it was an RTS and the idea was to make it fairly chaotic. I plan to come back to that, since I really enjoy the idea, but I wasn’t good enough at the time to make it work. It was then a space themed game, very similar to what it is now but with only one pre-made map, and a rock-paper-sisors kind of unit system. Finally i thought i’d ’simplify’ it and make what is essentially a clone of risk (or specifically of the flash game dice-wars).

    Gameplay: fairly simple. It’s turn based, and each player controls a colour of knights. You control the blue knights (although any colour could be selected, and hotseat multiplayer is also possible) and you must lead them to victory by killing all the other players’ knights. At the start of your turn you get to place a number of knights into the regions you already control, and the second part you get the option to attack regions by clicking and dragging…

    This’ll all make sense if you watch the video here:
    http //youtu (dot) be/u79otUlI8bs

    Here’s a test of the menus which i’m quite fond of also.
    http //youtu (dot) be/AdOQtSaQ48E

    All the art and animations were done by myself, as you can tell, with the exception of the helmet design which came from something i can’t remember, and the mountains.. and the place units menu.. and the font used for the menus.


    Of course this wouldn't be a programming forum if i didn't rabbit on a bit about technical stuff... I wanted to write this down for my own sake, but it's here if you want to read it anyway.

    World generation works like this: (as far as i can remember, this was a year ago)
    1: Initiate a region class, which will recursively divide until a minimum size is reached (Binary Space Partitioning), where the divides don’t happen in the center, so you’ll get a load of randomly sized rectangles.
    2: Look at the corners of the rectangles, if the corner of a rectangle cuts the edge of another, the rectangle becomes a 5-sided shape. Map looks the same, but is made up of 4-8 sized shapes.
    Think of in a brick wall, each rectangle meets with the corners of another along the top and bottom edges, so the program converts it into a hexagon. (This is hard to explain sorry!)
    3: Randomise the position of the corners by a few pixels
    4: Calculate the size of each polygon (ave distance from center to corners i think?) then try to shift the polygon towards the regular shape of the same number of sides. Lots of sine/cos used here. And a sprinkle of voodoo magic. Repeat this step 20 times.


    Here’s some pics from early tests of this process, and some messing around on my part:

    http //imgur (dot) com/a/epJ1W



    Next the island is generated.

    1:The center of the island is marked as land, and is added to the Fringe

    The following is then done 5 times, larger or smaller depending on the desired size of island
    -- Loop through all the tiles in the Fringe, removing them as you go, and marking them as Looped.
    -- Loop through the neighbours of the tiles in the Fringe, and if they haven’t been Looped, decide if it’s land or water. (randomly, AND depending on how far from the center it is. The importance of the distance and the overall likelihood can both be set, so blobby/ stringy islands can be generated)
    --If it is now land, add it to the Fringe.

    Next, the area is filled from the top left corner, and all water tiles are converted to sea tiles. This is to see what is fresh water/ salt water. These will all be removed later.

    6 land types are:
    Lake
    Beach
    Light grass (at higher altitudes/dry)
    (Med grass) (removed, since i couldn’t get it look right in pixel art. This was for semi wet tiles.)
    Dark grass (idea being well hydrated grass)
    Mountains

    Now loop through each region and count the number of adjecent sea tiles there are.

    If this no. is >3 the region is a beach.
    If it is >1 it is randomly either beach or dark grass
    If it’s >0 it’s randomly light or dark grass.
    If none if it’s neighbours are adjacent to the sea, it is a mountain, however there is a cap of 5 mountains per map.
    If none of the above, it’s light grass.

    Finally the knights are added randomly to the tiles which can contain units (I.e. not mountain or lake tiles).

    Phew!


    The AI is fairly simple.
    Place Units Phase
    It adds units in two 'types' of region; agressive or passive, depending on how well it’s doing.
    Passive works like this, loop through all owned regions and find the one where (neighbouring enemy units) - (units in that region) is the largest. Add a unit to that region. (Repeat)
    Agressive puts units in the strongest regions, to build up an army.

    Attack Phase (loops recursively)
    First, it calculates the number of units on it’s border.
    Then, imagining it took each of the adjacent tiles that it has the forces to take, it picks the one which would result in the lowest number of units on it’s border.
    If this number is smaller than some constant, that depends on how well the AI is doing, take that region.



    That’s pretty much it! Thanks for reading, unless you just scrolled to the bottom! :D

    Oisin.

    Edit: Nooooo boards took out all the tabs and spacing i had, making this pretty hard to read. Sorry! :/


Comments

  • Registered Users, Registered Users 2 Posts: 3,831 ✭✭✭Torakx


    It looks great!
    The game looks fun as well.
    You should publish it or get it onto steam or something. With a bit of flare in the marketing area and some more features, it could be popular.
    I spent so many hours on one of the Lord of the Rings games, just playing it for that risk mechanic, the overall strategy layer was addictive.


  • Registered Users, Registered Users 2 Posts: 32 oisincar


    Thanks! :D
    Yeah when i was working on it again i got some inspiration to finish it. Really though school has been taking up all my energy for this kind of thing. I hope to get back to it (after the LC), and maybe try and make the gameplay a bit more unusual/ interesting. That said, it's all obj-c, so i could only publish for ipad, and imo its hard to imagine making back the 70 euro or so that it costs to publish it.

    Anyway, i tend to get super lazy when it comes to this stage. I've done all the 'fun' parts already. Just tedious work to make sure it works at all resolutions and aspect ratios, which since i hard-coded in dimensions in pixels to a lot of the map generation stuff..... Ugh.

    I will finish it though! Someday.. Probably over the holidays.


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Nice!

    Understand where you are coming from in fees. Now that you have all the details worked out, would it be an option to recreate the game using a framework or engine with greater portability?

    I can certainly see the appeal in your game (I'd play it). Might be interesting to polish it up and extend the features, and see where the road takes you : )


  • Registered Users, Registered Users 2 Posts: 32 oisincar


    Yeah that's definitely something i should consider. I've been trying to learn c++, so maybe once i start getting the hang i'll try to convert the project to cocos2dx, which can export for andriod, pc, mac, and i-devices. It is 5 thousand lines of pretty mangled code.. I went through a phase where i thought making new functions for EVERYTHING was a good idea (hint: it's not). It would be nice to have an excuse to try and clean it up a bit, but on the other hand it's a lot of work (for me at least).

    I'll start by seeing if i can make it into a good game first though as you say, I might see if i can get it out to people to playtest sometime in the future. If you have any ideas let me know! I'll shamelessly steal them :3


  • Registered Users, Registered Users 2 Posts: 454 ✭✭Kilgore__Trout


    Sounds like a plan. A few things that spring to mind. You've probably thought of these, but here goes.

    - From looking at the vid, it looks like the option to decide how many of your units to leave after attacking a region isn't there. If so, this will lead to lots of poorly defended territory, and make it hard to consolidate gains. Depends if you would see this as a feature or frustration.

    - Some indication of the process to decide who wins a battle would be good. Maybe you could also add the option to improve your chances with timed button presses, or something similar to increase the interactivity.

    - Structures, whether buildable or placed during map generation would increase the strategic depth of the game. Things like fortificatons, mines for enhanced production, forges for better weapons. Another idea would be to add a character development system for the commander of the knights, in which abilities could be unlocked to provide various bonuses. These suggestions would really depend on where you see the game going, whether towards a pure, risk style game, or something with more depth. Either could work equally well.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 32 oisincar


    Oh great thanks! I really like some of these!

    I kind of like the fact you can't move your own units unless attacking, it adds to the strategy imo, and makes the shapes of the maps more of a puzzle. It's something i'll probably look at implementing anyway and see how it plays out though (heh).

    How the combat works exactly was something I never really decided on, right now the tile with more units just wins. Having some kind of minigame or skill for the combat is something i'd never thought of. I'm not sure how it'd work, but even the idea of rolling dice or swiping to attack or something is much better than waiting for the ai to make moves.

    I was originally going to have bonuses on certain land types, like civilization, but i'm not sure how that'd work. Interesting idea with structures though, maybe the army could take a number of turns to build fortifications in a tile, or a nuclear plant to get radioactive units which deal extra dmg or something.


Advertisement