LoveTank - Soft Launch

Show off your games, demos and other (playable) creations.
Post Reply
Ramcat
Prole
Posts: 18
Joined: Sun Jun 01, 2014 12:12 am

LoveTank - Soft Launch

Post by Ramcat »

Let me start by saying we love LÖVE2D. Wonderful framework and whoever took the time to create something so great and release it to the world is truly kind and worthy of praise.

That said, we'd like to announce the "soft" launch of LoveTank. Basically a "game" where you write the code to control your piece in the game. Who are "we"? Well I am Ramcat (duh) and the other developer on this project does not have an account here. He can announce himself if he wants to.

The purpose of this launch is to get some feedback from more talented Love2D developers/users.

The zip file uploaded is the latest functional code. The game is currently under a minor re-write to allow the user to select which tanks are going to participate in the battle.

Edit: The minor re-write is over and the improvements suggested by those below have been implemented (thanks again) and now we have a .love file. The selector screen is without instruction and very basic but I wanted to get something up quick. I do not know how to tell how big a given piece of text will be when rendered so that is a minor setback.

Edit: The StageManager is in, instructions on how to add your own tanks coming soon. Basically copy out a "player-XXXX.lua" file from the .love file and add it to your APPDATA folder and LoveTank should see it. Edit the code (or replace all but the framework) and the tank is yours. I'd change the name too, but that's just me.
Attachments
LoveTank.love
Implements StageManager
(22.02 KiB) Downloaded 240 times
LoveTank.love
New and Improved
(19.47 KiB) Downloaded 249 times
LoveTank.zip
Old don't use.
(95.45 KiB) Downloaded 189 times
Last edited by Ramcat on Fri Jun 13, 2014 5:31 am, edited 2 times in total.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: LoveTank - Soft Launch

Post by Davidobot »

Very interesting idea. Though, I needed to rename "Main.lua" into "main.lua" for the game to work. Otherwise, keep up the good work!
Also, check out trAInsported
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
CaptainMaelstrom
Party member
Posts: 161
Joined: Sat Jan 05, 2013 10:38 pm

Re: LoveTank - Soft Launch

Post by CaptainMaelstrom »

Welcome to the community!

I booted up the simulation and watched it go until there was only one tank standing. The concept kinda reminds me of this old website called botbattles.net (or something like that).

Some tips:

1.) Don't include .xcf's in your distribution. They can get pretty heavy and your game will only ever need the .jpeg/.png or whatever. Keep diagrams and development files not directly needed out of the source folder.

2.) You'll get more attention around here if you package your game in a .love that opens the game for us when we double-click it. I had to rename Main.lua to main.lua and package the .love myself, not everyone is that patient. See: http://www.love2d.org/wiki/Game_Distribution

3.) For OOP, you should use a library (aka module) that somebody else has already developed. I recommend

30log: http://www.love2d.org/wiki/30log
middleclass: http://www.love2d.org/wiki/MiddleClass
hum: http://www.love2d.org/wiki/HUMP

While you're at it, check out some more libraries here (http://www.love2d.org/wiki/Category:Libraries) that might be helpful. Why? It means you get to use helpful features, spend less time debugging boring code and more time implementing cool stuff for your game.

4.) Holy wow. You're update function is about 300 lines long and in some places, 10 or 11 indents deep. It's impressive that you can develop on a codebase like that--you must have a lot of patience. As your project grows though, you're going to need to start encapsulating stuff better. Focus on writing smaller functions and re-using them. If you see a lot of code duplication, that's a sign you should write a function for whatever it is you keep doing. Also, instead of having the game loop check for collisions for each entity, have it give a list of things that are close to each entity to each intentity. Then you can call Bullet:collide(object) or Tank:collide(object) with each entity.

You should also make sure the Tank does it's own movement Tank:move(x,y) etc. And that objects keep they're own state (speed,angle,whichTankFrom, etc.)

Hope this advice helps.
User avatar
Cryogenical
Prole
Posts: 49
Joined: Mon Apr 28, 2014 5:23 pm

Re: LoveTank - Soft Launch

Post by Cryogenical »

CaptainMaelstrom wrote:Welcome to the community!

I booted up the simulation and watched it go until there was only one tank standing. The concept kinda reminds me of this old website called botbattles.net (or something like that).
-snip-
A bit off-topic here, but the site was probably BattleBots. They also had a show with live competition, and that was the greatest shit for a long time.
Ramcat
Prole
Posts: 18
Joined: Sun Jun 01, 2014 12:12 am

Re: LoveTank - Soft Launch

Post by Ramcat »

Thank you for the input and advice. I will update the first post with a .love file when I get the next part working. I do appreciate a good conversation about code and architecture. Not sure about the standard practices of this forum (of course I have read the rules) or the etiquette, so I hope to not offend.

@CaptainMaelstrom
Thank you for your thoughts.

#1 Done. I split the project into a "Design" and "Project" folder. And built a .love file.

#2 Yeah, I was hoping I could use a manifest or something to keep the file name Main.lua, as class names IMO should be capitalized and their files names should too. Oh, Microsoft, why have you abandoned your standards?

#3 Er? We thought we did. We're multilingual Software Engineers who primarily work in Java, to do objects in Lua we looked up resources online to figure out how to do it. We were proud of ourselves to do dynamic code loading, objects, and player code that needed to know nothing about Love2D (other than it's Radian orientation) to run parts of the simulation in our first project.

#4 There are a lot of points in that one. Let me start at the most complicated bit. The Tank class loads the "player" code, the player code gets told the state of all the objects it can see in the arena (the other tanks) and the player makes his moves. Because we don't want the player to be able to make a faster tank than someone else the player code can only provide the speed they want to go or rate they want to turn at. The game code checks to see if these are within the limits and updates the Tank representing the players code accordingly. Ok, as I was typing this response I think I see what you're saying - move that validation code and update code to the tank instead of the main loop. Fair point. As for state, each Tank does keep it's own state, although the game loop is updating that state frequently, I believe you're suggesting we move that update/processing code to the Tank class itself.

On the other topic: http://robocode.sourceforge.net/ was our inspiration. There is a minor influence from http://stonehearth.net/ to make something moddable. Another motivation was to provide a platform for people to learn to program in Lua, as all you need to learn is Lua to program a Tank for LoveTank.

There is more I want to say but it is a long post already.
User avatar
CaptainMaelstrom
Party member
Posts: 161
Joined: Sat Jan 05, 2013 10:38 pm

Re: LoveTank - Soft Launch

Post by CaptainMaelstrom »

@Cryogenical

I remember it being distinctly different from BattleBots, that's why I'm thinking botbattles.net haha. Maybe they're related in some way I don't know of.

@Ramcat

#3: Oh, I just assumed you developed the OOP part yourself since I wasn't familiar with the actual source I saw and I didn't see a license or other author section.

#4: I see what you mean now about the tank actually keeping it's own state, so that's good. And yeah, I still think ideall you should have something like:

Code: Select all

function love.update(dt)
    for i,tank in ipairs(tanks) do
        tank:update(dt)
    end
end

function Tank:update(dt)
    --move tank if appropriate
    --check for collisions
    --fire if timer is up
end
And depending on how complex the collision code is, maybe have a collider class each tank and possibly bullet has:

Code: Select all

tank.collider = Collider('rectangle')
bullet.collider = Collider('circle')
All this for the reason being that each class should do ONE thing only. Maybe TWO things, but only if those two things fall under an umbrella. Classes that do a lot of things tend to make debugging harder. At least that's my experience. Especially as my project sizes have grown, I've had to start organizing my codebase a lot more.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: LoveTank - Soft Launch

Post by substitute541 »

Very interesting concept. It's used before on trAInsported as mentioned by davis, but building an AI to manage freely moving tanks battling other tanks is a harder challenge for the players/programmers (if you leave the pathfinding part in trAInsported, it's actually quite simple.) Also, you may want to store player's AI in the AppData folder so people can easily access it (without having to dissect the love to put a new tank in.)

Is this on Github? I'd love to contribute on this, though probably only on code organization and fancy GUIs. I'd leave the fun stuff to you guys.
Currently designing themes for WordPress.

Sometimes lurks around the forum.
Ramcat
Prole
Posts: 18
Joined: Sun Jun 01, 2014 12:12 am

Re: LoveTank - Soft Launch

Post by Ramcat »

@Davidobot
Yeah, that is a cool train simulator!!

@substitute541
There is the complicated part about making a .love file for distribution. The code already reads tanks from the .love file and the AppData folder. In addition to distributing the .love file we need to distribute a Tank template (actually Player-XXX.lua template) and a ReadMe.txt file to explain how to code a tank. I don't see a good way to do that, other than the two obvious methods, a zip file or an actual installer.

Installers are a piece of cake (NSIS) but part of the attractiveness of Love2D is not having the need to write an installer. And a .zip file has all the inherent problems of trust (is there a virus hiding in there).

Would love some suggestions on how you guys would do that.

It's not on github. We didn't have plans to but... you never know.

@CaptainMaelstrom
Hmmm... colliders, have to look into that.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: LoveTank - Soft Launch

Post by substitute541 »

Ramcat wrote:@Davidobot
Yeah, that is a cool train simulator!!

@substitute541
There is the complicated part about making a .love file for distribution. The code already reads tanks from the .love file and the AppData folder. In addition to distributing the .love file we need to distribute a Tank template (actually Player-XXX.lua template) and a ReadMe.txt file to explain how to code a tank. I don't see a good way to do that, other than the two obvious methods, a zip file or an actual installer.

Installers are a piece of cake (NSIS) but part of the attractiveness of Love2D is not having the need to write an installer. And a .zip file has all the inherent problems of trust (is there a virus hiding in there).

Would love some suggestions on how you guys would do that.

It's not on github. We didn't have plans to but... you never know.

@CaptainMaelstrom
Hmmm... colliders, have to look into that.
trAInsported stores the AI documentation inside the .love file and their website, if people are less technical (though if someone has the time to learn how to learn to program AI, they should be able to extract the doc from the .love file.)

If you have a Github, you can just store the docs in the wiki too.

You'll need to use a zip file sometime or another though, because you'll need to package a distribution for all possible OSes (not everyone has LOVE installed.)
Currently designing themes for WordPress.

Sometimes lurks around the forum.
Ramcat
Prole
Posts: 18
Joined: Sun Jun 01, 2014 12:12 am

Re: LoveTank - Soft Launch

Post by Ramcat »

A new version of LoveTank has been added to the first post mostly because we added a UI framework to make the game easier to code. Soon to wrap the .love file in a zip that contains all the templates and instructions you need to create your own tanks. Of course, that is leading up to the full launch of the game.
Post Reply

Who is online

Users browsing this forum: No registered users and 73 guests