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

Elspin

Members
  • Content count

    53
  • Joined

  • Last visited

Community Reputation

135 Neutral

About Elspin

  • Rank
    Member
  1.   Thanks, I'll definitely try this out!
  2.   My OP states pretty clearly multiple times that I already know the transport layer, and ENet is in fact a library I use. The topic is directed towards the interpolation and display of sent data to make things like positions, firing times, animation states, etc look smooth on a client that is receiving a message stating an event has happened a very significant amount of time after the event has happened. 
  3. Thanks for the responses guys - they do help, but I'm looking more for solid example code. A while ago I tried, but it didn't end up working very well. I've already read a lot of articles on the subject so I understand what I should be doing, but getting it to work well is another matter. EPIC is something I've been looking at for a while as it does an ok job at doing what I want to do, but it's rather cryptic and comes with no documentation other than a few comments.
  4. Does anyone have some good resources with solid example code for writing network code for games? I'm fine with socket code, just the actual syncing and interpolation to make movement/animation between two clients look smooth and proper is really not going well for me. I looked through a few books but most were hundreds of pages long and the stuff I'm interested in is drowned in 400+ pages of instructions for doing things in very old depreciated versions of  directx. I've had no problem setting it up in things like Unity that handle all the fancy interpolation and timing for you, but I find using things like Unity cause me a lot of grief when I want to start doing more complicated things like hosting multiple rooms on the same server. Any resources you guys know of that could help? To be more specific I mean real time authoritative server/client setups such as is often used for the source engine. The source engine papers are interesting and helpful, but not easy to reproduce for someone's beginner attempts at networked gaming. No help needed at all with transmission of data really, more just making that data sent useful and smooth looking to the client.
  5. [quote name='smasherprog' timestamp='1309654268' post='4830493'] One thing to try is not to destroy the packet after sending. The ENet library takes ownership of the packet after you call send. The only time you should call destroy is after you are done processing a packet after a RECEIVE event occurs. [/quote] Score! That seems to have fixed the problem. I missed the part in the tutorial where it said that ENet only needs you to clean up packets after receive, thanks for informing me.
  6. [quote name='ApochPiQ' timestamp='1309644190' post='4830476'] What's the value you receive versus the value you send? Is it consistent, or random? [/quote] It appears to be totally random - though it sometimes stays the same for multiple runs. As of right now I'm sending a unsigned short of 13 and recieving an unsigned short of 30888.
  7. I've decided to give the ENet library ( [url="http://enet.bespin.org/"]http://enet.bespin.org/[/url] ) a try for use in a simple game I'm trying to make. Unfortunately I'm having some trouble getting off the ground using it - everything was fine when I was using strings but now I've run into some trouble. I set up a simple packet structure that looks like this (example for the Vector3 packet): [ packet type - 2 bytes ] [ variable x - 4 bytes ] [ variable y - 4 bytes ] [ variable z - 4 bytes ] on my console client test I have this code checking the packet ready to be sent, and everything checks out exactly as it should with typ1 and typ2 agreeing that the 2 byte header is 13. [code]Vector3 testvec; testvec.type = 13; testvec.x = 5.5; testvec.y = 250; testvec.z = 3.333; packet = fillPacket( testvec ); uint16 *typ1; uint16 typ2; typ1 = (uint16*)(packet->data); memcpy( &typ2, packet->data, 2); std::cout << "typ1:" << (*typ1) << "\n"; std::cout << "typ2:" << typ2 << "\n"; enet_peer_send(event.peer,0,packet); enet_packet_destroy( packet );[/code] then on my console test server, this is where everything goes wrong - the packet arrives the exact correct size, and x y and z are perfectly arranged bit-by-bit, but the 2 byte type header appears to be just random memory completely unrelated to what I sent. [code]case ENET_EVENT_TYPE_RECEIVE: printf ("A packet of length %u was received from %s on channel %u.\n", event.packet -> dataLength, event.peer -> data, event.channelID); uint16 *typ1; uint16 typ2; typ1 = (uint16*)(event.packet->data); memcpy( &typ2, event.packet->data, 2); std::cout << "typ1:" << (*typ1) << "\n"; std::cout << "typ2:" << typ2 << "\n";[/code] I'm not really sure where to go from here - obviously if I can't get the packets to send properly I can't make a full game using this, and I'm not sure what's going wrong. Does anybody with more experience with ENet know what could be causing this? Does it have some kind of cruel hatred for unsigned shorts? Did I just make a dumb mistake like put an ampersand somewhere I shouldn't have?
  8. Thanks, I was warned about that when I was still using it on xp, but never changed it because it crashed whenever I tried to initialize it. I was just doing it the wrong way though, so it works now. I really appreciate it
  9. I'm having a bit of trouble with irrlicht. I'm just using part of the GUI right now, to make a listbox/textbox/button for a simple chat interface. It worked fine until I transferred the code onto my new laptop, which is a 32bit vista. It compiles and runs fine, but when the text is sent it sends, and displays the message in the listbox, but then seconds later I get the popup that says "Chat.exe has stopped working". Here's the code, SFML is worked in for the networking half but I determined even if you comment out the SFML stuff it still happens. #include <irrlicht.h> #include "Network.h" #pragma comment(lib, "Irrlicht.lib") #pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup") using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; struct SAppContext { IrrlichtDevice *device; IGUIListBox* listbox; IGUIEditBox* textbox; IGUIEditBox* namebox; IGUIWindow* window; stringw name; sf::SocketTCP Socket; }; // Define some values that we'll use to identify individual GUI controls. enum { GUI_ID_SEND_BUTTON = 101, GUI_ID_SETNAME_BUTTON = 102 }; void send_text( SAppContext &context ); void CreateNameSelector( SAppContext &context ); void send_text( SAppContext &context ) { //put message together stringw message = context.name.c_str(); message += ": "; message += context.textbox->getText(); //add message to listbox. context.listbox->addItem( message.c_str() ); context.textbox->setText(L""); //convert to normal char, wchar_t* does not work in a console app iostream. char* conv_string; wchar_t* input = const_cast<wchar_t*> (message.c_str()); wcstombs( conv_string, input, 800); // Send it to the server sf::Packet Packet; Packet << SEND_CHAT << conv_string; (context.Socket.Send(Packet) == sf::Socket::Done); } class MyEventReceiver : public IEventReceiver { public: MyEventReceiver(SAppContext & context) : Context(context) { } virtual bool OnEvent(const SEvent& event) { if (event.EventType == EET_GUI_EVENT) { s32 id = event.GUIEvent.Caller->getID(); IGUIEnvironment* env = Context.device->getGUIEnvironment(); switch(event.GUIEvent.EventType) { case EGET_BUTTON_CLICKED: if (id == 101) { send_text( Context ); return true; } if (id == 102) { Context.name = Context.namebox->getText(); Context.window->remove(); } break; default: break; } } else if (event.EventType == irr::EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown) { switch (event.KeyInput.Key) { case irr::KEY_F2: CreateNameSelector( Context ); return true; case irr::KEY_ESCAPE: Context.Socket.Close(); Context.device->closeDevice(); return true; case irr::KEY_RETURN: send_text( Context ); return true; default: return true; } } return false; } private: SAppContext& Context; }; void CreateNameSelector( SAppContext& context ) { context.listbox->addItem(L"Setting Name"); context.window = context.device->getGUIEnvironment()->addWindow( rect<s32>(100, 100, 300, 160), false, L"Display Name:"); context.namebox = context.device->getGUIEnvironment()->addEditBox(L"", rect<s32>( 10, 30, 140, 50), true, context.window); context.device->getGUIEnvironment()->addButton(rect<s32>( 150, 30, 200 - 10, 50), context.window, GUI_ID_SETNAME_BUTTON, L"Set", L"Set's your name"); } void SetupGraphics( SAppContext& context ) { context.device->setWindowCaption(L"Irrlicht Engine - User Interface Demo"); IGUISkin* skin = context.device->getGUIEnvironment()->getSkin(); IGUIFont* font = context.device->getGUIEnvironment()->getFont("media/fonthaettenschweiler.bmp"); if (font) skin->setFont(font); skin->setFont(context.device->getGUIEnvironment()->getBuiltInFont(), EGDF_TOOLTIP); context.device->getGUIEnvironment()->addButton(rect<s32>(700 - 10, 600 - 10 - 20, 800 - 10, 600 - 10), 0, GUI_ID_SEND_BUTTON, L"Send", L"Send Message"); IGUIListBox * listbox = context.device->getGUIEnvironment()->addListBox(rect<s32>(10, 10, 800 - 10, 600 - 20 - 20)); context.textbox = context.device->getGUIEnvironment()->addEditBox(L"Editable Text", rect<s32>( 10, 600 - 10 - 20, 700 - 20, 600 - 10)); context.listbox = listbox; context.name = L"Default"; for (u32 i=0; i<EGDC_COUNT ; ++i) { SColor col = context.device->getGUIEnvironment()->getSkin()->getColor((EGUI_DEFAULT_COLOR)i); col.setAlpha(255); context.device->getGUIEnvironment()->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col); } } void SetupNetwork(unsigned short Port, SAppContext& context) { sf::IPAddress ServerAddress = sf::IPAddress::GetLocalAddress(); // Connect to the server if (!context.Socket.Connect(Port, ServerAddress)) { context.listbox->addItem(L"Failed to connect!"); return; } else { context.listbox->addItem(L"Connected Successfully"); } } int main() { // create device and exit if creation failed IrrlichtDevice * device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(800, 600), 32, false, false, true); if (device == 0) return 1; // could not create selected driver. // Store the appropriate data in a context structure. SAppContext context; context.device = device; SetupGraphics( context ); SetupNetwork( 1337, context ); // Then create the event receiver, giving it that context structure. MyEventReceiver receiver(context); // And tell the device to use our custom event receiver. device->setEventReceiver(&receiver); while(device->run() && device->getVideoDriver()) if (device->isWindowActive()) { device->getVideoDriver()->beginScene(true, true, SColor(0,200,200,200)); device->getGUIEnvironment()->drawAll(); device->getVideoDriver()->endScene(); } device->drop(); return 0; } Network.h just has SFML/Network.hpp and the enum that has SEND_CHAT. Does anyone know what could be causing this or how I could fix it? EDIT:Text being entered with just a constant like this: context.listbox->addItem(L"Text"); never causes any problems, so I imagine it would be a problem with the actual variable being entered? Maybe the conversion? I determined if I comment up to right before wcstombs it's fine, but it still doesn't make sense that that crashes it because it still executes past that for the rest of the function and sends it. It's also recieved properly in the other program (console), as the correct string... [Edited by - Elspin on January 15, 2009 1:02:34 PM]
  10. Thanks, that helped immensely. I didn't know the scripting language section included the actual embedding of it, I thought it was only for the actual use of it :o
  11. I'm trying to figure out how to do certain things to lua from C++, but I'm having a bit of trouble. Such as creating a table in lua and adding a variable to it, the equivalent to below from C++ t = {} t[1] = 1 just the basic creation of a table and adding a variable too it. So far, I've only figured out how to do this with the global table, _G. I appreciate any help with this.
  12. I don't really want to get into the specifics of entire other operating systems, but as for porting your applications to other computers of the same operating system, what is the requirement? I remember seeing an article somewhere on how to do this, and recently I tried to use an application I made on a friends computer and it failed. I thought I bookmarked the article, but apparently not. Can anyone tell me what I need to do?
  13. Quote:Original post by ToohrVyk Quote:Original post by Elspin I have never seen the "c_ptr()" method referenced anywhere, is it's parameter simply the string which you want to convert to a const char*? He meant std::string::c_str(). Thanks. I'll use std::string to concatenate the pointers then reconvert them to const char* then I guess.
  14. Quote:Original post by ToohrVyk #include <cstring> const char *prefix = "lua/"; const char *suffix = lua_tostring(luaVM, -1); const std::size_t psize = std::strlen(prefix); const std::size_t ssize = std::strlen(suffix); char *buffer = new char[psize + ssize + 1]; try { std::strncpy(buffer, prefix, psize); std::strncat(buffer + psize, suffix, ssize); // Use 'buffer' here delete [] buffer; } catch(...) { delete [] buffer; throw; } When I printed the buffer to the console, the two strings had some very strange characters between them.
  15. Quote:Original post by Ezbez Unless this is a homework assignment were you're not allowed to use std::string, you *can* use it. Since it looks like you're interfacing with Lua (which I'm guessing is a C library), you can use the std::string constructor which takes a const char* and the c_ptr() method which returns a const char*. Those two make it easy to use C code while retaining the usefulness of std::string. I have never seen the "c_ptr()" method referenced anywhere, is it's parameter simply the string which you want to convert to a const char*?