CodeWalrus

CodeWalrus Website => Contests => Topic started by: Scipi on May 09, 2015, 05:00:31 AM

Title: [4x3 contest][C++][PC]MiniDungeon
Post by: Scipi on May 09, 2015, 05:00:31 AM
I'll be making a small dungeon crawler for the 4x3 contest.

Some of the ideas I have going:

-Map is split into a grid of 4x3 rooms
-World updates only when the player takes an action.
-Player can move around rooms and attack enemies
-Map is randomly generated

Here's a mockup of the game:
(https://dl.dropboxusercontent.com/u/10573921/Mockup_1.png)

Edit:
The Green pixel is the player, red is an enemy, and the grey are doors

The game will be written in Lua using the Love2D framework
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 09, 2015, 05:02:17 AM
Ooh, glad to see you are entering the contest too. :D I hope you can finish the entry, unlike your other projects. :P

How will rooms be connected? Will there be obstacles such as walls?
Title: Re: MiniDungeon
Post by: Unicorn on May 09, 2015, 05:11:04 AM
Looks and sounds cool!
Title: Re: MiniDungeon
Post by: Snektron on May 09, 2015, 06:50:05 AM
Oh i really like that idea :D Good luck :)
Title: Re: MiniDungeon
Post by: Scipi on May 09, 2015, 07:40:01 AM
Quote from: DJ Omnimaga on May 09, 2015, 05:02:17 AM
Ooh, glad to see you are entering the contest too. :D I hope you can finish the entry, unlike your other projects. :P

How will rooms be connected? Will there be obstacles such as walls?

Hopefully... Rooms will be connected at the grey points and walls are edges with no transitions. The entire map is a grid of cells and each cell is a 4x3 room. So should be easy to implement and work with. :P
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 13, 2015, 06:53:35 AM
Aah I like the idea. Just make sure that whenever possible, there aren't too many instances or entrances being in the opposite direction than the exits, so the player won't constantly backtrack by mistake.
Title: Re: [4x3 contest]MiniDungeon
Post by: Snektron on May 13, 2015, 01:42:15 PM
How are you going to implement battles btw?
Title: Re: MiniDungeon
Post by: alexgt on May 13, 2015, 08:05:25 PM
Will the enemies fight you by them selves or do you?
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 15, 2015, 07:12:02 AM
Maybe they could be done like in CalcRogue and Ys? In CalcRogue, to attack an enemy you must press the arrow that points in the enemy direction, while in Ys you walk straight through enemies (but not centered, else they dodge your hit and you take damage unless you're at high levels)
Title: Re: [4x3 contest]MiniDungeon
Post by: Snektron on May 15, 2015, 09:23:05 AM
It could also be where you just lose a bit of health when you walk in an enemy, though that would be less exiting :P
Title: Re: MiniDungeon
Post by: Duke "Tape" Eiyeron on May 15, 2015, 10:11:15 PM
CalcRogue was good. Good thing they made the game cross-platform. Actually, for the few roguelikes I tried to do, I actuallt search for an entity before trying to move to the direction I want, so I can select the right action to do.
Title: Re: MiniDungeon
Post by: CKH4 on May 15, 2015, 11:24:45 PM
Ooh sounds cool, I love löve. Its pretty easy and cool and stuff and sounds like its a good choice for this project. Good luck.
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 16, 2015, 07:19:38 AM
Quote from: Cumred_Snektron on May 15, 2015, 09:23:05 AM
It could also be where you just lose a bit of health when you walk in an enemy, though that would be less exiting :P
I'M thinking the best way would be to make the game so if enemies moves towards you and you aren't moving, then you lose health and the other way around when you walk towards them. If both walk towards each others then maybe the hits could be dodged? Of course if Scipi plans to add leveling up (eg LV 1 being black and 99 white or something) then I guess the amount of damage taken by both could also be based on levels, so if you try to attack a level 99 enemy as a level 50 then you would take the damage.
Title: Re: [4x3 contest]MiniDungeon
Post by: Snektron on May 16, 2015, 10:12:31 AM
Yes but wouldn't that require quite comlex AI? I mean the enemy's are probably always moving
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 18, 2015, 04:13:46 AM
Probably not. The way I'm thinking about would have enemies still move randomly or every few frame and no AI would be required for damage. I can't really help much, though, because contest. :P
Title: Re: [4x3 contest]MiniDungeon
Post by: Snektron on May 18, 2015, 06:10:14 AM
I Still don't see how that will work :P But im sure Scipi can figure something out
Title: Re: MiniDungeon
Post by: Scipi on May 20, 2015, 05:18:35 AM
Quote from: DJ Omnimaga on May 13, 2015, 06:53:35 AM
Aah I like the idea. Just make sure that whenever possible, there aren't too many instances or entrances being in the opposite direction than the exits, so the player won't constantly backtrack by mistake.

Well, what will happen is the player will move through a door and will appear on the opposite side of the room, depending on which direction they moved. There will be a door there, however.

Quote from: Cumred_Snektron on May 13, 2015, 01:42:15 PM
How are you going to implement battles btw?
Quote from: alexgt on May 13, 2015, 08:05:25 PM
Will the enemies fight you by them selves or do you?

You move towards an enemy to strike at it. If you take a move and the enemy takes a move and ends up on a square next to you, it will strike you instead.

Quote from: DJ Omnimaga on May 16, 2015, 07:19:38 AM
Quote from: Cumred_Snektron on May 15, 2015, 09:23:05 AM
It could also be where you just lose a bit of health when you walk in an enemy, though that would be less exiting :P
I'M thinking the best way would be to make the game so if enemies moves towards you and you aren't moving, then you lose health and the other way around when you walk towards them. If both walk towards each others then maybe the hits could be dodged? Of course if Scipi plans to add leveling up (eg LV 1 being black and 99 white or something) then I guess the amount of damage taken by both could also be based on levels, so if you try to attack a level 99 enemy as a level 50 then you would take the damage.

That's how I was thinking of having level up's go. That's a neat idea with if both move towards eachother at the same time. Damage could be applied according to the ratio of your level.

Quote from: Cumred_Snektron on May 16, 2015, 10:12:31 AM
Yes but wouldn't that require quite comlex AI? I mean the enemy's are probably always moving

It's nothing more than a simple A* towards the player then checking some conditions in the conflict resolution phase. Not really complex at all. And movement goes in turns. So you take an action then everything else in the world takes an action after you. Like how old roguelikes worked. Even in a realtime system, though, it's a simple thing to do. :P
Title: Re: [4x3 contest]MiniDungeon
Post by: Snektron on May 20, 2015, 02:01:08 PM
Ah okay :). I can't wait to see the finished game! :D
Title: Re: MiniDungeon
Post by: alexgt on May 20, 2015, 07:48:11 PM
Yeah, sounds awesome :).
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 21, 2015, 05:41:00 AM
Yeah that's what I meant Scipi. Basically, just like Ys 1 and 2 when you attack enemies head-on.

Good luck by the way!
Title: Re: MiniDungeon
Post by: Duke "Tape" Eiyeron on May 21, 2015, 04:46:52 PM
Before trying the A*, you could do a quick Bresenham to see if the enemy can see the player and rush forwards.
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 22, 2015, 06:19:47 AM
But how would it be useful if there is no obstacle at all in the maps? Of course, if the enemy looks in different directions then it could still be useful, but in 4x3 resolution it would be hard to see in which direction the pixel is looking.
Title: Re: MiniDungeon
Post by: Scipi on May 25, 2015, 05:32:47 AM
Quote from: Duke "Tape" Eiyeron on May 21, 2015, 04:46:52 PM
Before trying the A*, you could do a quick Bresenham to see if the enemy can see the player and rush forwards.

Well, I'm probably not going to bother with A*. There's no point in such a small area. What I plan on doing is taking the Manhattan distance then randomly moving either along the vertical or horizontal axis towards the player. Doing that would make the AI seem interesting, although it might be better for everything to be entirely deterministic from the player's perspective.
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 25, 2015, 05:58:24 AM
Do you mean having the enemies always go toward you?
Title: Re: MiniDungeon
Post by: Scipi on May 25, 2015, 06:02:12 AM
Pretty much. The AI should be somewhat aggressive towards the player. Having random movement would make the AI more unpredictable, which would help it seem smarter and a more interesting challenge. But having everything completely predictable might be more fun overall as the player can reliably plan out their moves
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 25, 2015, 06:22:27 AM
Yeah that's what I thought as well. Don't make it move towards you every frame, though, else it will be impossible to dodge. What I usually do is either make it move every 2 frame or I make it alternate between moving towards you and randomly. It could vary from one enemy/dungeon to another, though.
Title: Re: MiniDungeon
Post by: Scipi on May 25, 2015, 06:28:12 AM
The world updates only when you take an action. So the player controls the pacing of the game, really.

Also, the framerate is bound to be some insanely high number. :P
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 25, 2015, 06:44:01 AM
Oh right that seems like you could have the enemies move every turn, then. :)
Title: Re: MiniDungeon
Post by: Snektron on May 25, 2015, 08:23:38 AM
Quote from: Scipi on May 25, 2015, 06:28:12 AM
Also, the framerate is bound to be some insanely high number. :P

Because it's so little to render? :P
I recently did some experiment with some shaders. It didn't really work but i had to seperate the update and render part since it was running at 2500 fps O.O
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 27, 2015, 09:19:02 PM
For such game, I think the frame rate should be set to 8 max. You can have animations that run faster, but trying to walk at 60 fps would be a nightmare. :P
Title: Re: [4x3 contest]MiniDungeon
Post by: Snektron on May 27, 2015, 09:31:43 PM
You can render fast and update at a smaller pace. That's how most games are done actually, but i think AAA titles keep the update speed bound to like 60.
Also seperating the render and update loop ensures the game will allways run at a certain tick rate, while the render speed may vary, even if its on some low end computer where the render loop takes longer than the update loop.
Title: Re: MiniDungeon
Post by: Scipi on May 27, 2015, 11:18:32 PM
Quote from: DJ Omnimaga on May 27, 2015, 09:19:02 PM
For such game, I think the frame rate should be set to 8 max. You can have animations that run faster, but trying to walk at 60 fps would be a nightmare. :P

The framerate actually has no effect on the gameplay whatsoever. I could play fine running the game at full speed at ~4500 fps :P

Though I have the framerate locked to the screen's refresh rate.
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on May 28, 2015, 05:49:45 AM
Ok but what about key repeat? That was my main concern. If you press down an arrow, won't your character move by 4500 pixels in a second at such speed, making accurate movement impossible? Or did you disable key repeat/holding down arrows?
Title: Re: [4x3 contest]MiniDungeon
Post by: Snektron on May 28, 2015, 07:20:06 AM
As i said dj, you'd render at 4500 fps and run the update logic (containing key detect code and such) only 20 times a second.
Title: Re: MiniDungeon
Post by: Duke "Tape" Eiyeron on May 28, 2015, 04:20:03 PM
That's the reason update/render programming pattern exists. The rendering is independant from the updating and thus the programmer does have full control on the timing around them.
Title: Re: MiniDungeon
Post by: Scipi on May 29, 2015, 08:25:19 AM
Key repeat is disabled, so the input is registered only on the first frame a key is pressed.

As for the render/update pattern, generally you'd use that if you need to synchronize state across a network (ie, multiplayer) or if you have systems that become unstable at certain framerates, such as physics. Since this game features neither, there's no real need to use that pattern. If I were coding this at production level quality with key repeat enabled, I'd probably use a state machine to keep track of things and put a timer of maybe a fourth of a second on the AI's turn to ensure the player doesn't accidentally move too fast.
Title: Re: MiniDungeon
Post by: Unicorn on May 31, 2015, 07:23:41 AM
Was it done and submitted on time? Also, what platform is this for? nspire? PC?
Title: Re: MiniDungeon
Post by: Scipi on May 31, 2015, 07:59:24 AM
It's 99% done, I just need to finish up a few things with the map generator and get a basic health system implemented. Nothing too difficult, maybe an hour or two worth of coding. It'll definitely be submitted sometime today.

The platform is PC. I don't have any of the tools needed to target the Nspire installed.
Title: Re: MiniDungeon
Post by: Unicorn on May 31, 2015, 08:03:52 AM
Oh, cool! PC is worldwide. :)
Title: Re: [4x3 contest]MiniDungeon
Post by: Snektron on May 31, 2015, 09:26:38 AM
yay PC, now i can play it without emulators :P
Title: Re: MiniDungeon
Post by: Scipi on May 31, 2015, 09:45:58 AM
Finished and submitted. Huzzah for waiting to the last minute to code everything! :3

Oh, also, I didn't actually use Love2D like I said I was in the OP. I used C++ instead, since I know it better.
Title: Re: MiniDungeon
Post by: Dream of Omnimaga on June 02, 2015, 05:41:12 PM
Glad to see you managed to submit this in time. I tried it and liked what I saw so far. :)