Few questions about "Turn based Strategy" with interface

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Highjhacker
Prole
Posts: 6
Joined: Mon May 19, 2014 5:21 pm

Few questions about "Turn based Strategy" with interface

Post by Highjhacker »

Hello guys, this is my first post on this forum so, hello Löve community !

I'm new in Lua, just started a couple of days ago, and I would like to create 2D games using Löve framework cause the syntax and the code in general is pretty to me, the community seems nice and helpful, and it's very likeable to be able to make a simple character's move with only a couple of lines.

My question is simple ; Is it possible to make a game like this : http://screenshots.en.sftcdn.net/en/scr ... orld-5.jpg with Löve, with ou without using any extern lib ? Cause I've seen many games made with Löve, but none of them seems to look like this.

Also, could you give me a few tips about the interface ? I understand how the game works, but I don't know how to make an interface like Drug Wars'. Probably not with a tile editor

Ty in advance for your answers ! (And sorry for my bad English, it's not my native language)
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Few questions about "Turn based Strategy" with interface

Post by Roland_Yonaba »

Hi,

Welcome to LÖVE.
I don't know this specific game, but I see what kind of game it is.

Is it possible to write it with LÖVE ?
I'll say "definitely yes".

Without using any extern lib ?
I'll say, again, "definitely yes", but obviously, the UI is going to be a problem. LÖVE doesn't have a built-in UI, so you will have to shape your own. There are some very nice GUI for LÖVE, that you might want to consider including as third-parties libraries. See LoveFrames and Quickie, for instance, and this list of Libraries to find some others.

In my opinion, the only difficult thing here is not going to be the interface, but rater writing the game logic and core mechanisms so that the gameplay looks realistic enough and challenging to the player. So it doesn't really matters to ask yourself if LÖVE can it. Instead, ask yourself if you can do it.
And, at the same time, why do you absolutely want to avoid using external libs ?
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Few questions about "Turn based Strategy" with interface

Post by josefnpat »

Drug wars was a great game! I remember playing that game for ages.

You should be able to make a version of it in love. If you want to imitate the window style, I would suggest using LoveFrames, otherwise consider using states (hump.gamestate?)
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Highjhacker
Prole
Posts: 6
Joined: Mon May 19, 2014 5:21 pm

Re: Few questions about "Turn based Strategy" with interface

Post by Highjhacker »

Hi, ty for your reply and thank you for the links, I would look at it later, I had seen earlier in the day the github of LoveFrames :D

Yes, the game's mechanics can be hard to learn, but I have a lot of time to understand all of it and I also dispose of some existing sources of similar games, so I think I'm going with good bases, my main problem will certainly to fully understand how Löve and Lua works because I'm just starting.

And it's precisely why I would avoid lib, but I'm not totally closed to this idea, lib can save a lot of time, so I throw a look anyway.

I had the opportunity to view the source of some games on this forum just to see a begin of an interface, but just some menus, but I think this gonna help later anyway (At this time, i'm juste able to draw a rectangle who move's and jump haha, so ALL is helpful)

But what I find interesting with this style of games, is that it run with any configuration also a possibility of multiplayer etc..

And if I can do it ? Hmm, actually, no idea, I'm really bad in maths but I have a lot of motivation and help across the web, so, I think it's possible.
Highjhacker
Prole
Posts: 6
Joined: Mon May 19, 2014 5:21 pm

Re: Few questions about "Turn based Strategy" with interface

Post by Highjhacker »

Hey, it's me again, I have a quick question about LoveFrame, I have this code (it's my first step, I read the documentation at this time)

Code: Select all

function love.load()
  require("lib.loveFrame")
end

function love.update(dt)
    
    loveframes.update(dt)
 
end
                 
function love.draw()
    -- your code
    
    loveframes.draw()
 
end
 
function love.mousepressed(x, y, button)
 
    -- your code
 
    loveframes.mousepressed(x, y, button)
 
end
 
function love.mousereleased(x, y, button)
 
    -- your code
 
    loveframes.mousereleased(x, y, button)
 
end
 
function love.keypressed(key, unicode)
 
    -- your code
 
    loveframes.keypressed(key, unicode)
 
end
 
function love.keyreleased(key)
 
    -- your code
 
    loveframes.keyreleased(key)
 
end

function love.textinput(text)
             
    -- your code
 
    loveframes.textinput(text)
 
end
And I want to draw a button, so for example like this :

Code: Select all

local button = loveframes.Create("button")
button:SetPos(10, 10)
Where I'm suppose to put him ? My logic would tell me to put this code in love.update so that the button's displayed at each frame, but it's seems to go as well in love.load or love.update or love.draw, the only difference I see is that seems interactive in love.load but not in love.update or love.draw (it's a very noobish question but I want to be sure, I hope I'm clear, again, sorry for my bad english)

Edit : Next question, after that I'm ready to start I promise ! :D

I look after the template's system, and I try one, so I make a new .Lua file named "template.lua" with this code :

Code: Select all

local template = {}
	  	template.name = "Button"
		template.properties = {}
			template.properties["button"] = {
				width = 200,
				height = 50
				}
				
loveframes.templates.Register(template)
After that I go in main.lua and require template.lua In love.load() function..and after that ? How I display this template ? The documentation don't explain that, maybe it's so simple they can think like a noob like me :p

Ty in advance
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Few questions about "Turn based Strategy" with interface

Post by Roland_Yonaba »

Let us break this into pieces.
You want to create one button. And then, draw it.
The button has to be created once. So that would fit perfectly in love.load.
And in the same callback, you can set the button's position. All of this has to be done once.

Internally, the library keeps track of evevy GUi component you creates. Then it can iterate through everything each cycle to update them and draw them without having you to do it manually. So simply call loveframes.draw() in love.draw() and loveframes.update() in love.update() to get everything drawn and updated.

Basically, that shoud do:

Code: Select all

require("loveframes")
local button

function love.load()
  button = loveframes.Create("button")
  button:SetPos(10, 10)
end

function love.update(dt)
  loveframes.update(dt)
end
                     
function love.draw()
  loveframes.draw()
end
I will suggest, since you are new to LÖVE, taking a look at the wiki tutorials, and LÖVE callbacks.
Highjhacker
Prole
Posts: 6
Joined: Mon May 19, 2014 5:21 pm

Re: Few questions about "Turn based Strategy" with interface

Post by Highjhacker »

Ok, I get it, it's quite simple, shame on me :$ And a big thank your for your patience and your answers.

Can you take a look at my precedent post ? I've edit him because i've a new question about the template :p again, it's simple I guess, but the documentation don't tell how to, so I look in the code of the .love file demo, but i'm a little bit lost haha :p
Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 4 guests