• 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
StakFallT

Cannot convert parameter error occuring when working with polymorphism, class-hierarchies, and pointers

6 posts in this topic

Ok quick question. I'm running into an error, essentially a "cannot convert parameter 1 from '<base_blah *>' to '<derived_blah *>' error. (Error C2664). I put together some pseudo-code that is basically a really stripped down version of the code I'm working on, but I think it provides a basic idea of what I'm trying to do and the specific line the specific error occurs at. The code is located here: [url="http://ideone.com/FO5Yu"]http://ideone.com/FO5Yu[/url]

Please keep in mind, again, class names have been generalized, some functions that are called have been taken out (As they don't add anything to the example), and I may even be missing a few virtual function placements in the derived stuff. What I'm specifically interested in is line 60. That's where the specific error occurs, so please exclude things like design, missing function layouts etc. from any examinations. I'm looking for help on the error, not critique (Especially since it's pseudo-code ;) In the actual code a lot of the stuff is in place and correct but the error I mentioned occurs, hence the reason for the whole post and I beleive it's something very specific; like I can't do what I'm trying to do or something (Which I think I actually can on this or something pretty close...) If anything is unclear about what I'm trying to accomplish, don't hesitate to ask and I'll try to clear it up [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Thanks in advance!

-- StakFallT
0

Share this post


Link to post
Share on other sites
It would be better for all if you were to post a piece of code that we can compile ourselves and that shows the problem. The more stuff you remove from the code the better, so just post a minimal example (as in, if you removed anything else, you couldn't show us the problem).

Some idea of what the code is supposed to accomplish would be good. Since it's not working code, we can't figure out what it's supposed to do based on what's written there.

Are you by any chance trying to have a virtual function that can be specialized for several of its arguments? You may want to look up "double dispatch".
0

Share this post


Link to post
Share on other sites
Yeah, that's exactly where I started, was double dispatch. Well technically I started with the visitor pattern, but explanations I got on the dispatch mechanism seemed to differ. Some explanations seemed to imply that double dispatch, is essentially a pipeline of and accept and then visit callback starting with the accept that then used another accept and a visit ; whereas other dispatch explanations seemed to explain double dispatch as two parameters on the visit argument (Which I think is what you're referring to). Either way, I looked at it, and it just wouldn't work with a vistor pattern. Hard to explain, but for example on an expression tree, if you have a node base, then a nodeleaf (With like bool, char, etc under that), and an Op node (With like add, sub, etc...) under the node base also, the accept methods would be on the bool, char stuff, so calling from the add,sub, etc classes would cause a call to the proper datatype class fine and dandy, but then the visit call back would only be possibly-able to return, basically, "this" (Which would be a bool class or char class etc) i.e. one-half of what's needed (Since an op is not just a single operand, but two). So I had to nix the idea of the accept/visit pattern and roll the eval into the sub,add,mult, etc classes (Where the left and right nodes are stored) with the specific datatype classes handling just things like either emitting string output or returning its value by actual type (Not cBool, but actual bool, etc) as a void pointer and casting it to bool (Which, using deductive reasoning in my design is actually as safe as it can be made). But I'll see what I can do about putting together something that actually compiles (Well, up until the error that is :P )
0

Share this post


Link to post
Share on other sites
Ok I remade the test case, it's essentially my actually code stripped down to a single datatype (As the others would just bloat the example). Original class names are left intact, virtual function layouts should be the same. Only one question though, would you mind if I PM'ed you the link? It's going to be going into a commercial product, and I'd rather not plaster code from it wide-open.
0

Share this post


Link to post
Share on other sites
I'm not a big fan of doing things via PM. I help out in these forums as some sort of donation of time to the community, and I would rather it help as many people as possible. If we do this through PMs, it will only help you.

But if that's the only way that works for you, PM me the link and I'll take a look. No promises, though. Edited by alvaro
0

Share this post


Link to post
Share on other sites
I agree, I like others learning from what I'm working on. My fear is the person that just does a drive-by (That you don't know about) and copy and pastes my code into their project. That's why I did an example case... I mean I don't think it would happen as the Gamedev has always been great; however there's always that one person that comes along, in anything, and makes the exception... I guess nm. I'll continue to try to work it out on my own.
0

Share this post


Link to post
Share on other sites
[quote name='StakFallT' timestamp='1346726978' post='4976286']
My fear is the person that just does a drive-by (That you don't know about) and copy and pastes my code into their project. That's why I did an example case...
[/quote]

Your stripped-down code should end up being even smaller than the example case.
0

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