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
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by Jasoco »

I just implemented multiple main character support.
ALDL6.png
ALDL6.png (30.86 KiB) Viewed 327 times
Each one can have its own appearance sheet. In this case we have Haley and Kaylee. Bestest friends forever. Or something. I can switch between them by pressing P and the camera switches to the current one. This will be useful for games where you want a story that takes place from the viewpoint of multiple characters and you want to switch between them at will.

I'll have to figure out the loading and changing of maps in the chance the other players are somewhere else in the world now.

Eventually my updates will be in a new official thread for the new engine. This thread will end. (I might have someone lock it or something once I get the new thread up) Once I get something good in place.
User avatar
slime
Solid Snayke
Posts: 3134
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by slime »

This is looking great! Two things though: normalize your movement vectors, and consider using spritebatches to draw the game word where possible. :)
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by Jasoco »

slime wrote:This is looking great! Two things though: normalize your movement vectors, and consider using spritebatches to draw the game word where possible. :)
What? Is that like reticulating splines? And I don't know spritebatches yet. I use Quads.
User avatar
slime
Solid Snayke
Posts: 3134
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by slime »

See here or here (scroll down until the "normalization" sections). Without normalizing them you move 1.41x faster diagonally.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by TechnoCat »

I'm pretty sure he is just telling you to make your diagonal movements the same speed as your up/down/left/right movements.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by Jasoco »

Ah. Yes, that makes sense. It is part of the plan. I've always added the same speed to the horizontal as I add to the vertical when moving both right and down at the same time. Many people don't think to fix that.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by Jasoco »

Until I figure out what the correct multiplier should be or I rewrite the movement functions, I'm using player speed * 0.8 when moving diagonal. I assume this isn't exactly correct. What would the correct value be for moving 45º?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by bartbes »

That sounds like it's approaching sqrt(2), which is approximately 0.74.
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by Kadoba »

I use these movement functions for my game objects. Feel free to use them if you want.

Code: Select all

local math = math

-- Moves the object to the relative location
function BaseObject:move(x,y)
	self.x, self.y = self.x + x or 0, self.y + y or 0
end

-- Moves the object to the absolute location
function BaseObject:moveTo(x, y)
	self.x, self.y = x or self.x, y or self.y
end

-- Moves the object towards the given location
function BaseObject:moveToward(x, y, speed)
	if self.x == x and self.y == y then return false end
	local dirx, diry = x - self.x, y - self.y
	local hyp = math.sqrt(dirx*dirx + diry*diry)
	if hyp > speed*2 then
		self:move(dirx/hyp*speed, diry/hyp*speed)
	else
		self:moveTo(x,y)
	end
	return true
end

-- Moves the object towards the direction (in degrees counterclockwise from the positive x axis)
function BaseObject:moveDir(dir, speed)
	local x = math.cos(math.rad(dir))
	local y = math.sin(math.rad(dir))
	self:move(x*speed, -y*speed)
end
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine - GIT friendly since 2010!

Post by Jasoco »

bartbes wrote:That sounds like it's approaching sqrt(2), which is approximately 0.74.
Thanks. I'll use that for now. The players certainly move diagonally more realistically now.
Kadoba wrote:I use these movement functions for my game objects. Feel free to use them if you want.
Looks exactly like what I was looking for. I'll see if I can implement that method tomorrow. Thanks!


I've added the beginnings of a 2-player mode where you can control both characters at once. I might add up to 4 at some point, but for now 2 will be enough to play with. Since I want this engine to be versatile, I want to be able to have the option to do anything. Want it to be a Zelda or RPG? There it is. Want it to be an arcade style 2-player collect-a-thon game or something like Bomberman? There it is.

Right now as the players move around, if the map is scrollable, the camera will be centered between them. Like how it does it in those multiplayer games like Smash Brothers, NEW Super Mario Bros. and those online Super Mario X games. It doesn't zoom though for obvious reasons. But I might look into a way of splitting the screen if the players get too far apart, but I will probably just end up preventing the players from leaving the bounds of the screen when they move too far apart, so you have to work together.

I also have a bunch of enemies wandering around. There's no overlap detection yet, but it's on the way.
OgZxJ.png
OgZxJ.png (33.85 KiB) Viewed 326 times
Post Reply

Who is online

Users browsing this forum: No registered users and 55 guests