Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Million Tile Engine Beta Release
Started by dyson122 Mar 25 2013 12:15 PM

568 replies to this topic
tile tiles lightning blazing engine tile engine
[TOPIC CONTROLS]
« Page 5 of 23 3 4 5 6 7 »
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#101

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

I'm dizzy!  :)  That was amazing!!! Great work. 



[TOPIC: post.html]
#102

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

Whoa! Just whoa!



[TOPIC: post.html]
#103

AlanPlantPot

[GLOBAL: userInfoPane.html]
AlanPlantPot
  • Contributor

  • 733 posts
  • Corona SDK

Looking good.

 

I have a quick question about the flipped and rotated tiles. It seems that if a tile is flipped AND rotated MTE isn't sure what to do with it. Most of my tiles appear as they should, but a few of them are orientated incorrectly.

 

Have we done something wrong or is this a known problem?



[TOPIC: post.html]
#104

igenapps

[GLOBAL: userInfoPane.html]
igenapps
  • Enthusiast

  • 66 posts
  • Corona SDK

Hi, I am not sure this is related to the topic here, let's see

 

I am using a tile as a background as follows

 

 
    for i=1, 500 do
        local img=display.newImageRect( backgroundGroup, "assets/images/menuTypeBackground.png", 320, 2 )
        img:setReferencePoint(display.TopLeftReferencePoint)
        img.x=0
        img.y=i*2
    end
 
The problem is that it takes a lot of time to generate it.
 
May this Tile Engine help in achieving that more efficiently?
 
Thanks, and great work. Looks promising


[TOPIC: post.html]
#105

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

@AlanPlantPot; Thanks for bringing that to my attention. It seems I left out a few of the flip/rotate commands. I'll have a new update out to address the problem by the end of the day.

 

@igenapps; I don't think so igenapps. Loading 500 individual images will take a certain length of time whether you do it or MTE does it for you. I think you should look at using an imageSheet. Instead of 500 image loads there would be only one, and your loop would merely be loading frames from the imageSheet instead of individual image files. This might speed things up for you.



[TOPIC: post.html]
#106

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

MTE v0.821 - http://gum.co/staO

 

Fixes a problem with the detection of tiles which have been both flipped and rotated. Update emails have gone out to all current customers.



[TOPIC: post.html]
#107

igenapps

[GLOBAL: userInfoPane.html]
igenapps
  • Enthusiast

  • 66 posts
  • Corona SDK

@dyson122

Thanks for your help, but I don't really understand the difference. I thought when an image had been loaded once, it was kept in memory so reusing it should not require the time to load it again. What you suggest is something like:

 

 
for i=1, 500 do
        local img=display.newImage( imageSheet, frameIndex )
        img:setReferencePoint(display.TopLeftReferencePoint)
        img.x=0
        img.y=i*2
end
 
I actually tried it and it seems to be a lot faster, but I would like to understand the reason.
 
Thanks!


[TOPIC: post.html]
#108

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

I don't know exactly what is causing the speed difference you're seeing, but when you think about it, a frameIndex is a number while a filename is a string. In order to load a frame from an imageSheet, Corona need only process numbers, which is easy. In order to load a cached image Corona must compare the filename you gave it to the filename of the image, and comparing strings is much more expensive. There are probably other contributing reasons, but none come to mind. 



[TOPIC: post.html]
#109

igenapps

[GLOBAL: userInfoPane.html]
igenapps
  • Enthusiast

  • 66 posts
  • Corona SDK

That makes sense.

Thanks dyson!



[TOPIC: post.html]
#110

lukestirk

[GLOBAL: userInfoPane.html]
lukestirk
  • Enthusiast

  • 37 posts
  • Corona SDK

Hi, I just purchased this library. Is it possible to scroll around the map on touch and to do pinch zoom? I want to zoom in slighty on my map and be able to scroll around with my finger and zoom in / out



[TOPIC: post.html]
#111

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

Sure, you could easily accomplish all of that using a couple multitouch events and MTE's moveCamera() and zoom() functions. I don't have any pinch-to-zoom code examples on hand, but I talk about how to implement touch-based scrolling in this post: http://forums.coronalabs.com/topic/33119-million-tile-engine-beta-release/?p=176172



[TOPIC: post.html]
#112

AlanPlantPot

[GLOBAL: userInfoPane.html]
AlanPlantPot
  • Contributor

  • 733 posts
  • Corona SDK

Just letting you know that the last update fixed our flip+rotate issue.

Thanks!



[TOPIC: post.html]
#113

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

Good to hear, AlanPlantPot!

 

To those of you interested in pinch zoom and touch scroll, I've modified the main.lua of CastleDemo to demonstrate one way to accomplish these behaviors. To try it out rename or delete main.lua from the CastleDemo 0v821 project folder and replace it with this new file: https://docs.google.com/file/d/0B8zoywKO40aibnpuVDQ0RjRsbDA/edit?usp=sharing

 

The implementation is a slightly modified version of the Corona sample code available here: http://developer.coronalabs.com/content/pinch-zoom-gesture



[TOPIC: post.html]
#114

lukestirk

[GLOBAL: userInfoPane.html]
lukestirk
  • Enthusiast

  • 37 posts
  • Corona SDK

How does removeSprite work? I get an error mte.lua:754: attempt to index field '?' (a nil value). Obviously doing something wrong and I cant find an example of this

 
			local setup = {
					kind = "sprite", 
					layer =  mte.getSpriteLayer(1), 
					locX = pos1, 
					locY = pos2 - 1,
					levelWidth = 24,
					levelHeight = 24
					}
			tower1sprite = mte.addSprite(tower1, setup)
			mte:removeSprite(tower1sprite)

 



[TOPIC: post.html]
#115

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

The correct syntax uses a period, not a colon, between mte and removeSprite(). 

 

"mte:removeSprite(tower1sprite)" should be "mte.removeSprite(tower1sprite)"



[TOPIC: post.html]
#116

icodemarine

[GLOBAL: userInfoPane.html]
icodemarine
  • Observer

  • 19 posts
  • Corona SDK

I have a requirement to be able to stop a moving sprite after having called moveSpriteTo().

 

I looked at Update() and it has the below snippet of code:

 

local spritesFrozen = false
local cameraFrozen = false
local tileAnimsFrozen = false
local update = function()
    for i = 1, #map.layers, 1 do
        isMoving[i] = false
    end
    
    if not spriteFrozen then
 

 

 
Notice that the variables are spritesFrozen (with an S ) and spriteFrozen (no S). I can set spriteFrozen and that stops all sprites from moving, but I really just want to stop one so I did this:
 
local cancelSpriteMoveEx = function(sprite)


--spriteFrozen=true
if movingSprites[objects[sprite]] == objects[sprite] then


local s = movingSprites[objects[sprite]]
s.isMoving=false
s.deltaX = nil
s.deltaY = nil
movingSprites[objects[sprite]] = nil
end




end
M.cancelSpriteMove = cancelSpriteMoveEx
 

 

Which seems to work and so far hasn't caused any issues.
 


[TOPIC: post.html]
#117

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

Nicely done! If you don't mind I will include this in the next release of MTE so everyone can take advantage. 

 

With the start of this week I continue to work on iso projection and iso maps. I'll keep everyone posted.



[TOPIC: post.html]
#118

icodemarine

[GLOBAL: userInfoPane.html]
icodemarine
  • Observer

  • 19 posts
  • Corona SDK

Yes, feel free to include / modify / etc.



[TOPIC: post.html]
#119

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

EDIT: This post contains experimental features which are not a part of MTE.

 

 

Experimental MTE functionality.



[TOPIC: post.html]
#120

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

I've said it once before - but WHOA! Dyson you are a genius!



[TOPIC: post.html]
#121

codingcake

[GLOBAL: userInfoPane.html]
codingcake
  • Contributor

  • 124 posts
  • Corona SDK

 WHOA!!!   this is really great !!!

  Is this function release??



[TOPIC: post.html]
#122

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

Thanks SegaBoy and codingcake!

 

Not yet, codingcake. There is still much work to do before it is ready for use. I suspect this is going to be the kind of functionality most useful on newer/stronger devices like the iPad2+ or the newest generation of iPod Touch given how demanding it is on the hardware. 



[TOPIC: post.html]
#123

SegaBoy

[GLOBAL: userInfoPane.html]
SegaBoy
  • Contributor

  • 635 posts
  • Corona SDK

Hey Dyson - quick question. Are you still thinking about incorporating physics into MTE? The reason I ask is that I'm currently working on a top-down game with stealth mechanics and using Box-2D Raycast feature would make calculating line-of-sight a lot easier then what I'm currently trying.

 

Be interested if you had any opinion on what would be the best way to go - at the moment I'm just confusing myself with trig, Bresenham's algorithm, etc... :)

 

EDIT

 

And another question.... 

 

I thought I had this implemented into MTE, but it must have been another tile engine. I'm trying to incorporate A* functionality and in order to do so I need to expose the grid as a 2D array, which I can then check the tile properties (isObstacle). I have tried to use GetMap(), but I can't seem to locate this data structure?!? Does MTE expose this data structure in any way that I might be able to use?

 

Got it .world :)



[TOPIC: post.html]
#124

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Contributor

  • 590 posts
  • Corona SDK

s2q.png

 

Physics integration is a work in progress at the moment. Here we see the player casting rays at his surroundings. Impacted tiles are tinted red.



[TOPIC: post.html]
#125

Danny

[GLOBAL: userInfoPane.html]
Danny
  • Corona Geek

  • 2,597 posts
  • Corona Staff

Dyson, keep up your great work on this. It gets more impressive every week :)




[topic_controls]
« Page 5 of 23 3 4 5 6 7 »
 
[/topic_controls]

Also tagged with one or more of these keywords: tile, tiles, lightning, blazing, engine, tile engine