• What Do You Need Help With? V6
    7,544 replies, posted
Well because of lack of tutorials and doc for GWEN I need to ask you another question. How do I add method to onPress event for button? [CODE]MainMenuState::MainMenuState(void) { Gwen::Controls::Button* btnConnect = new Gwen::Controls::Button(GwenCanvas, "Exit"); btnConnect->SetText("Connect"); btnConnect->SetPos(100, 100); btnConnect->onPress.Add(GwenCanvas, &Test); } void MainMenuState::Test() { std::cout << "Test" << std::endl; }[/CODE] And when I'm compiling VS throw this: [CODE]error C2780: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,void (__thiscall T::* )(Gwen::Event::Info),void *)' : expects 3 arguments - 2 provided error C2276: '&' : illegal operation on bound member function expression [/CODE] What I'm doing wrong? It's based on UnitTest that Garry includes in his GitHub repo.
For the first one, you need a third parameter. I'm guessing that's userdata, so if you don't need additional information passed along try passing nullptr (or NULL in pre-C++11). For the second, try &MainMenuState::Test.
If you mean: [CODE]btnConnect->onPress.Add(GwenCanvas, &MainMenuState::Test, NULL);[/CODE] Then no, it's not working [CODE] error C2780: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,void (__thiscall T::* )(void))' : expects 2 arguments - 3 provided error C2784: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,void (__thiscall T::* )(Gwen::Event::Info),void *)' : could not deduce template argument for 'void (__thiscall T::* )(Gwen::Event::Info)' from 'void (__thiscall MainMenuState::* )(void)' error C2780: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,void (__thiscall T::* )(Gwen::Event::Info))' : expects 2 arguments - 3 provided error C2780: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,T)' : expects 2 arguments - 3 provided [/CODE]
Im try to develop a converter for .XML to .xlsx but the Problem is, my tool doesnt work right. Can someone look whats wrong ? [CODE] class Convert { public void con() { DataSet ds = new DataSet(); //Hier übertrage ich die XML Datei in das DataSet ds.ReadXml(@"\\\\sql4\\inexport\\Import\\de\\Renault\\Additionen\\additions_hdl.xml"); //Die tabelle abrufen aus dem Dataset DataTable dt = ds.Tables[0]; // Ein neues Excel Objekt generieren Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); //Ein neues Workbook generieren. string str = @"\\\\sql4\\inexport\\Import\\de\\Renault\\Additionen\\käse.xlsx"; Microsoft.Office.Interop.Excel.Workbook workbook = excel.Workbooks.Open(Filename: str); //Create worksheet object Microsoft.Office.Interop.Excel.Worksheet worksheet = workbook.ActiveSheet; foreach (DataTable tab in ds.Tables) { FromDataTableToExcel(tab,excel,workbook); } //Save the workbook workbook.Save(); //Close the Workbook workbook.Close(); // Finally Quit the Application ((Microsoft.Office.Interop.Excel._Application)excel).Quit(); } static void FromDataTableToExcel(DataTable dt, Microsoft.Office.Interop.Excel.Application excel, Microsoft.Office.Interop.Excel.Workbook workbook) { //Create worksheet object Microsoft.Office.Interop.Excel.Worksheet worksheet = workbook.ActiveSheet; // Column Headings int iColumn = worksheet.UsedRange.Columns.Count-1; int iColumn1 = iColumn; int iColumn2 = iColumn; foreach (DataColumn c in dt.Columns) { iColumn++; excel.Cells[1, iColumn] = c.ColumnName; } // Row Data int iRow = 0; foreach (DataRow dr in dt.Rows) { iRow++; // Row's Cell Data foreach (DataColumn c in dt.Columns) { iColumn1++; excel.Cells[iRow + 1, iColumn1] = dr[c.ColumnName]; } iColumn1 = iColumn2; } ((Microsoft.Office.Interop.Excel._Worksheet)worksheet).Activate(); } } [/Code]
[QUOTE=Sonic96PL;41600493]If you mean: [CODE]btnConnect->onPress.Add(GwenCanvas, &MainMenuState::Test, NULL);[/CODE] Then no, it's not working [CODE] error C2780: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,void (__thiscall T::* )(void))' : expects 2 arguments - 3 provided error C2784: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,void (__thiscall T::* )(Gwen::Event::Info),void *)' : could not deduce template argument for 'void (__thiscall T::* )(Gwen::Event::Info)' from 'void (__thiscall MainMenuState::* )(void)' error C2780: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,void (__thiscall T::* )(Gwen::Event::Info))' : expects 2 arguments - 3 provided error C2780: 'void Gwen::Event::Caller::Add(Gwen::Event::Handler *,T)' : expects 2 arguments - 3 provided [/CODE][/QUOTE] Oh, there are overloads. Remove the last parameter, but keep the added MainMenuState:: for the second one. [editline]26th July 2013[/editline] [QUOTE=Ow dow how do;41600548]Im try to develop a converter for .XML to .xlsx but the Problem is, my tool doesnt work right. Can someone look whats wrong ? [/QUOTE] Can you be more specific about what's wrong?
[QUOTE=ZeekyHBomb;41600776]Oh, there are overloads. Remove the last parameter, but keep the added MainMenuState:: for the second one.[/QUOTE] I've tried this before: [CODE]error C2440: 'static_cast' : cannot convert from 'void (__thiscall MainMenuState::* )(void)' to 'Gwen::Event::Handler::FunctionBlank'[/CODE] Eventually every combination leads to this. I don't understand why there's[I] (void) [/I]after [I](__thiscall MainMenuState::* )[/I].
[QUOTE=ZeekyHBomb;41600776] Can you be more specific about what's wrong?[/QUOTE] It fill the first row complete and right, but the next row have in the first coloumns the same Information and the tool dont fill the row with the same informations :/ It is totally strange :/
[QUOTE=Sonic96PL;41600845]I've tried this before: [CODE]error C2440: 'static_cast' : cannot convert from 'void (__thiscall MainMenuState::* )(void)' to 'Gwen::Event::Handler::FunctionBlank'[/CODE] Eventually every combination leads to this. I don't understand why there's[I] (void) [/I]after [I](__thiscall MainMenuState::* )[/I].[/QUOTE] void (__thiscall MainMenuState::* )(void) means a pointer to a member-function of MainMenuState with __thisscall calling convention, taking (void) parameter (so none) and returning void (so nothing). Have a look in the header what kind of function "Gwen::Event::Handler::FunctionBlank" is. [QUOTE=Ow dow how do;41600958]It fill the first row complete and right, but the next row have in the first coloumns the same Information and the tool dont fill the row with the same informations :/ It is totally strange :/[/QUOTE] Perhaps dt.Rows is of size 0? Does the body of that foreach-loop get executed? [editline]26th July 2013[/editline] [QUOTE=LuaChobo;41600794]Anyone know a good way to make it so a python script can't access files outside of its own directory? I was looking at pypy just for the sandbox stuff but I was wondering if it could be done natively.[/QUOTE] [url]http://wiki.python.org/moin/SandboxedPython[/url]
[QUOTE=ZeekyHBomb;41601099]void (__thiscall MainMenuState::* )(void) means a pointer to a member-function of MainMenuState with __thisscall calling convention, taking (void) parameter (so none) and returning void (so nothing). Have a look in the header what kind of function "Gwen::Event::Handler::FunctionBlank" is.[/QUOTE] [CODE]typedef void ( Handler::*FunctionBlank )();[/CODE] So i think that is a function that returns void and takes nothing as parameter. If I'm true, then these are very similar, the only change is [I]__thiscall [/I]I guess. Still don't know what to do, but I've learned a bit.
__thiscall might be the default calling convention for member functions in VS. Does MainMenuState inherit from Handler? Otherwise the function-pointer cannot be cast.
[QUOTE=ZeekyHBomb;41601266]__thiscall might be the default calling convention for member functions in VS. Does MainMenuState inherit from Handler? Otherwise the function-pointer cannot be cast.[/QUOTE] Works fine now. Thank you, again :)
Hey, I was trying to make a batch file that loops through two folders (with directories and files that have the same name as the other.) and compares if the files are different. If they are different, then copy from the first (write) folder to the target folder. I was planning to use this to overwrite one unpacked mod over another for Far Cry 3, so I could mix mods XML's together without having to guess what files were modified. I just have problems with the 'looping through both folders at the same time and comparing each file they pass' thing. This is what I have: [code] @echo off SET /P sourcepath=Type in the source path of the mod you want as main priority: SET /P writepath=Type in the write path of the mod you want to put in source: SET /P targetpath=Type in the target path of where you want the mod to be placed: echo Source Mod: %sourcepath% echo Write Mod: %writepath% echo Target Mod: %targetpath% pause XCOPY /v /f /s /y "%sourcepath%*.*" "%targetpath%*.*" pause FOR /R "%writepath%" %%W IN (*.*) DO ( FOR /R "%targetpath%" %%T IN (*.*) DO ( fc /l /n "%%W" "%%T" > nul if errorlevel 1 XCOPY /v /f /y "%%W" "%%T")) pause [/code] Any ideas? I'm gonna do some research on this quick. I've never touched batch on this level... [B]EDIT:[/B] I might have just got it working. If results on actual FC3 mods are successful, then [b]VICTORY HAS BEEN ACHIEVED.[/b] [b]EDIT2: [/b] So clooose. Anyone here know how to take a filepath in a loop and cut it down to the start of directories it's searching?
Just learned about new move semantics in C++11 and was wondering how to integrate it with my simple map container class. I have a game-board class (Map) that's basically a nice wrapper around a standard container to allow it to be indexed similar to a 2D array. The Map object can hold pointers to MapObjects (like players and items etc.), but I would rather it hold references to MapObjects that are moved rather than copied (this is probably not important because MapObjects are all very cheap, but as an exercise I thought it would be nice). The problem is I'm not sure how I could do this while dynamically allocating MapObjects; as the game progresses more items need to be created and destroyed. Can I accomplish this without using pointers? If I have a game manager class that contains a Map member can I have a method like so: [code] int spawnFood() { Food food{}; // Food is a MapObject this->map.set({0,0}, std::move(food)); } [/code] As I understand it this will allocate stack space for the new Food object, and then if I have written my move constructor correctly, it will deep copy the contents of the stack object into the Map object at location {0,0} and Food will be initialized to a cheap object that is deleted at the end of the method scope. The other side effect of this is that I won't be able to store nullptr for spaces that are empty; what would you recommend I store in places that are considered "empty" in my map? Is this a place where a singleton would be a valid way to represent all "empty" squares? This last point is what really concerns me and makes me think that perhaps unique pointers would be a better way to go, but I really dislike manipulating pointers. [editline]26th July 2013[/editline] Now that I think about it, I may have to use pointers because I am storing polymorphic types which are derived from MapObject, not MapObject's themselves. Would it be reasonable to instead maintain an array of unique_ptr to MapObjects?
Move-construction (and assignment) is only interesting for objects with heap-memory. The move-constructor can just swap the pointers from this and the other object instead of having to make a copy of that memory for exclusive use. What you can do to improve upon your initialization is constructing the object in-place, like the emplace-functions of the STL containers. You cannot store references directly in containers. You can maybe use std::reference_wrapper, however it sounds like your container is the owner of these objects, in this case it doesn't make sense to keep just references, because the memory would never be freed. Perhaps you can take a look at Boost's ptr_containers, if you don't mind Boost. A container with unique_ptrs would work fine. I'm unsure what you're getting at with manipulating pointers. Even with raw pointers you wouldn't have to do much pointer arithmetic or something like that. Note that you can use references in your interface, although internally you use pointers. For optional values you could consider boost::optional. Using a empty object singleton instead of a nullptr is fine. There's a pattern, I think it's called Null-Object pattern, which means having an object that when interacting with does nothing. Might be interesting for you if you don't want to check if the space is empty in a bunch of places, but just want all actions on it to do nothing. [editline]27th July 2013[/editline] And I didn't say it directly, but yes, for the polymorphism to work you'll need pointers somewhere, but you can use things like smart pointers and ptr_containers to notice it less. [url=http://stackoverflow.com/a/9470221]Here's a small comparision of container<unique_ptr> vs ptr_container[/url]. The emplace-thingy also won't help you then.
[QUOTE=ZeekyHBomb;41608355]Move-construction (and assignment) is only interesting for objects with heap-memory. The move-constructor can just swap the pointers from this and the other object instead of having to make a copy of that memory for exclusive use. What you can do to improve upon your initialization is constructing the object in-place, like the emplace-functions of the STL containers. You cannot store references directly in containers. You can maybe use std::reference_wrapper, however it sounds like your container is the owner of these objects, in this case it doesn't make sense to keep just references, because the memory would never be freed. Perhaps you can take a look at Boost's ptr_containers, if you don't mind Boost. A container with unique_ptrs would work fine. I'm unsure what you're getting at with manipulating pointers. Even with raw pointers you wouldn't have to do much pointer arithmetic or something like that. Note that you can use references in your interface, although internally you use pointers. For optional values you could consider boost::optional. Using a empty object singleton instead of a nullptr is fine. There's a pattern, I think it's called Null-Object pattern, which means having an object that when interacting with does nothing. Might be interesting for you if you don't want to check if the space is empty in a bunch of places, but just want all actions on it to do nothing. [editline]27th July 2013[/editline] And I didn't say it directly, but yes, for the polymorphism to work you'll need pointers somewhere, but you can use things like smart pointers and ptr_containers to notice it less. [url=http://stackoverflow.com/a/9470221]Here's a small comparision of container<unique_ptr> vs ptr_container[/url]. The emplace-thingy also won't help you then.[/QUOTE] Thank you, this makes a lot more sense now. I didn't even consider the new emplace functions, and this is really what I think I was emulating manually with move assignments. I do have one more question about the StackOverflow answer: when he says "Working with many standard algorithms can be... tricky. And by "tricky", I mean broken. Pointer containers have their own built-in algorithms." what algorithms is he talking about? Are there standard library functions which will only accept std::vector's and thus not boost::ptr_vector's? If this is all he means I don't believe I will have too much trouble as my use case is pretty simple. When I say "manipulating" pointers I really just mean using them whatsoever :v: I'm just very cautious whenever I get into a situation where the compiler won't catch my errors; this is the motivation for "moving" the object to the map or using a unique pointer: I can leverage the compiler to enforce my own design. However I know pointers are very useful, so I don't want to avoid them entirely, just minimize/abstract away their use. I think I'll go with the boost containers, because I would probably end up manually implementing interfaces which return references anyway. Also, boost conveniently provides nullable types with boost::nullable so I don't have to change any of my current logic (besides changing the name of internal function calls). Thanks again, I think this will be much easier to wrap my mind around and I won't have to worry so much about keeping track of pointers in higher-level code.
[QUOTE=Rayjingstorm;41608772]I do have one more question about the StackOverflow answer: when he says "Working with many standard algorithms can be... tricky. And by "tricky", I mean broken. Pointer containers have their own built-in algorithms." what algorithms is he talking about? Are there standard library functions which will only accept std::vector's and thus not boost::ptr_vector's? If this is all he means I don't believe I will have too much trouble as my use case is pretty simple.[/QUOTE] I believe that statement refers to the [url=http://en.cppreference.com/w/cpp/algorithm]algorithm-header[/url], specifically the sequence operations. I'm not sure how they're broken, (apparently they may attempt to [url=http://www.boost.org/doc/libs/1_54_0/libs/ptr_container/doc/faq.html#which-mutating-algorithms-are-safe-to-use-with-pointers]copy an object[/url], but then they will either just assign a reference, or if they strip the reference form the type, make a non-polymorphic copy) but [url=http://www.boost.org/doc/libs/1_54_0/libs/ptr_container/doc/ptr_sequence_adapter.html#algorithms]listed here[/url] are the algorithms provided directly the the ptr_container library.
Fuck, my head hurts. Say I have one point in 3D space, and I know the angles (in degrees) in which it's facing. Given a random distance, how can I find the 2nd point at the end of that distance, keeping all those angles in mind. [IMG]http://puu.sh/3NiVS.png[/IMG]
[QUOTE=dmillerw;41618402]Fuck, my head hurts. Say I have one point in 3D space, and I know the angles (in degrees) in which it's facing. Given a random distance, how can I find the 2nd point at the end of that distance, keeping all those angles in mind. [IMG]http://puu.sh/3NiVS.png[/IMG][/QUOTE] Uh, you just take the beginning point and add it with dir*distance? If you have your direction in euler angles you can look up how to turn them into vector and then use it as dir.
[QUOTE=dmillerw;41618402]Fuck, my head hurts. Say I have one point in 3D space, and I know the angles (in degrees) in which it's facing. Given a random distance, how can I find the 2nd point at the end of that distance, keeping all those angles in mind. [IMG]http://puu.sh/3NiVS.png[/IMG][/QUOTE] beginning point + distance vector rotated towards the angles = beginning point + (sin theta * cos phi, sin theta * sin phi, cos theta)^T * distance, if you're using the angles from spherical coordinates.
[QUOTE=ollie;41618510]Uh, you just take the beginning point and add it with dir*distance? If you have your direction in euler angles you can look up how to turn them into vector and then use it as dir.[/QUOTE] I'm not entirely sure what I have is that complex, but math goes over my head most of the time, so correct me if I'm wrong. To the best of my knowledge, I only have two angles, pitch and yaw.
I have an idea in my head for a android app. But I have no experience making apps, or any real programming experience . The app is not a game just text, doing some calculations and stuff. I would like to learn how to start making an app. But I have no where to start. Any suggestions?
The main programming language used for Android development is Java. As this is your first programming language I'd recommend getting a good book on starting programming with Java in general. Since Java is a popular language, there should be a bunch of books on the market. I cannot recommend you anything specific, since I learned Java in school and from the online Java reference hosted at Oracle. I don't think the reference is not a good way for a beginner to learn though. General recommendations for the book: Look that it's not too old, only a couple of years. Languages and idioms change. Then look for reviews. Not just if it's good or bad: different authors will employ different learning styles. Pick something that suits you. And of course make sure it's a book targeted at beginners. You probably won't understand much if it's a book for intermediates. I don't know if there's a book about getting started with programming for Android that does not expect knowledge of at least one other programming language as this is often the case for specific lectures. Maybe you're lucky and there is. Make sure if fulfills the criteria above though. Programming Android apps is a little different from desktop Java programming. You won't be able to deploy the programs you wrote for your desktop in Android, but the basics and concepts are the same. So after you're fluent in Java you can head to the official Android development guide, which assumes knowledge of Java, to get started with writing Android apps. [editline]28th July 2013[/editline] Oh, and in general when learning a programming language, play around with it. Trial and error is a fine way to aid learning. Knowing what error-messages mean and how to deal with them is important. Try doing stuff a little differently than in the book. Try to search the internet for a solution if necessary, although don't drift too far away or get discouraged when it doesn't work the way you want it to. You can also post here if you're getting errors you don't understand :smile:
Not really a question but a comment- Zeeky, you're like the king of helpfulness in this thread and I just wanted to say thanks!
ugh im tired and frustrated with Popen on python Popen(["java"]) why isn't python using my environment variables? failing that, why can't it simply find Popen(["C:/Windows/System32/java.exe"]) WindowsError: [Error 2] The system cannot find the file specified
Anyone know of any tutorials similar to antiRTFM's [url=https://www.youtube.com/watch?v=tyVhn0FWWB4&list=PL1D10C030FDCE7CE0]Absolute n00b spoonfeed[/url], I believe there are 77 videos in his collection, that focus on C instead of C++? I am looking for a good series to follow while practicing some technical code...
[QUOTE=Banana Lord.;41619354]Not really a question but a comment- Zeeky, you're like the king of helpfulness in this thread and I just wanted to say thanks![/QUOTE] I appreciate it. I like bananas. no homo [QUOTE=Shadaez;41621839]ugh im tired and frustrated with Popen on python Popen(["java"]) why isn't python using my environment variables? failing that, why can't it simply find Popen(["C:/Windows/System32/java.exe"]) WindowsError: [Error 2] The system cannot find the file specified[/QUOTE] According to [url=http://docs.python.org/3.3/library/subprocess.html#popen-constructor]the reference[/url] it does. And for me, it does too: [code]$ cat popen_env.py #!/usr/bin/env python3 from subprocess import Popen Popen("test.sh") $ ./popen_env.py Traceback (most recent call last): File "popen_env.py", line 3, in <module> Popen(["test.sh"]) File "/usr/lib/python3.3/subprocess.py", line 820, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.3/subprocess.py", line 1438, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'test.sh' $ PATH=. popen_env.py hi[/code] The java.exe in System32 not executing [url=http://superuser.com/questions/545251/why-wont-java-execute-from-c-windows-system32]does not seem unusual[/url]. Perhaps that also gets selected with the execution environment for Python. Even if it is a [url=http://mindprod.com/jgloss/javaexe.html#MULTIPLES]"dummy java.exe"[/url], I don't quite understand why it would not work. Some solutions I can think of are perhaps adapting your PATH to scan the JRE binary directory before System32, taking out the System32-directory from the PATH in Python and giving the process that environment or doing the look-up that "dummy java.exe" does manually in Python to get full path.
[QUOTE=dmillerw;41618644]I'm not entirely sure what I have is that complex, but math goes over my head most of the time, so correct me if I'm wrong. To the best of my knowledge, I only have two angles, pitch and yaw.[/QUOTE] Yaw is phi, pitch could be theta if it starts at the top. Otherwise switch sin theta with cos theta both ways.
I'm still new to C++ and game programming so I just want to get criticism on how I'm putting things together. I'm writing a small Tron clone. To keep things simple I'm only worrying about rendering with Qt so whatever my view ends up manifesting as will just inherit QWidget and draw in paintEvent. My current design is really simple; I have one class (Tron) which inherits from QWidget and thus handles input (key events) and output (painting). I thought about what makes a game of Tron, and it certainly has a collection of Player objects, each with a bunch of Nodes that interact on a Map, so all of these seem like reasonable places to employ objects. Now I'm at the point of deciding where logic goes, and I'm not entirely sure. It would make sense conceptually that a player knows how to, say, move itself on the map, but at this point it has to know of the map and by extension of all other players. If instead it simply knew of itself it wouldn't make sense to put any game logic in it at all, and it would simply become a nice wrapper around some data that represents the idea of a player. If I went this route almost all game logic would reside in the main Tron object, and while this sounds fine for a small project like this I'm trying to keep in mind what I would want in the case of a larger, more complex game with complicated interactions. So my question is where you would place game logic: spread out over all game objects, each requiring references to one another or perhaps just to a central coordinator, or all in one monolithic logic object (or perhaps a few logic objects, if there is a logical place to make separations in a larger game), rendering all game objects just dummy containers.
I think the most popular approach is having each entity telling what it wants, meaning the bikes would store a "desired position" (or a velocity vector; a simple direction (enum) would probably suffice for the classic 90° turn Tron) variable. Then a more global coordinator would take care of advancing the bikes there, updating the trail and checking for collision and either handle it directly or pass that information to something else handling the stuff. Having the bikes advancing themselves would probably make it a bit harder or less efficient to check for collisions. And like you I mentioned having them check for collisions themselves introduces many cross-dependencies and seems like bad design. Putting no logic in the bike objects themselves and letting them be pure 'data-objects' sounds somewhat similar to data-driven design. I personally have not written code for such a design, but it has obvious performance advantages due to cache coherence and more potential for vectorization. It seems less straight-forward, thus more difficult to design and implement, maybe that's just due to the unfamiliar approach though.
[QUOTE=ZeekyHBomb;41628679]I think the most popular approach is having each entity telling what it wants, meaning the bikes would store a "desired position" (or a velocity vector; a simple direction (enum) would probably suffice for the classic 90° turn Tron) variable. Then a more global coordinator would take care of advancing the bikes there, updating the trail and checking for collision and either handle it directly or pass that information to something else handling the stuff. Having the bikes advancing themselves would probably make it a bit harder or less efficient to check for collisions. And like you I mentioned having them check for collisions themselves introduces many cross-dependencies and seems like bad design. Putting no logic in the bike objects themselves and letting them be pure 'data-objects' sounds somewhat similar to data-driven design. I personally have not written code for such a design, but it has obvious performance advantages due to cache coherence and more potential for vectorization. It seems less straight-forward, thus more difficult to design and implement, maybe that's just due to the unfamiliar approach though.[/QUOTE] I like the idea of keeping a desired state and letting a coordinator keep track of interactions between objects, and I agree that using objects without any behavior is counter-intuitive, so how about something like this: A Player knows whether it is in play (can move) and keeps track of a direction (where to move next, if it can) and a list of its positions (just as {x,y} coordinate pairs in a world it is not actually aware of). Then, the coordinator has a list of players. The coordinator, each update tick, checks for collisions; if a player is colliding with another its playing flag is set to false to let it know it can't move any more. The coordinator then tells every player to update and those that can do and those that can't stay still. This repeats until the coordinator determines someone has won (all other players are not playing), displays the winner and asks to start a new game.
Sorry, you need to Log In to post a reply to this thread.