Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 18, 2024, 05:54:28 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsANSI Submarine Game
Pages: [1] 2 3 ... 5
Print
Author Topic: ANSI Submarine Game  (Read 9845 times)
pluckyporcupine
Level 9
****


View Profile WWW
« on: January 29, 2013, 02:33:08 AM »


« Last Edit: February 25, 2014, 04:09:47 PM by johnki » Logged

Eigen
Level 10
*****


Brobdingnagian ding dong


View Profile WWW
« Reply #1 on: January 29, 2013, 02:56:44 AM »

Gomez

Lovely title. Reminds me of some of my first games I tried writing in QBasic. Good times, thanks for reminding of them.

The captains log could use some better formatting/layout I think. A space between the row icon and the text would help.
Logged

pluckyporcupine
Level 9
****


View Profile WWW
« Reply #2 on: January 29, 2013, 03:00:30 AM »

The captains log could use some better formatting/layout I think. A space between the row icon and the text would help.
I wondered about that. Especially with the "WE'VE BEEN HIT" icon. It almost melts into the W. I'll definitely fix that.

EDIT: Fixed. Check the OP.

I also contemplated reversing the colors around the most recent message.

EDIT: Comparison:

« Last Edit: January 29, 2013, 03:42:20 AM by johnki » Logged

Quarry
Level 10
*****


View Profile
« Reply #3 on: January 29, 2013, 05:00:06 AM »

What about AIR
Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #4 on: January 29, 2013, 12:00:49 PM »

What about AIR
Not sure how I missed that one. I might add air.
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #5 on: January 29, 2013, 12:31:40 PM »

Cool, and nice to see another tiggers engine being used. Smiley
Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #6 on: February 01, 2013, 07:36:41 PM »

*swells with pride*
Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #7 on: February 02, 2013, 01:55:52 AM »

I started working on the programming today. I was going to do a simple test to get the main menu running but it turns out I need a player entity to get the game to run so I suppose it'll have to wait until tomorrow when I'm not exhausted.

I also need to figure out how to implement it without it getting in the way until it moves over to the map it's going to be on.

I'd show you guys the title screen I have but it's not all that interesting due to the menu being a large part of it. It just says "Press ESC to start" at the bottom. Tongue
« Last Edit: February 02, 2013, 02:05:06 AM by johnki » Logged

pluckyporcupine
Level 9
****


View Profile WWW
« Reply #8 on: February 03, 2013, 08:44:55 PM »

Approx 3 hours of work later, the menu is running!



I'll be publishing quite a bit on how to work with the engine in the near future so that maybe there's a tutorial series available when it gets a public release.

All in all, it's taking a bit longer than I thought it would due to learning to use the engine but I've got a good idea of how I'm going to build the actual game content so, with any luck, once I've got the beginnings figured out, it should be smooth sailing.
Logged

pluckyporcupine
Level 9
****


View Profile WWW
« Reply #9 on: February 04, 2013, 12:31:08 AM »

Aaaaand...phew.

I got all of the HUD, except the Captain's Log, and parts of the player logic done.



Making the HUD was quite the arduous process. In fact, it was such an arduous process, I have to show off the code for the HUD because there's just so much drawing code in there. It's 227 lines and I still haven't added the Captain's Log.

Code:
function hud()
drawset(201, 1, 142)
drawtile(0, 0)
drawset(187, 1, 142)
drawtile(39, 0)
drawset(188, 1, 142)
drawtile(39, 39)
drawset(200, 1, 142)
drawtile(0, 39)
drawset(205, 1, 142)
drawline(1, 0, 22, 0)
drawline(24, 0, 38, 0)
drawline(1, 17, 11, 17)
drawline(13, 17, 22, 17)
drawline(24, 17, 38, 17)
drawline(1, 30, 11, 30)
drawline(13, 30, 23, 30)
drawline(25, 30, 38, 30)
drawline(1, 39, 11, 39)
drawline(13, 39, 23, 39)
drawline(25, 39, 38, 39)
drawset(186, 1, 142)
drawline(0, 1, 0, 16)
drawline(23, 1, 23, 16)
drawline(39, 1, 39, 16)
drawline(0, 18, 0, 29)
drawline(12, 18, 12, 29)
drawline(39, 18, 39, 29)
drawline(0, 31, 0, 38)
drawline(12, 31, 12, 38)
drawline(24, 31, 24, 38)
drawline(39, 31, 39, 38)
drawset(203, 1, 142)
drawtile(23, 0)
drawtile(12, 17)
drawtile(24, 30)
drawset(202, 1, 142)
drawtile(23, 17)
drawtile(12, 39)
drawtile(24, 39)
drawset(185, 1, 142)
drawtile(39, 17)
drawtile(39, 30)
drawset(204, 1, 142)
drawtile(0, 17)
drawtile(0, 30)
drawset(206, 1, 142)
drawtile(12, 30)
drawset(0, 1, 142)
fillrect(1, 1, 22, 16)
fillrect(1, 18, 11, 12)
fillrect(13, 18, 26, 12)
fillrect(1, 31, 11, 8)
fillrect(13, 31, 11, 8)
fillrect(25, 31, 14, 8)
drawtext(6, 3, "CAPTAINS LOG")
drawtext(4, 20, "DEPTH")
drawtext(23, 20, "STATUS")
drawtext(15, 22, "HULL")
drawtext(30, 22, "CREW")
drawtext(3, 33, "HEADING")
drawtext(16, 33, "SPEED")
drawtext(29, 33, "TORPS.")

if keydown(65) then
drawset(27, 142, 1)
else
drawset(27, 1, 142)
end
drawtile(3, 36)

if keydown(68) then
drawset(26, 142, 1)
else
drawset(26, 1, 142)
end
drawtile(9, 36)

if heading == 0 then
drawset(78, 1, 142)
elseif heading == 1 then
drawset(69, 1, 142)
elseif heading == 2 then
drawset(83, 1, 142)
elseif heading == 3 then
drawset(87, 1, 142)
end
drawtile(6, 36)

if keydown(81) then
drawset(27, 142, 1)
else
drawset(27, 1, 142)
end
drawtile(15, 36)

if keydown(69) then
drawset(26, 142, 1)
else
drawset(26, 1, 142)
end
drawtile(21, 36)

drawset(219, 1, 142)
drawline(17, 36, 19, 36)

drawset(8, 1, 142)
if spd == 0 then
drawtile(17, 36)
elseif spd == 1 then
drawtile(18, 36)
elseif spd == 2 then
drawtile(19, 36)
end

if keydown(87) then
drawset(24, 142, 1)
else
drawset(24, 1, 142)
end
drawtile(6, 22)

if keydown(83) then
drawset(25, 142, 1)
else
drawset(25, 1, 142)
end
drawtile(6, 27)

drawset(219, 1, 142)
drawline(6, 23, 6, 26)

drawset(8, 1, 142)
if depth == 0 then
drawtile(6, 23)
elseif depth == 1 then
drawtile(6, 24)
elseif depth == 2 then
drawtile(6, 25)
elseif depth == 3 then
drawtile(6, 26)
end

drawtext(20, 22, hull)
drawtext(35, 22, crew)

if hull < 20 then
drawset(219, 1, 142)
drawtile(16, 24)
drawset(176, 1, 142)
drawline(17, 24, 20, 24)
elseif (hull >= 20 and hull < 40) then
drawset(219, 1, 142)
drawline(16, 24, 17, 24)
drawset(176, 1, 142)
drawline(18, 24, 20, 24)
elseif (hull >= 40 and hull < 60) then
drawset(219, 1, 142)
drawline(16, 24, 18, 24)
drawset(176, 1, 142)
drawline(19, 24, 20, 24)
elseif (hull >= 60 and hull < 80) then
drawset(219, 1, 142)
drawline(16, 24, 19, 24)
drawset(176, 1, 142)
drawtile(20, 24)
elseif hull >= 80 then
drawset(219, 1, 142)
drawline(16, 24, 20, 24)
end

if crew < 20 then
drawset(219, 1, 142)
drawtile(31, 24)
drawset(176, 1, 142)
drawline(32, 24, 35, 24)
elseif (crew >= 20 and crew < 40) then
drawset(219, 1, 142)
drawline(31, 24, 32, 24)
drawset(176, 1, 142)
drawline(33, 24, 35, 24)
elseif (crew >= 40 and crew < 60) then
drawset(219, 1, 142)
drawline(31, 24, 33, 24)
drawset(176, 1, 142)
drawline(34, 24, 35, 24)
elseif (crew >= 60 and crew < 80) then
drawset(219, 1, 142)
drawline(31, 24, 34, 24)
drawset(176, 1, 142)
drawtile(35, 24)
elseif crew >= 80 then
drawset(219, 1, 142)
drawline(31, 24, 35, 24)
end

if torpedo1 == true then
drawset(49, 1, 142)
drawtile(27, 36)
else
drawset(49, 142, 1)
drawtile(27, 36)
end

if torpedo2 == true then
drawset(50, 1, 142)
drawtile(30, 36)
else
drawset(50, 142, 1)
drawtile(30, 36)
end

if torpedo3 == true then
drawset(51, 1, 142)
drawtile(33, 36)
else
drawset(51, 142, 1)
drawtile(33, 36)
end

if torpedo4 == true then
drawset(52, 1, 142)
drawtile(36, 36)
else
drawset(52, 142, 1)
drawtile(36, 36)
end
end
« Last Edit: February 04, 2013, 12:43:30 AM by johnki » Logged

pluckyporcupine
Level 9
****


View Profile WWW
« Reply #10 on: February 04, 2013, 02:23:13 AM »

Already a new update. You can move! Also fixed a minor detail with the way depth was handled, switching it from Z handling to layer handling so that the player doesn't disappear when going below a certain depth.

Going to work on AI soon and then get the Cap's Log in with the AI.


(Exporting GIFs is so much easier than making videos and uploading them to Youtube. The engine actually has the tools to effortlessly create GIFs in seconds.)

I also want to make a ginormous blog post soon about some of the semantics involved in using the engine. One really interesting problem I just had when coding movement was that the actual move() function that takes values and then moves you a certain amount based on the values you gave actually gave a stack overflow for the method of movement I was using, whereas the entityposition() function which takes a position and moves the entity provided to that position did not give me the same stack overflow. I have this odd feeling that move() is intended to be more of an on/off switch (determined by a keypress...something to do with the delay that keys can have set) than something determined by a timer but I'd have to test it to be sure.
« Last Edit: February 04, 2013, 02:28:17 AM by johnki » Logged

pluckyporcupine
Level 9
****


View Profile WWW
« Reply #11 on: February 04, 2013, 04:05:48 AM »

And yet another update!

AI is mostly implemented.



They're...how do I put this lightly? Well, they're pretty much dumb as a sack of rocks. They pretty much go until they're lined up with you and then they attempt to reach the same depth as you and then (once torpedoes are implemented) they fire at you.

I realized after I uploaded this that they seem to chase you down until they're right up next to you. That's not quite the intended effect and I'll have to fix that.

EDIT: Oh and you'll notice that there is a "glitchy zone" on one end of the map. Yeah. I haven't fixed the camera so that it doesn't go outside of the map yet.

I think that's the last update for the night, though. Have some other stuff to get done and I'm not 100% sure how I'm going to handle the torpedoes just yet.
Logged

rivon
Level 10
*****



View Profile
« Reply #12 on: February 04, 2013, 05:25:18 AM »

You have the name wrong. ANSI is American National Standards Institute. You probably meant ASCII Wink
Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #13 on: February 04, 2013, 05:37:17 AM »

You have the name wrong. ANSI is American National Standards Institute. You probably meant ASCII Wink
Nah, I'm pretty sure it's ANSI.

When MUDs adopted ANSI, for instance, they got color and added a few extra characters. Something about the "ANSI code page."

And if you Google "ANSI art", you'll get a lot of stuff similar to what kind of graphical elements this game uses.

Either way, semantics.
Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #14 on: February 04, 2013, 06:02:50 AM »

You have the name wrong. ANSI is American National Standards Institute. You probably meant ASCII Wink

Correction: the engine (by default) precisely uses the standard IBM PC character set. But "ANSI" sounds cooler and, to the best of my knowledge, isn't trademarked or anything.

Making the HUD was quite the arduous process. In fact, it was such an arduous process, I have to show off the code for the HUD because there's just so much drawing code in there. It's 227 lines and I still haven't added the Captain's Log.

This is why I need to add capability for drawing tilemap images to the screen. Sorrrry. I'll add that in soon.

edit: Also, whoa, that's not even the biggest issue here.

What you have:
Code:
if hull < 20 then
  drawset(219, 1, 142)
  drawtile(16, 24)
  drawset(176, 1, 142)
  drawline(17, 24, 20, 24)
 elseif (hull >= 20 and hull < 40) then
  drawset(219, 1, 142)
  drawline(16, 24, 17, 24)
  drawset(176, 1, 142)
  drawline(18, 24, 20, 24)
 elseif (hull >= 40 and hull < 60) then
  drawset(219, 1, 142)
  drawline(16, 24, 18, 24)
  drawset(176, 1, 142)
  drawline(19, 24, 20, 24)
 elseif (hull >= 60 and hull < 80) then
  drawset(219, 1, 142)
  drawline(16, 24, 19, 24)
  drawset(176, 1, 142)
  drawtile(20, 24)
 elseif hull >= 80 then
  drawset(219, 1, 142)
  drawline(16, 24, 20, 24)
 end

What you could have:
Code:
local meterw=5
drawset(219,1,142)
drawrow(16,24,meterw)
drawset(176,1,142)
drawrow(16,24,math.ceil(hull/100*meterw))
« Last Edit: February 04, 2013, 06:13:37 AM by _Madk » Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #15 on: February 04, 2013, 06:43:53 AM »

edit: Also, whoa, that's not even the biggest issue here.

What you have:

What you could have:
Yeah, I could probably stand to go back and optimize. I noticed a few places as I was writing them.

For some reason, though, it didn't occur to me, even though I was already drawing over the boxes that I used for the background, that I could draw back over the bars I was drawing. Facepalm

Anyways, I lied. One more update tonight (well, this morning now). Got the Captain's Log semi-working and it was a lot easier than I thought. I'm going to go back and optimize it from a bunch of if statements to some other sort of loop when I'm not too tired to have thought of that before now.



I also started implementing torpedoes though the exact manner in which I'm going to implement them keeps changing as I'm writing it.
Logged

eyeliner
Level 10
*****


I'm afraid of americans...


View Profile
« Reply #16 on: February 04, 2013, 07:54:49 AM »

Looks good, bro. Glad to see a project like this instead of the old roguelike bullshit clones.
Logged

Yeah.
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #17 on: February 04, 2013, 11:59:01 PM »

Okay!

Today's changelog:

- Torpedoes added for both the AI and the player.
- AI improved significantly.
- Struggled a bit, learned some stuff, and improved some code.
- Stats made functional.
- Camera stops at the edge of the map.
- Made "ANSI Submarine Game" the official title. It grew on me. Tongue
- (EDIT) Finally fixed the player entity so that it doesn't show on the title screen.



As of today, I THINK that 90% or so of the gameplay aspects are done. Quite a few little details that weren't in the documentation that I learned of today in regards to creating entities using entitycreate(). I'll have to add some makeshift pathfinding for the AI once I add land, methinks.

If, at this point, you have a copy of the Banshee Engine and you want to try the game out in all of its single test map glory, leave me a message here or PM me and I'll send you the game files.

I also need opinions. For land, should I make it so that the dotted blocks require you to be surfaced like I had originally planned or should I just make them cosmetic? A bit worried that requiring the player to be surfaced while on such tiles would be annoying.

What's left:

- Make maps, subsequently adding land.
- Improve AI if necessary.
- Keep testing to see if the "phantom enemy sub" keeps reappearing and figure out why it does.
- Do some balance testing.
- Wait for Banshee Engine public release.
- Do a write-up of some of the unexpected quirks involved in working on this game (I think I'm going to start on that tonight).
« Last Edit: February 05, 2013, 12:25:16 AM by johnki » Logged

pluckyporcupine
Level 9
****


View Profile WWW
« Reply #18 on: February 05, 2013, 03:52:57 AM »

Well that's interesting. Apparently if you fire off torpedoes in quick succession, some of them actually disappear but continue to exist somewhere. I'll need to implement a fix.

EDIT: I appear to have fixed that. I had to implement a hard timer so that you can only fire every 10 steps. Might have worked just fine being every 5 but I wanted to be sure.

Right now, the game seems pretty hard.

Also, contemplating slowing the game down a bit to match the sub-y-ness of it.

EDIT2: I think I figured out the phantom problem! It seems like the "phantom" is the third enemy. For some reason, it isn't registering as having the name "Enemy" despite the fact that the other two do. Now to solve it.

EDIT3: Odd. Now, instead of having a phantom, I have an issue with the enemy not showing up at all. Debugging shows that it's being created but I never see it and when iterating through the list of entities on the map, it says that the mission is completed after destroying only two enemies.

EDIT4: I seem to be able to get the phantom to show up if I move it within viewing range of the starting point for the player. But that's still an odd circumstance.

And suddenly, my code for sighting enemies has stopped working beyond the first sighting.

EDIT5: Fixed the Captain's Log. It was broken, you ask? Yeah. I couldn't get the bottom line to display correctly.
« Last Edit: February 05, 2013, 04:45:52 AM by johnki » Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #19 on: February 05, 2013, 06:56:02 AM »

It sounds like either the engine's iteration for returning a list of entities is broken, or you're skipping the final index in your for loops. Are you keeping in mind that Lua is obnoxious and begins arrays at index 1 rather than 0?
Logged
Pages: [1] 2 3 ... 5
Print
Jump to:  

Theme orange-lt created by panic