• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
black_darkness

Interacting with signs. I need advice.

11 posts in this topic

Here is a screenshot of me interacting with a sign. Every time I hit the enter key it checks if the square you are facing is interactable and then if yes if cout<<"Welcome to Negfaron". The problem I want your help solving is how do I go about managing which sign says what. Obviously I do not want them all saying the same thing.

[img]http://i49.tinypic.com/2h34vvd.png[/img]

Now this is how I create a map. Each char represents a tile.

They each use the tile class.
[CODE]
class tile {
public:
char cid, pass, interaction;
int sy,sx;
void set_values (char,char,char,int,int);
string dialogue;
};
void tile::set_values(char cid1,char interaction1,char pass1,int sy1,int sx1) {
interaction = interaction1;
cid = cid1;
pass = pass1;
sy = sy1;
sx = sx1;
}
[/CODE]

[CODE]
void init_map(string &grid) {
grid = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
"XOOOOOOOOOOOOOOOOOOOOSOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX" //5
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX" //10
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOXXXXXOOXXXXXOOOOOOOOOOOX"
"XOOOOOXBBBBBBBBBBXOOOOOOOOOOOX"
"XOOOOOXBBBBBBBBBBXOOOOOOOOOOOX"
"XOOOOOXBBBBBBBBBBXOOOOOOOOOOOX" //15
"XOOOOOXBBBBBBBBBBXOOOOOOOOOOOX"
"XOOOOOXXXXXXXXXXXXOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX" //20
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX"
"XOOOOOOOOOOOOOOOOOOOOOOOOOOOOX" //25
"XTTTTTTGGGGGGGGGGGGGGGGGGGGGGX"
"XTTTTTTGGGGGGGGGGGGGGGGGGGGGGX" //27
"XTTTTTTGGGGGGGGGGGGGGGGGGGGGGX" //28
"XTTTTTTTTTTTTTTTTTTTTTTTTTTTTX" //29
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; //30
// 123456789X123456789X123456789X
}
[/CODE]


Here are some of my ideas I have so far is make each sign a different char and that will be the sign id, and depending on which char is displaid on the map grid it will say something else.

A problem I have with this idea is that eventually I will run out of chars since I plan on having a large game with many signs.

How would you solve this problem?
0

Share this post


Link to post
Share on other sites
Having a character for each sign is a really bad idea. You should implement some sort of entity system so that you can add signs and other objects in the world separate from your tilemap. You gotta do it some time, right? Unless you don't plan on expanding your game past "The Adventures of Tinyguy: Rogue Sign-Reader Extreme".

I recommend looking through some general tile engine tutorials as well. Good luck, mang.
1

Share this post


Link to post
Share on other sites
Thanks for the advice I will look into entity systems.

[quote name='Magdev' timestamp='1355982653' post='5012717']
Unless you don't plan on expanding your game past "The Adventures of Tinyguy: Rogue Sign-Reader Extreme".
[/quote]

ROFL~!
0

Share this post


Link to post
Share on other sites
[quote name='Magdev' timestamp='1355982653' post='5012717']
Having a character for each sign is a really bad idea. You should implement some sort of entity system so that you can add signs and other objects in the world separate from your tilemap. You gotta do it some time, right? Unless you don't plan on expanding your game past "The Adventures of Tinyguy: Rogue Sign-Reader Extreme".
I recommend looking through some general tile engine tutorials as well. Good luck, mang.
[/quote]

Defining your maps in a text file is IMO a good way to create simple maps, or for prototyping.
If you were doing something fit for a gameboy, you might never need anything more than that, and then an entity system for the static bits would be overkill. You don't necessarily have to do it some time, but even if you do, this step is great for learning as well as being easier to debug. It's pretty much WYSIWYG. -t gives you a good feeling of the map, and doesn't take a lot of space, is portable etc.
I suggest that you keep a sign file, or a sign list further down in the same file:
[code]
MAP SIZE H,V
TILECHARSTILECHARSTILECHARSTILECHARS
TILECHARSTILECHARSTILECHARSTILECHARS
TILECHARSTILECHARSTILECHARSTILECHARS
[6,11] "Welcome home!"
[6,12] "We hope you enjoyed your visit!"
[7,11] "Happy birthday!"
[10,16] "Register Cosmo Today!"
[/code]
And this map coordinates to strings.
You could keep lists of NPCs and monsters too. Edited by SuperVGA
1

Share this post


Link to post
Share on other sites
[quote name='SuperVGA' timestamp='1355988556' post='5012727']
[quote name='Magdev' timestamp='1355982653' post='5012717']
Having a character for each sign is a really bad idea. You should implement some sort of entity system so that you can add signs and other objects in the world separate from your tilemap. You gotta do it some time, right? Unless you don't plan on expanding your game past "The Adventures of Tinyguy: Rogue Sign-Reader Extreme".
I recommend looking through some general tile engine tutorials as well. Good luck, mang.
[/quote]

Defining your maps in a text file is IMO a good way to create simple maps, or for prototyping.
If you were doing something fit for a gameboy, you might never need anything more than that, and then an entity system for the static bits would be overkill. You don't necessarily have to do it some time, but even if you do, this step is great for learning as well as being easier to debug. It's pretty much WYSIWYG. -t gives you a good feeling of the map, and doesn't take a lot of space, is portable etc.
I suggest that you keep a sign file, or a sign list further down in the same file:
[code]
MAP SIZE H,V
TILECHARSTILECHARSTILECHARSTILECHARS
TILECHARSTILECHARSTILECHARSTILECHARS
TILECHARSTILECHARSTILECHARSTILECHARS
[6,11] "Welcome home!"
[6,12] "We hope you enjoyed your visit!"
[7,11] "Happy birthday!"
[10,16] "Register Cosmo Today!"
[/code]
And this map coordinates to strings.
You could keep lists of NPCs and monsters too.
[/quote]

I implemented this and it works great. The only thing I need to do is figure out how to empty the previous events when I change rooms.

For example. vector<vector<Entity>> mve(width, vector<Entity>(height));
mve (map vector entity) is a vector of a vector of entities (a class made for entities). When I go from map to map, mve still stores the previous maps events. How do I clear a vector of a vector of a class?
0

Share this post


Link to post
Share on other sites
You could delete your map object and make a new one with the file.

eg:
delete mapobject;
mapobject = 0;
mapobject = new maptype(filename);

That will flush out everything and let you start fresh. Edited by Daaark
1

Share this post


Link to post
Share on other sites
[quote name='Daaark' timestamp='1356019438' post='5012826']
You could delete your map object and make a new one with the file.

eg:
delete mapobject;
mapobject = 0;
mapobject = new maptype(filename);

That will flush out everything and let you start fresh.
[/quote]

I tried all three and a lot of other things.

When I write delete mve it says expression must have pointer or handle type. I tested this and outside of the game loop you can delete mve just fine.

Any ideas?
I am trying to clear mve on lines 242 and 245.

Here is main.cpp [url="http://pastebin.com/ijniABZi"]http://pastebin.com/ijniABZi[/url]
Here is main.h [url="http://pastebin.com/C8czy6a5"]http://pastebin.com/C8czy6a5[/url]
Here is maps.h [url="http://pastebin.com/LscF4HPj"]http://pastebin.com/LscF4HPj[/url] Edited by black_darkness
0

Share this post


Link to post
Share on other sites

I just don't get what is going wrong.

 

 

I have no idea why when I insert this

 

        Entity empty;
        for (int i=0;i<30;i++){
            for (int j = 0;j<30;j++) {
            mve[i][j] = empty;
            }
        }

 

 

before this

 

        Entity door;
        door.set_warp("house");
        door.set_hero_loc(16,15);
        mve[15][9] = door;

 

 

I get an vector subscript out of range error.

 

What is going on here? angry.png

Edited by black_darkness
0

Share this post


Link to post
Share on other sites
I fixed it. That was the most painful bug I have ever experienced.

If you follow a career in computer programming you will experience thousands of new and creative ways to break things. To me, that is part of the fun.
2

Share this post


Link to post
Share on other sites
I fixed it. That was the most painful bug I have ever experienced.

If you follow a career in computer programming you will experience thousands of new and creative ways to break things. To me, that is part of the fun.

I got a huge rush after I solved it. Feels great. Now I am just worried about how disorganized my code is getting. I am inexperienced when it comes to organizing things.

0

Share this post


Link to post
Share on other sites

Quick tip: An array of arrays is not the same thing as a 2D array. One major difference is that each "row" of the vector-of-vectors aren't forced to be the same size.

 

For 2D arrays, I recommend a single vector, resized to (width * height).

 

You can then index into the vector using this:

[code]myVector[(y * width) + x][/code]

 

Although it looks more pleasing to do myVector[x,y], having a vector-of-a-vector complicates things by forcing you to manually keep the vector's rows the same length anytime you resize it.

 

To clear the vector:

[code]myMap.assign((width * height), defaultTileValue);[/code]

This overwrites all the existing values with 'defaultTileValue'.

2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0