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: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine (NEW DEMO ON PAGE 18! 6/10/10)

Post by Jasoco »

Yes. It is a two dimensional array, in that each row contains each column in a grid. Most games use it, especially tile based ones. You can place any data in there you want, like what tile to display, etc.

When you want to iterate over it you do the same thing:

Code: Select all

for x=1,100 do
  for y=1,100 do
    if array[x][y] == whatever then
      DO SOMETHING!
    end
  end
end
Where 100 is the size you want the array to be in each direction. I don't suggest you go too high. It takes too long to create an array too much more than 500x500 or so. Play around and see how long it goes.
User avatar
Chucknorrisaurrus
Prole
Posts: 23
Joined: Mon Jun 07, 2010 1:00 am

Re: My Adventure Game Engine (NEW DEMO ON PAGE 18! 6/10/10)

Post by Chucknorrisaurrus »

Doesn't this mean that I will have to insert like 1,000 collision checks by hand!?!! Surely there must be an easier way? :shock:
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine (NEW DEMO ON PAGE 18! 6/10/10)

Post by Jasoco »

No. You are thinking about it the wrong way. Multi-dimensional arrays remove the need to check against all tiles. You only have to check against the four surrounding tiles. And not even that.

You would iterate through it 100 x 100 but that's only for drawing, and even then it's better to only draw the lower to upper bounds of what's actually on screen. I wrote a function to find the tiles that are actually on screen so the for/next's only run through the 442 or so tiles. Which Löve handles pretty well anyway.

Examine my code if you have to find out how it's done. It may be a lot to take in, but it might help to learn from what I've done. Or others have done.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine (NEW DEMO ON PAGE 18! 6/10/10)

Post by Jasoco »

Just cleaning up my code and fixing some problems. I discovered that the crashing problem I was having before had to do with creating a bomb, or any other projectile, outside of the walkable field. i.e. placing it on an impassable tile. I don't know why yet but I'm glad I found it. I had also had a problem with boomerangs. And I'm still having a few bugs. I need to optimize. Optimize my engine. Cut out some cruft. Fix it all up.

Just discovered a new weird bug. I changed the function of the "e" key to create randomly placed enemies all over the current map for you to defeat and to test the limits of onscreen enemies, and for some silly reason, when the enemies are on screen, you can no longer enter doors. And doors are just push switches, so for some reason when there's a lot of enemies on screen, you can't push switches. What? Boy. Bugs just keep cropping up. lol

Seems the bombs and boomerangs being projectiles was part of the problem. Since they don't behave like other projectiles. Bombs don't move and "expire" after a set amount of time. Boomerangs fly in one direction for a set distance, then reverse 180º and fly back to the player. Not sure why a bomb being in a wall was a problem. Still looking into these silly problems.

Edit: Fixed the push switch bug. Seems I was stupid and put the "check which tile is being pushed" code in the "checkCol()" function, which was also being used by every enemy. So when enemies were on screen and moving, the tile being pushed against was changing rapidly. So unless every enemy stopped moving, the player couldn't push. So I fixed it by creating a separate function to check for pushing. *phew*
User avatar
Chucknorrisaurrus
Prole
Posts: 23
Joined: Mon Jun 07, 2010 1:00 am

Re: My Adventure Game Engine (NEW DEMO ON PAGE 18! 6/10/10)

Post by Chucknorrisaurrus »

lol, it seems that every programmer has their fair share of bugs ^^
Good to know you're still working on it though. Good luck!
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine (NEW DEMO ON PAGE 18! 6/10/10)

Post by Jasoco »

I'm utilizing all the time I have while I can.

Killin' bugs. Killin' bugs.

Tweaked the collision detections a bit. Made it so if you walk to a corner, the player will slide until it can get past the corner instead of getting stuck on it. Not completely perfect yet though. Still a ways to go.

Tweaked a few of the scripts for the demo. Some stuff to discover. The fake story is better told now. Still as long though.

The transition from title screen to game is better. When there is no saved game it goes into a new game, when there is a game available it loads it and brings up the menu with Continue highlighted. TODO: Make it ask for your name when you start a new game.

Also, holy flurking schnit, I have created scenery! AND animated scenery! ANIMATED SCENERY! This will replace a lot of the layers in my maps. So it should in theory draw faster once I remove all the old junk from the map and add in scenery in place of it.
Image
In this animated screenshot you can see the new tree scenery, an animated fire scenery, a bat getting killed and the new effect I gave to the explosion smoke.

Scenery can be however big you want it, and it uses a chunk of whatever image files are loaded. You could use the tiles sheet, or like with the fire, the explosions sheet, or the NPC sheet if I want. Specify how many frames it uses and how fast the frames should animate. I'm happy.

A bit more tweaking will be needed. I want to eventually have all actors and scenery dumped into a single pool that can be sorted by Y location so they have Z-indexes. i.e. if a piece of scenery is halfway down the map, the player can walk in front of it, then behind it by going up above and behind. Hopefully the table.sort() function is not too slow.

I am going to do what I can and get another playable demo up tonight. Hopefully.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

STOP SCROLLING!!! THE NEW DEMO IS RIGHT HERE!!!

Post by Jasoco »

As promised! A new demo is available!
Adventure.love
Press S at any time to SAVE your game. Then relaunch and see how it acts differently. Also, NEW GAME now works. It doesn't ask for confirmation yet though.

New in this version:
I'm playing around with targeting as a feature so I made it so an algorithm finds the closest enemy and returns its index. I hope to use this in the future for targeting with your weapon, or something like Z-Targeting like 3D Zelda's have. Part of my combat system. For demo purposes, the closest enemy is circled in red or green depending on the distance. This will be changed to a hovering arrow in the next version like how modern Zelda's do it.

Scenery is in place. Two types so far. Static one frame and animated ones. Scenery can be inserted into a scene at any point, when a map loads, or when a script runs, whenever. Future plans for this include rotating and scaling scenery and moving scenery.

For no reason the puff of smoke now rotates and scales just for effect. I hope to eventually make it look like it does in Wind Waker. Or at least a similar effect.

The demo scripts have been tweaked to be a little more entertaining and to flow better. There is now a goal, and some macguffin's.

The inn now works. You can sleep to regenerate health.

If you press E, the map will fill with randomly placed enemies for testing purposes. If you do this inside, you will also get unreachable enemies outside the walls. This is just for debugging.

The beginnings of a simplified map system are in place. In this version grass is not drawn. Unless it has the little "blades of grass" or "flowers" details. Instead the background is colored the same as grass would be and grass tiles are not drawn. This cuts off around 100-200 tiles per screen. Eventually almost everything will be scenery. In time everything will fall into place.

When you walk into a wall, the player will center itself on a tile. It's a hack right now, eventually it'll move towards the closest opening in the wall. This is to make it easier to hit narrow openings. It's a little buggy right now, but it's better than before.

Killed some bugs. Including yet another one with the boomerang. I plan on moving boomerangs and bombs out of the projectiles table and putting them in their own places to avoid conflicts.

Future Plans:
Make an animation when a dropped item is picked up where it will fly into its respective place on the status bar. I want to make it bezier curve there though, where it goes up, in an arc and down to its location. So I'd need to get the X and Y of the item and X and Y of the status area then animate along the curve.

As mentioned, targeting. Probably toggled when you press Z or a key. When you are targeting an enemy your attacks would go in their direction. I hope to have a player sprite that has more than four sides though by then. (i.e. I'll need angles for all 8 directions instead of just up, down, left and right.)
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: My Adventure Game Engine (NEW DEMO ON PAGE 20! 6/17/10)

Post by Robin »

It looks good and it's getting better every time. I had the problem that the game didn't recognise I killed all those monsters threatening Zooey, so it was dark, the rain wouldn't stop and Zooey would still say "save me!". I could go back to the other place, it wasn't dark there, but it was still raining. I think it might have something to do with that I pressed E before that time.

Edit: pressing H errors.
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: My Adventure Game Engine (NEW DEMO ON PAGE 20! 6/17/10)

Post by bartbes »

I do think it's hard to hit an enemy with your sword without touching them.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: My Adventure Game Engine (NEW DEMO ON PAGE 20! 6/17/10)

Post by Jasoco »

Robin wrote:It looks good and it's getting better every time. I had the problem that the game didn't recognise I killed all those monsters threatening Zooey, so it was dark, the rain wouldn't stop and Zooey would still say "save me!". I could go back to the other place, it wasn't dark there, but it was still raining. I think it might have something to do with that I pressed E before that time.

Edit: pressing H errors.
Pressing H used to take health, but I haven't used it in forever. I just forgot to remove it.

Also, I get that same problem with the enemies. I think an enemy might be spawning outside the map or something. You have to destroy 10 enemies to get the script to run. I guess it should instead check how many are loaded and wait for it to hit zero rather than wait for 10. If you leave and come back and kill one more, it'll think you killed 10. It's weird. And I will fix it. It's just for show. I'll have it fixed in the next demo. No, it didn't have to do with pressing E. Enemies spawned with E don't have scripts attached to them. Only the 10 that are created when you enter the forrest do.

Also, the weather is buggy too. For some reason when it is lightening up, the rain stops, then starts again and fades out. I have to rip it all out and figure out a better way of handling it.

Oh, and...
Image

And NPC's now have the ability to have "I have something to tell you!" notifiers (Exclamation points!) over their heads when they need your attention. i.e. if they are the person you are looking for to advance your quest, or they have another quest to send you on.
bartbes wrote:I do think it's hard to hit an enemy with your sword without touching them.
Yeah, I know. I have to revamp the battle system. I really want to make it so touching enemies doesn't hurt you, rather them attacking you does. I'd have to make it so enemies could tell when you are near and go after you instead of just wandering randomly. The current method mimics the original Zelda. I want to mimic more modern ones.

Edit: Also, press X to fire an arrow, B to place a bomb and V to throw your boomerang.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest