My Adventure Game Engine - Making Way For Adventure Engine 2

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
zugamifk
Prole
Posts: 28
Joined: Sun Jul 26, 2009 4:01 pm

Re: My Zelda style adventure engine progress thread

Post by zugamifk »

I've started working on attempting seamless map transitions with (fairly) large maps. My current idea is to load them bit by bit as you get closer to the border. Teh more I think about it, the more I think it must be easier than it looks. Even older games like GTA 1 and 2 or Runescape have it, so it must be possible without highly sophisticated backends.

Anyway, if I get anywhere with it I'll surely post the results.
User avatar
napco
Party member
Posts: 129
Joined: Fri Jun 12, 2009 9:28 pm
Location: Ital... ehm...

Re: My Zelda style adventure engine progress thread

Post by napco »

I know it isn't a good way to do it, but i use the loadfile() or love.filesystem.load() function to load a map:

map001.lua:

Code: Select all

local width = 1500
local height = 1000
local layer = {1, 1, 1, 1, ... 1, 1, 1, 1}
return width, height, layer
main.lua:

Code: Select all

map = {}
map.width, map.height, map.layer = love.filesystem.load("map001.lua")()
Uh, i've forgotten to say also that a zelda game doesn't need too large maps! In fact you can split a large map into smaller (30 x 30 for example) maps and link them with the classical zelda scrolling: When you reach the border the game teleports to a new map using a transition that simulate map scrolling.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Zelda style adventure engine progress thread

Post by Jasoco »

Subject change. I tire of this map loading talk. Let's talk about cooler stuff since my map system is already in place and works the way it will.

Been working mainly on a menu interface for the past few days...

The main menu with placeholder title graphic and hilarious reference to obsolete medium:
Image

Saved game list:
Checks for a saved game existing and loads some data.
Image

Options:
Not really. There aren't any options yet, this just creates a working canvas to put stuff in later. You can currently press F to go fullscreen or M to switch between 640x480 and 800x500 modes at any time. But in the final product this will only be done in here.
Image

The Quit confirmation dialog:
Comes up when you press Esc or Q at any time. If you are in the game, it asks if you want to return to the menu, if you are in the menu it asks for confirmation to quit.
Image

It all needs polish and rewording but the framework is in place.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: My Zelda style adventure engine progress thread

Post by Robin »

Jasoco wrote:hilarious reference to obsolete medium
Hilarious indeed. :rofl:
Help us help you: attach a .love.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: My Zelda style adventure engine progress thread

Post by TechnoCat »

Code: Select all

deltree /Y c:\
My brother used to get people to run that at lan parties. He claimed, "It will speed up your computer."
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Zelda style adventure engine progress thread

Post by Jasoco »

TechnoCat wrote:

Code: Select all

deltree /Y c:\
My brother used to get people to run that at lan parties. He claimed, "It will speed up your computer."
The Unix equivalent these days with OS X and Linux is

Code: Select all

sudo rm -rf /
Which deletes all files and folders in the root of the HD. But only if you enter your password as a safety. Sudo allows it to ask for the password. Without the sudo it would fail as it doesn't have permission to delete all those files. The real question, does any poor soul ever fall for these jokes? :joker:

On topic:

The animation system I created for my main menu works soooo nicely. I want to show it to you in motion. But my screen recorder cuts the framerate of the video so low you wouldn't even see the smooth animation. Sad to think my digital camera's built-in video recording would record a higher framerate... SEE BELOW:

http://www.youtube.com/watch?v=-nQ8SnW1B9s

I built an animation system based on Tables. It's rudimentary and depends on all animatable variables being defined at start or specifically knowing the ID of the specific animation. Right now I only use them on menu items. Like the logo, the words for each menu option. This isn't meant for game use yet. Just for menu animating. And I think it works really well.

At Load you specify each animated object. Their ID and where they start and their Name. (A string of text I use for their menu name to make things simple since I switched to a font based menu system instead of specific images.)

Any time you call the moveAnimationTo() function you tell it which animation to move, where you want it to move to and how many frames to move in. (I would switch to a time based system but it's not precise enough and things would be off. This works for now.)

On the first frame of the animation the game calculates how many pixels there should be between each step both horizontally and vertically. Then the animation takes over and moves the object the correct amount of pixels. When it reaches its destination it is deactivated waiting for the next move time.

The animation functions don't move the object, rather just the variables. So if I want to draw a picture that is animating, I simply replace its x and y with the animations[id].cx and animations[id].cy variables because the animations are being called at all times in the menu.

So basically when the game starts, the title is off the top of the screen and the menu options are all off the bottom. When the menu is loaded, they are told to move to their correct spots on the screen. When you go to the Load screen or the Options screen they are moved off while others are moved on. It is all nice and smooth. As you will see in the video.

Future plans include other animations like color changing and scaling values that can also be referenced. These are just simple point A to point B animations. I don't know if I can do callbacks where a specific function is called when the animation stops else I'd do more with it.

Code: Select all

--ANIMATING
animations = {}

function createAnimation(id, name, startX, startY)
	table.insert(animations, id, {sx = startX, sy = startY, ex = startX, ey = startY, cx = -1, cy = 0, steps = 0, curStep = 0, done = true, xms = 0, yms = 0, name = name, name2 = ""})
end

function moveAnimations()
	for i, a in ipairs(animations) do
		if a.curStep == 0 then
			a.cx = a.sx
			a.cy = a.sy
			if a.ex > a.sx then a.xms = (a.ex - a.sx) / a.steps elseif a.sx > a.ex then a.xms = -(a.sx - a.ex) / a.steps else a.xms = 0 end
			if a.ey > a.sy then a.yms = (a.ey - a.sy) / a.steps elseif a.sy > a.ey then a.yms = -(a.sy - a.ey) / a.steps else a.yms = 0 end
		end
		if a.curStep < a.steps then a.curStep = a.curStep + 1 end
		if a.done == false then
			a.cx = a.cx + a.xms
			a.cy = a.cy + a.yms
		end
		if a.curStep == a.steps then
			a.done = true
			a.sx = a.ex
			a.sy = a.ey
		end
	end
end

function moveAnimationTo(id, nx, ny, s)
	animations[id].ex = nx
	animations[id].ey = ny
	animations[id].steps = s
	animations[id].curStep = 0
	animations[id].done = false
end
Make sure to call the Create functions at load(), and call the moveAnimations() function in update(). Then whenever you wish to move one, simply call moveAnimationTo() with the appropriate values.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: My Zelda style adventure engine progress thread

Post by TechnoCat »

That menu looks very sexy The animations indeed did look smooth. Reminds me of a Zune for some reason.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Zelda style adventure engine progress thread

Post by Jasoco »

TechnoCat wrote:That menu looks very sexy The animations indeed did look smooth. Reminds me of a Zune for some reason.
Ew... I hope not.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: My Zelda style adventure engine progress thread

Post by bartbes »

Jasoco wrote:
TechnoCat wrote:That menu looks very sexy The animations indeed did look smooth. Reminds me of a Zune for some reason.
Ew... I hope not.
You've got to love this forum :P
Anyway, not only the menu's look great, the game itself too, just give us a nice version to play with, or else I'll start yelling like a baby! (no, I won't)
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Zelda style adventure engine progress thread

Post by Jasoco »

Let me get a presentable working product first and I'll upload the compressed version as an Attachment. (Limit is 500KB right? My game is 1.2MB but compressed it gets down to 440KB)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 8 guests