Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / A Dark RPG - Errors

Author
Message
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 11th May 2008 03:09
Hey all,

I'm working on a cool little rpg, for the sake of figuring out how to do it. I need some help with a few bugs though.

dbPasteImage seems to do some weird things when I change the screen size:

No bug:


Bug:


The gray brick tiles are updated with dbSprite(), while the green grass tiles are updated with dbPasteImage().

A larger screen makes it work properly. The smaller screen is still large enough to hold the tiles with a few pixels extra, but it bugs out on the image pasting.

Also, I must be doing something horribly wrong, because the game runs terribly slow when I make the screen larger.

darkrpg.h:


darkrpg.cpp:


playerhelp.cpp:


Good luck. ;9
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 11th May 2008 08:34
The game uses a tiling system prevalent in many 2D games, outlined in void rpgDrawMap(int iTopX, int iTopY) .

Grass tiles have an ID of 2 and are pasted as images. Wall tiles have collision, and so are made as sprites. I wrote my own collision function using the too-plain dbSpriteCollision() .

This function is bool player:OC(int iDir) .

The issue ust be in rpgDrawMap() seeing as when stick a return at the beginning of it, the game paints the blue background. With the function untampered, the bottom half of the screen, sans sprites, is black.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 11th May 2008 09:18
For debugging purposes, I modified my drawmap function to print the y-coordinate of each tile, at that exact y-coordinate. The result is illogical. Values in the top-left are my character's x,y-coordinates.



rpgDrawMap():
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th May 2008 17:55
When you make a loop with x on the outside, and y on the inside... it works out backwards. This MIGHT be your illogical finding in displaying tile values. Good Debugging technique though. More work just to help debug and visualize what's going on is very helpful.

Quote: "Also, I must be doing something horribly wrong, because the game runs terribly slow when I make the screen larger."


Maybe, Maybe Not. I'd be more concerned with how many sprites I had going at one time. Also, I don't think with Sprites you need to REDRAW the whole map each frame. Because the sprites are more or less "Sticky" you can try to write code that only "works" on things that have changed..as they change during gameplay... and only do the Full "draw" when necessary... like... maybe if scrolling the "whole screen" or something.

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 11th May 2008 22:42
Quote: "When you make a loop with x on the outside, and y on the inside... it works out backwards"


It was originally x and then y, but that meant that my map in the header file had to be on its side, each row of numbers representing a vertical column.

I found my debugging result so 'illogical' because i was telling the game to print the y-coordinate of each tile at that coordinate:



I found that I could fix the issue by tiling the grass as sprites, and that I could tell the screen to only paint on certain conditions.

From darkrpg.h:


From darkrpg.cpp:


This condition would be the global value g_mapDrawn==0

I won't code the screen to scroll. Instead, I'm doing some Zelda-style area-swapping.

There's probably a better way to paste the grass tiles, I saw someone using dbPasteSprite in a function somewhere on these boards. I might go borrow it.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th May 2008 22:51
Well Zelda Style is cool Remember.. you can use dbSetSpritePriority to control z orde for sprites (whats on top a what)... and if zelda style.. just redraw map on room entry... and stuff sitting on the ground should be "on top" of the background.

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 12th May 2008 01:05
way ahead of ya, on both of those.

call redraw:


sprite priority:
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 12th May 2008 01:24
Quote: "way ahead of ya, on both of those."


LOL... Ok... Keep us Posted!

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 12th May 2008 02:52
I'm working on seperating the map into big chunks. rpgDrawMap() now checks to see which chunk to draw from with a switch statement.

My first chunk is as follows:


2 is grass, 51 and 52 is wall, the rest are path tiles.

The screen successfully redraws when the character reaches the edge of the screen, by adding or subtracting from the parameters passed to rpgDrawMap() . This is detailed in Navigation() :


approaching edge:


tadaaa:
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 12th May 2008 03:07
Well Done.. you try making the screen bigger now? Still way slow or did your optimizing help?

Looks Cool.

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 12th May 2008 21:21
I've bumped the screen size from 240x240 to 320x320 along with the tiles from 24x24 to 32x32, to keep the tiles looking nice and crisp.

I make my own graphics
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 12th May 2008 21:22
And, the optimization bumped the speed back up to what it should be.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 12th May 2008 22:46
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 13th May 2008 07:21
I've updated the way images are loaded. much more memory-efficient.

And, the cahracter can go indoors now.

Screenshots coming soon.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 13th May 2008 07:21 Edited at: 13th May 2008 22:17
I've updated the way images are loaded. much more memory-efficient.

And, the character can go indoors now.

Screenshots coming soon.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 14th May 2008 04:37
SCREENSHOTS:



Top Left: A building.
Top Right: An Interior.
Bottom Left: A culvert. Usually unwalkable.
Bottom Right: Inside the culvert.

The room behind the culvert:


My tile chunk, as of now:


I've written code to allow for events that affect the layout of the map:



Where my default map chunk is:


by adding a floating offset to the ID of a map tile, I am affecting the ID it's given as a sprite in rpgDrawMap():


Where t is the variable that manages the IDs for tiles that teleport the player between interior and exterior map chunks.

So, the culvert becomes walkable and a door if g_bFirstCulvertOpen is true.

I also added code to my Navigation() function to switch the map chunk to g_FirstDungeon[][] when the player exits the screen above the culvert.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 14th May 2008 04:57
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 14th May 2008 06:31
check that last post

i hate being a new user.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 16th May 2008 21:33
I'm currently working on NPCs. Screenshots to come as soon as I have them.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 17th May 2008 07:35 Edited at: 17th May 2008 08:12
EDIT: I got it =]
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 17th May 2008 08:15
The NPC system still feels kinda sketchy, but here's a shot for ya:
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th May 2008 14:59
You take a gander at my Jegas Game Classes yet? Look in the FoundationClasses, especially at both JFC_AR and JFC_DL.

http://code.google.com/p/darkgdkoop/

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 19th May 2008 23:39
I've taken a look at it, I'm having trouble figuring out what it is...
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 21st May 2008 17:38
Well, one is an array class (JGC_AR - Much Faster especially for iterating through a lot of "items". In fact - this is where its at its prime.) and the other is a Double Linked List (JGC_DL - slower - but more powerful over all )

Also look at href]http://www.cplusplus.com[/href] there is a sweet C++ tutorial there - and it covers concepts like pointers, arrays, etc.

also there are more mainstream solutions like the stand library - aka STDLIB.. seek out the vector class (arrays I think) (not same as DarkGDK vectors or 3dmaths) and the list class (double linked list class)

Good Luck! Don't Give Up!

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 22nd May 2008 00:42
I guess I'll have a more in-depth look at it then.

As for cplusplus.com, I've been there. Search function makes it a bit hard to find things, though.

I've got it on my webpage's links page.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 22nd May 2008 03:21
Meh, I took another look at it. I couldn't figure it out.
tobi453
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location:
Posted: 22nd May 2008 22:49
hi elantzb,

looks good. If you are using sprites, I recommend to hide the sprites and to use dbPasteSprite(). That's much much faster!

Tobi

FINAL VERSION RELEASED!!!!
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 22nd May 2008 23:41
if I hide the sprites, won't dbPasteSprite() just paste an invisible sprite, AKA nothing?

or do you mean keep them visible, offscreen?
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 23rd May 2008 00:35
My current setup for tiling the screen acts strangely on the other computer I'm working on. It doesn't seem to calculate the texture coordinates correctly.

from rpgDrawMap() :


doUV() :


Any ideas?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th May 2008 07:24
This may or maynot apply but I got TOTALLY WHACK Bitmap fonts on NON-NVidea before DavidW told me that my NVidea might be the odd ball out - I need to load images with the "no Mip Map" flag (the unnecessary (but for me necessary) 3rd parameter...

It's allso known as the "Use Image for texturing" flag to some - or at least many will know what I mean.

It throws the image off alot and in a sprite - uit'll look like the image MIGHT seem bigger - like strectched maybe - and its missging stuff... hard to explain kinda.. but.. for sprites I think it: dbLoadImage("file",id,1); Double check help though - its in my JGC lib - I'm barely awake though - to tired to look if you're still hased - and want to know exactly how I did the sprite bitmaps fots... I'll look it up for ya

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 25th May 2008 06:02
i noticed that flag yesterday, but i'll be stuck on the computer that works until tuesday.

you get credit for getting to me first, though.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 27th May 2008 21:08
YES! SUCCESS!

I LOVE YOU

not as much as sarah
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th May 2008 21:46
LOL... BTW - I wasn't clear on that NVIdea odd ball out - What it was doing was looking correct on NVidea (with mip maps loaded) but other PC's showed the bitmap fonts totally whack.. .first I thought it was the intel card, then intal and old ati, then... David W tried it and said... Um.... "I know your problem man... and the good news? Its an easy FIX!"

LOL... It was too!

Happy you got through that! You have to keep us posted now! It looks neat what you're doing here... I'd like to see it after you've had some time to beat it senseless a bit.

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 28th May 2008 03:39 Edited at: 28th May 2008 03:41
well let's see... i've tweaked the tile appearance a bit and i'm adding some more buildings...

Adriano jones
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location: Turn around...
Posted: 29th May 2008 01:03
nice looking rpg, it's really starting to look something like Fate now.
-adrian

Adriano jones
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 30th May 2008 05:14
fixed a function that was really bothering me, which checks an ID and it's decimal offset, to see if the offset is what I'm looking for.



In the above case, the program would output "match".

this would not work with:
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 30th May 2008 05:23
When dealing with floats... look for ranges not exact values. Rounding will always fail you.

Pseudo: if offset>0.1 && offset <0.5 then YAY!

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 30th May 2008 05:31
in case you missed the gist of my statement, i was calling it a success.

i was mucking around with ranges before and they weren't working out.

i tried a billion different ways of truncating and rounding, rearranging my variables and casts in countless ways. i suddenly thought of another way to do it.

rather than subtract a truncated float from the original to get the float's offset, and then comparing that to the offset i wanted, i subtracted the offset i wanted from my float and compared it to the truncated float.

and for some reason, doing it this way gave me the exact value. so i kept it.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 30th May 2008 05:38
Quote: "in case you missed the gist of my statement"


I Did

Quote: "rather than subtract a truncated float from the original to get the float's offset, and then comparing that to the offset i wanted, i subtracted the offset i wanted from my float and compared it to the truncated float.
"


Neat

Quote: "and for some reason, doing it this way gave me the exact value. so i kept it."


Could be the compiler is converting your float to an int due to that int typecast.

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 30th May 2008 05:45
instead of


I was attempting to do


which didn't work.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 1st Jun 2008 01:27
Here we have screenshots of the second building, and it's interior and occupant.

Note slight graphics update.

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 4th Jun 2008 21:04
Today I'll be refining some of my more lengthier functions. rpgDrawMap() has grown to be at least a page long.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 4th Jun 2008 21:06
That's starting to look really good, let me know when you finish it, I wanna play it.

If you can do any models for FW, reply to the FleetWars thread.

Click here!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th Jun 2008 21:28
Good Job elantzb - keep it up!

I want to see YOU see this ONE through!

doesn't have to be a full blown anything - its just looking great - make a full game of it... not HUGE game... just a working game!

(if you want... I am routing for you though... so I hope you DO WANT! so many start them, only a few finish any)

Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 4th Jun 2008 21:30
Hey, jason...

Can you get Xfire? I'd like to talk to you in real-time, privately.

http://xfire.com/

If you can do any models for FW, reply to the FleetWars thread.

Click here!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th Jun 2008 21:44
Yahoo me... I'm not signing on xfire, I'm sorry.

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 8th Jun 2008 00:02
I've successfully split up my game into easier-to-read files.

dbGamerX
16
Years of Service
User Offline
Joined: 23rd Nov 2007
Location:
Posted: 8th Jun 2008 01:23
It's lookin great so far! I want to play it too.

dbPrint ( "Sig" );
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 10th Jun 2008 02:16
I'll work on a WIP release for you guys to check out. I'll prolly just throw in some more buildings and NPCs. And modes for a menu/title etc.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 16th Jun 2008 10:31
how do i upload this?

Login to post a reply

Server time is: 2024-11-20 15:16:44
Your offset time is: 2024-11-20 15:16:44