Jump to content
EleTD.com
TowerFun

OPTIMAL TURRETS PLACEMENT ALGORITHM

Recommended Posts

Hi all,

Just wanted to share my little contribution. I found Element TD fun and wanted to find the optimal position for my strategy (which is 2 lives towers -> mass Obliteration -> some support and disease towers at the end).

Without mazzing or other hero stuff and on normal difficulty I achieved more than 600 fruits kills without optimal placement. So I think I still can do more but well I would be curious to know your score too btw :). I did the game on very hard too but obviously I got a lower score TT.

So here is a picture of the program output : http://picturepush.com/public/11923430

The example shows the result for 20 obliterations towers (range 16). Actually you can do it for any tower mix, you just have to give the range of it and it will find the next best position for your tower to be built. Simple !

And now you can be sure that your placement is optimal, how cool is that !

Just tell me if some of you are interested by the program, I can upload a more user-friendly version of it somewhere very soon.

Happy gaming folks!

TowerFun.

post-5651-1357770369.jpg

Share this post


Link to post

To be honest I recently discovered element tower defense (I play on SC2 starter edition and was available 1 week ago...) but it seems that this forum is pretty much empty now :(. I realize that this map is quite old (comes from war3) and the hipe settled down quite a lot.

Anyway I really liked to discover this map from scratch and was happy to work on it a couple of days.

If there is any1 left here I salute the great work that has been done.

Happy gaming Folks !

Share this post


Link to post

Ok folks,

Here is a JavaScript ALPHA version of the Optimizer. I have rewritten it in JS from C# because I wanted to learn Html5 and the new Canvas stuff. Was a bunch of fun ! :D

I made it so it is quite easy to install. I didn't spend much time on the HTML and CSS but mainly on JS which I really discovered for this project. So, attached to this post you'll find a ZIP archive which contains the following files :

  1. ETDOptimizer.html (the file that contains the code and all the cool stuff)
  2. playground.txt (the ASCII version of the map.)
  3. Towers.txt (the JSON list of a subset of towers, not all towers are in the program yet, I have to create an importer... hell there are soooo maaaany tower in this map xD)
  4. Scripts/flowslider.jquery.js (a script for the quirky slider control)
  5. Scripts/jquery-1.7.1.js (wel... jquery lib...)

How to install

=========

Just copy all the aforementioned files to the root directory of your web server (mine is IIS but others types like Apache are ok too. It's only JS no server code there.

Try request the ETDOptimizer.html from your favourite web browser and you should be set...

How to use it

=========

It is pretty straight forward. First select a tower type in the slider at the top of the page. Then you have two choices :

  1. Let the Optimizer find the best tactical position on the map for your selected tower by clicking the "Auto-Place" button.
  2. Or just click on the playground to place your selected tower manually

On the upper left corner the actual placement score is displayed. Each time you place a tower the score is updated. The higher the better. You can try to place some towers manually first like you did in game and then let the engine place them automatically and see the score difference. If the difference is big then there is a good chance that if you apply this new placement in your next game you will see an increase of fruits kills :) !

On the upper right corner the coordinate of the tower you are about to place is displayed. This appears only if you place towers manually.

When placing towers manually the Optimizer shows you the tower you are about to place and if all the squares are at a valid position. The overlay must be totally green for a tower to be placed much like building placement works in SC2.

How to configure

===========

The Map

---------

For editing the map, which I know the actual one is not 100% accurate, just edit the "playground.txt" file. The logic rule is simple you have :

0 = Unbuildable walls

1 = Non walkable area (areas where creeps never walk actually)

2 = Walkable area (you guessed it...)

3 = Buildable area (where you place all your towers.

Just fill a rectangular area of this numbers and you'll have a new map. The program adapts itself to the map, there is no need to change the code if you modify this file.

The Tile Size

---------------

It is possible to change the size of a tile. By default its 16 pixels (towers pictures are 32 pixels so it works well). This could be useful if, for example, you want to make the playground fit in a smaller area. In short make the whole page/application smaller or bigger. To do that you have to edit the "ETDOptimizer.html" file.

At the line number 599 change the following line to whatever number you desire :

var _tileSize = 16;

BTW : You'll need an internet connection open to make this work because the program goes on the EleTD website for the pictures.

Root Server Path

-------------------

By default and to ease installation, the root server location is : http://www.eletd.com

But you can change it at line 600 :

var _serverRootPath = 'http://www.eletd.com';

And that's it folks !

Possible evolutions

============

- It would be interesting to maximize also DPS. For the moment only the best placement is given but if a tower with big range has 1DPS and a tower with very small range has 1000DPS then the second tower may have the priority for placement...

- Optimize build : One cool think would be to give your own build and let the program optimize it. Like when to build what tower and exactly where to place it.

- GUI... now it sux xD

Let me know if you encounter problems or if simply you like this first Alpha version. Anyway I had great fun coding it !

You are free to use the code if you want to.

Happy gaming all !

TowerFun.

post-5651-1358104033.jpg

ElementTowerDefenseOptimizer.zip

Share this post


Link to post

Hi all,

I made a minor revision to the Optimizer (v.0.1b). Now when you place a tower there are 2 news numbers displayed. On the upper left you see the Tower index (ie #15 if you just placed the 15th tower) and on the lower right the Tower score. All the real game towers are now placeable.

I will work on the website now. Wanna learn CSS3 and HTML5 and make a better user interface. I wanna make it possible to export the playground as an image to make it possible to discuss towers placement in the forum for example. Like you go on the optimizer, you place your towers and then you get a picture of it that you can show and discuss. I want to make the map editable too, change the towers selector and many more things :).

The hosting website will stay the same I guess for the whole development phase : http://towerfun.host22.com/

Don't hesitate to report me bugs or remarks.

Happy gaming folks!

TowerFun

post-5651-1358253537.jpg

Share this post


Link to post

Hello!

As promised here is the the new version of the optimizer (0.5). You still can find it here : http://towerfun.host22.com/

You can also find the release note of the tool on the Website under the "About" navigation menu (I added a goody there btw :D).

I think I am half way through the point I want to bring it. So soon will be the 1st version ! 1.0 8D

Cheers for all the guys who sent me private messages on BattleNet or on the forums telling me how helpful this online tool is for them when playing. And special thx to Karawasa for the map terrain and the possibility of uploading it on the Website when it will be finished.

Happy gaming folks!

TowerFun

--------------------------------------------------------------------------------------------------------------------------------

Version 0.5 release note (19.01.2013)

  • Added a new, home-made, generic and compact way to display available towers grouped by their elements
  • Show/hide the element title in the tower selector when the mouse is hovering
  • Show/hide the tower statistics in the tower selector when the mouse is hovering
  • Got rid of the third party slider control, was kinda buggy
  • Added the picture of the actual playground in the original SC2 map (thx Karawasa ;))
  • Correcte the map layout for better matching with the in-game map (path will be widened a bit later on)
  • Added a feature for unselecting the current tower by pressing the Esc key
  • Added a feature for placing multiple times the same tower by keeping the Shift key pressed
  • Added a feature for magnifying the tower hovered by the mouse
  • Added a feature for showing the tower range in red when the tower is hovered by the mouse
  • Added a feature for showing/hiding the units range
  • Added a feature for showing/hiding the playground grid
  • Added a small how-to guide
  • Add a featurse that allows the user to export the current playground as an image
  • Imported all the pictures locally
  • Reworked the code for performance and maintainability
  • Creation of release notes on the website
  • Added for fun the last Husky SC2 unit dancing video, so kewl xD
  • Reworked a bit the website look & feel
  • Updated the Test Website for matching the dimensions of www.ElemTD.com to prepare a future integration
  • Made it works on all 3 most used browser : Chrome, Firefox and Internet Explorer

post-5651-1358627897.jpg

post-5651-1358627920.jpg

Share this post


Link to post

Version 0.6 is out ! 8-)

Development Website URL unchanged : http://towerfun.host22.com

I also added a roadmap to see what is missing for version 1.0. Don't hesitate to ask for something. All remarks, positive :P or negative :blink: , are welcome!

Release note :

Version 0.6 (21.01.2013)

  • Corrected some glitches when displaying unit overlay
  • Wait the preload of all resources before displaying the TowerSelector so the overall display is better and synchronized
  • Added the jQuery custom content scroller to the TowerSelector. It is really nice and pro.
  • Overall Played a bit with CSS3 (nicer display, I hope...)
  • Added a feature that shows the current tower selection on the TowerSelector (the strip stays open)
  • Show tower's range by default
  • Hide grid by default
  • Added a loading jQuery progress bar and message
  • Added the ElemTD website favicon
  • Made a cooler display of the placement score
  • Made a cooler display of the current unit overlay position
  • Used the MVC pattern and more precisely the Model-View-ViewModel pattern.
  • Tuned application for slower connection speed.
  • Added logging capabilities!
  • Successfully tested on all 3 most used browser : Chrome, Firefox and Internet Explorer last versions
  • Added the roadmap for version 1.0 :D!

Happy gaming folks !

TowerFun

post-5651-1358795773.jpg

post-5651-1358795788.jpg

post-5651-1358795795.jpg

Share this post


Link to post

Hey, I like this! Pretty cool.

One thing that I think you should add: certain support towers getting placement bonuses based on other towers that are within range. I'm mainly talking about stuff like Forge, Well, and Trickery, but I'm sure there are others that aren't coming off the top of my head.

Share this post


Link to post
Hey, I like this! Pretty cool.

One thing that I think you should add: certain support towers getting placement bonuses based on other towers that are within range. I'm mainly talking about stuff like Forge, Well, and Trickery, but I'm sure there are others that aren't coming off the top of my head.

You perfectly right!

But this feature won't be in for version 1.0, I foresee it for version 2.0. BTW I added some targets in the roadmap, ofc your proposition is in :) :

  • Version 3.0 (xx.xx.2013) - Work in progress

    • TODO : Make the tool more generic so it can be used with the new versions of Element Tower Defense map (but still the same mode : no maze, no hero -> just build orders). :D
  • Version 2.0 (xx.xx.2013) - Work in progress

    • TODO : Integrate all the towers abilities in the placement algorithm. Basically u give your build order and it places all your towers automatically taking into consideration DPS, abilities like haste, splash damage, slow, damage increase etc... Sadly, abilities of towers like MoneyTowers won't be in until the program takes into consideration turns and money. But if we reach this point I'm not sure if there will still be a reason for playing the game at all xD. So I guess it won't be done. The goal of the tool is to automatically solve the "boring" part of the game which is : optimization. But it doesn't wan't to steal the fun out of finding out your own best strategies. Maybe I will do an in-house version to see how good the algorithm can do... we'll see. Maybe in the end there we could see a new AI integrated in the game... will depend on the EleTD map creators.
  • Version 1.0 (xx.xx.2013) - Work in progress

    • TODO : Integreation with the official EleTD Website.

You can find the whole roadmap here : http://towerfun.host22.com/About.html

Soon I will make a specific section for it so stay tuned :)).

Happy gaming folks !

TowerFun

Share this post


Link to post
TODO : Make the tool more generic so it can be used with the new versions of Element Tower Defense map (but still the same mode : no maze, no hero -> just build orders). :D

I'm happy to see this! I'd want the tool to remain relevant.

Share this post


Link to post

Heyooo all !

I'm going forward with the Optimizer and just uploaded a new version. It is now the 0.7 and SOUNDS are in !! B)

The Website also got a massive revamp as I am learning new skills and I added a Current Mood section with some collected goodies.

You still can find it here : http://towerfun.host22.com

The release note :

•Version 0.7 (23.01.2013)

  • Added a new featue allowing to save a Build Order. This feature stands right next the "Placement" one under the label "BO. Just place towers as you normally do then when you are happy with it go to the "BO" tab and click Save. Now you can reload your whole build order at any moment. :)
  • Played with CSS and jQueryUI Themes. Still not ready but going in the right direction :).
  • Add sections "How it Works", "Current Mood", "Version History" and "Roadmap" to the website
  • Added UI sound for unit placement, bad placement, buttons, checkbox, towers selector
  • Added indication on the ressources being loaded at start
  • Successfully tested on all 3 most used browser : Chrome, Firefox and Internet Explorer last versions

As always if you have a positive or negative remark feel free to post here or send me a private message.

Happy gaming folks :).

TowerFun

post-5651-1358986457.jpg

Share this post


Link to post

Hello Folks,

Today I realized that 000webhost.com is down. I don't know if this situation will last. I know it is a free service but well it is not that hard to have a server up and running 100% of the time nowadays... I'm planning to move but it will take time and I do need a free service to start with so... we will see what comes up.

BTW if you guys know a free GOOD hostname and/or asp.net website hosting service don't hesitate to tell me.

And stay tuned because I am almost done with the 0.8 version of the Optimizer :).

Cya soon.

TowerFun

Share this post


Link to post

At last :)

Server is up and running (still the old one for the moment, searching a new solution though).

So here you are the version 0.8 of the optimizer : http://towerfun.host22.com

I added an article about Gimp & Script-fu in the "Current Mood" section.

Attached to this post you will find a small gif animation of the new "Find Tower" feature. Enjoy ! :)

The full release note :

Version 0.8 (28.01.2013)

  • Added a feature that allows the user to zoom in and out the entire playground
  • Added a feature that allows the user to scroll the playground when zoomed with arrow keys
  • Changed the export image for taking into consideration the Zoom currently in-use
  • Changed the layout of the following features : Clear playground, export as image, show grid and show range
  • Added the detailed list of the current build order in the BO tab which is synchronized with what you see on the playground. By hovering elements with the mouse you can see at what sequence the tower is built.
  • Added a feature that loads the last saved BO at start.
  • Added a search box on the TowerSelector which filters towers as you type
  • Added a Glassy effect and rounded corner on all the 110 tower icons. Did it by creating a Gimp Script-fu called in batch mode. Automated modifications took a couple of minutes for 110 images, nice ? :D
  • Added an article in the Current Mood section about Gimp and Script-fu
  • Added some minor improvements to the unit overlay display
  • Added quite a lot of modifications to the code (~2000 lines of code) but mainly not visible to the end user at first sight except that the application is very dynamic. These include Observable Properties, Observable Collections, home-made databinding, improved performances, better design/refactoring and so on...
  • Successfully tested on all 3 most used browser : Chrome, Firefox and Internet Explorer (but animation are disabled at the moment for ie :(() last versions

Happy Gaming Folks!

TowerFun

post-5651-1359464055.gif

Share this post


Link to post

Hoy !

Just fixed a bug that "Cool" made me notice. Thx to him. If you open the optimizer for the first time it loads for ever. I couldnt see it on my test browsers because I'm always working on it. So now it is fixed and it even works on Opera :=)

gl hf all

Cya

TowerFun

Share this post


Link to post

Hello,

New version is out !

I'm almost there and starting to think that it will be soon possible to move it to the main website of Element Tower Defense.

Web address unchanged : http://towerfun.host22.com

Here is the full release note :

Version 0.9 (02.02.2013)

  • Added a feature that allows showing a context menu on placed units (delete + move).
  • Added a feature that allows user to move placed towers with home made drag'n drop.
  • Added a feature that allows to delete a unit when pressing the "delete" key, note that this will correct the current score as well
  • Added a feature that allows user to select a tower on the playground by clicking on it
  • Added a feature that shows on the playground the hovered unit in the build order tab
  • Added a feature that selects a unit on the playground when clicking in the build order tab
  • Added a feature that allows to import and export build orders
  • Added a feature that restores last used display preferences (show grid/range) at load time
  • Added animation when changing tabs
  • Added tool-tips
  • Created a little video for showing the main functionnalities
  • Improved performances
  • Added code goodies (~3k lines)
  • Added Opera to the list of supported browsers
  • Successfully tested on all 4 most used browsers : Chrome, Firefox, Opera and Internet Explorer last versions

I added a small video for seeing the main functionalities in action. You can find it in the "How it works section".

If the forum forbid "inline" video links :

http://youtu.be/nTeGyGpCajc

I guess I will focus more on the website now, I need to deeper my knowledge on liquid layouts ! :D

Happy Gaming Folks !

TowerFun

post-5651-1359850821.jpg

Share this post


Link to post

Hi Folks,

Just wanted to share with you the first draft of the future Optimizer liquid WebSite I'm working on.

The mockup contains the Optimizer logo (which represents the 6 elements and basically what it does) the general liquid layout and key objects like the Towers Selector, buttons, checkboxes etc... It is not final yet but "showable" I guess.

It has been done with Gimp 2.8 and contains more than 100 layers.

Hope you like it.

I'm working on Foundation3 at the moment, seems a nifty framework...

Happy gaming!

TF

post-5651-1360268740.png

Share this post


Link to post

Hello,

I'm still working on the Optimizer ATM when I do have time. Responsive website building is a bit tedious but I'm getting through.

Attached you can see screenshots of the optimizer page in full-screen resolution and as it looks like on handies like IPhone.

When I'll judge it ready, I'll post the first version on the DEV website. It's still nowhere near I want it to be yet, but well it evolves ;).

Comments welcome.

Cya.

post-5651-1361276420.png

post-5651-1361276429.png

Share this post


Link to post

Man, with the rate of things you're adding and expanding upon for this, I can't help but think that Karawasa secretly hired you to build a new EleTD Flash version of the game, lol.

Share this post


Link to post
Man, with the rate of things you're adding and expanding upon for this, I can't help but think that Karawasa secretly hired you to build a new EleTD Flash version of the game, lol.

That is smart ;).

For the moment I use this project for learning purposes, there is no arrangement between Karawasa and me today.

That being said, I'm open to discussion. I'm sure that some new projects would be fun to do and would bring the interest of other people... Personally I got some ideas for the future.

Wait and see.

Share this post


Link to post

Hello there,

Small update to show you one of the upcoming features : The Minimap! (see attached pic)

I think I will be able to upload the 1st version soon as I am fixing everything up one at a time.

Note that I'm doing this on my free time and this is only a first step. But, it's still important to me to show off quality and to increase it iteratively. More will come but I keep it for me ATM ;).

Moreover, I would be very interested if people wanted to be beta testers on that little project. Ofc, all contributing people will have his or her name cited in the credits!

Thx for all the good comments are they private or not, it helps me a lot =].

Cya soon for the next release folks!

post-5651-1361372474.png

Share this post


Link to post

×
×
  • Create New...