C++ :: Saving Huge Arrays For Game?

Nov 3, 2013

I have been coding a while on a 2D random terrain game. How would I go about saving the maps? I have an array for blocks, lighting, background and background lighting. The lighting is done in real-time, so exclude that.

But with two 32000x3200 arrays, I still need to store 204800000 separate numbers in a file. Oh god. How can I have this? I could write down the separate numbers, but...yeah.

If it matters, this is made in freeglut.

View 2 Replies


ADVERTISEMENT

C++ :: Saving Progress Of A User In Quiz Game

May 5, 2014

I'm making a quiz game in c++. I've already completed it. But now I've thought of creating a profile and saving the progress for the user so when he enters his name the game continues frm where he had saved it.

View 3 Replies View Related

C++ :: Text Based RPG Game - Saving Integers And Strings

Jul 14, 2013

I am working on a text-based RPG game and I want to allow the player to save his progress. So I need to save several integers and a string. And my problem starts here "How can I save integers and load them?". I read the tutorial but I dont understand. I need to write a function to save game?

View 8 Replies View Related

C# :: Snake Game Using 2D Arrays

Jun 1, 2014

I'm trying to make a simple snake game in C# using 2 Dimensional Arrays . I have a grid of labels. I am having problems with differentiating the head of the snake from the rest of it's body. Also I need generating 2 random numbers and filling them inside my array.

I don't know how to place random food on my array. This is because the food can't be placed on the location of the snake. Which brings me to my other problem which is keeping track of the snake and updating it. I don't know what structure to use and How to actually do the above methods. I've tried looking at a lot of sample snake projects but they don't have arrays in them.

View 14 Replies View Related

C++ :: Tic Tac Toe Game - Applying OOP And Arrays

Sep 25, 2012

Objective : Code a game allowing two human players to play tictactoe.

Create 2 classes:
-Create a 3 x 3, 2-D array board class to play the game.
-Player; has a private string name data member and a method that reads the players’ row and column selections from the keyboard.

Create 2 player objects from this class. Name the players Orestes and Xerxes.

Think carefully about board and player classes responsibilities and how they interaction with one another. The players do not collaborate with one another but they collaborate with the board.

My Problem : The program compiles with the header file, but it the displaying is wrong as you will see when you enter your row and column.

Sources
Header file:

Code:
#include <iostream>
#include <string>
using namespace std;
class Board {
public:
void display(char Z[][3], int row, int col);

[Code] ....

View 1 Replies View Related

C :: Creating Match-3 (Candy Crush) Game Using Arrays

Mar 6, 2015

I'm supposed to create a "game" that is similar to Candy Crush or Bejeweled. The assignment takes in a .txt file that contains a matrix of values from 1-5 and then assigns each value to a spot in a [10][10] array. Then an Escape Code function prints out colored pixels in place of the number values for each spot, creating a "game board" looking output. Finally, the program is supposed to look for any matches of 3 same-colored pixels and replace them with a white pixel and "XX". Then the program prints the corrected game board with the matches X'd out.

I have it mostly coded, but I've encountered a couple of issues.

1.) I am supposed to label the columns and rows 0-9, and while I have no problem coding the labels for the columns using printf( ), when I try to print the row labels I get a random string of numbers.

2.) I replaced the matches with white pixels by reassigning the value in the array to 7, for which the ANSI Escape Code is white. However, I'm unsure about how to print the "XX" in the same spot.

Here is the input(.txt) file and the output of the program so far:

And here is what I have coded at this point:

Code:
#include <stdio.h>
void printEscapeCode(int c);
int main(void)
{
/* Declare an image array to be gameboard */
int gameboard[10][10];
/* Declare variables and load in how many rows and columns */
int Nrows;
Nrows = 0;

[code]....

View 2 Replies View Related

C++ :: Making Arrays For Equipping Weapons In Simple RPG Game

Feb 26, 2014

I have a sword(25 damage), spear(20 damage), arrow(15 damage), dagger(10 damage) and knife(5 damage). I want to make a class for them so that I can equip one of them in battle and use them to inflict damage.

View 1 Replies View Related

C/C++ :: Madd Libs Game - How To Store Inputted Strings Or Values To Arrays

Nov 11, 2014

My assignment is writing Madd Libs game. I still do not understand how to store inputted strings or values to arrays. I need explanation of collecting inputted data to arrays.

#include "stdafx.h"
#include<stdio.h>
//#include<string.h>
int main(void) {
char string[37] = {''};
char adjective1[15];

[Code] ....

View 14 Replies View Related

C/C++ :: How Does Huge Pointer Work

Feb 25, 2013

I can not understand huge pointer, how its working.

#include<stdio.h>/ *How its working &decleration*/
int main(){
int huge *a =(int huge *)0x59990005;
int huge *b =(int huge *)0x59980015;
if(a == b)
printf("power of pointer");
else
printf("power of c");
return 0;
}

View 4 Replies View Related

C++ :: How To Allocate Huge Amount Of Memory

Mar 8, 2014

I’m writing an application for raw image processing but I cannot allocate the necessary block of memory, the following simple code gives me an allocation error.

double (*test)[4];
int block = 32747520;
test = new double[block][4];

off course with smaller block size (i.e. int block = 327475;) it works fine. Is there an allocation limit? How it is possible to deal with big blocks of memory?

View 2 Replies View Related

C++ :: Using List To Implement Huge Numbers?

Nov 22, 2013

Im trying to implement a way to use really big numbers to be able to add, substract and multiply them with the class I made. for example:

huge a = "45646464646455464654656"
huge b = "456464564646544646"
huge c = a+b;

[Code]....

View 13 Replies View Related

C++ :: Huge Vector - Find Item Fast

Dec 31, 2012

I want to build a server which holds hundreds of thousands of active users in memory. To keep all the users organized i would like to store them in a Vector.

The problem is how i could quickly and easy find the object whenever i need it? All users will have a unique ID. Would it be possible to keep some form of a Vector Index on the unique id number?

View 2 Replies View Related

C Sharp :: Fetch Huge Files From The Webserver

Jun 14, 2012

i have a spec for fetch the files from server and predict the un-used files from the directory in this situation i am going to fetch the files from server it will return huge files, the problem is the cpu usage will increase while i am fetching large files, so i like to eliminate this scenario.

View 1 Replies View Related

C++ :: Sort Huge Files (larger Than Available Memory)

May 30, 2012

I am trying to understand what techiques can be used to sort really huge files (larger than available memory). I did some googling and came across one technique.

1. Are there any better ways to get this done?

2. Is there some tweaking that can be done to make this itself better?

Large enough so that you get a lot of records, but small enough such that it will comfortably fit into memory

3. How do you decide on this value? Consider, memory is 4 GB and currently about 2GB is consumed, and file to sort is 10GB in size. (Consumed memory could of course change dynamically during execution - consumed more/less by other apps.)

View 5 Replies View Related

C/C++ :: How To Print A Huge Unsigned Long Int Number By Using Printf

Oct 29, 2012

Here is the code:

int unsigned long a,b;
scanf("%lu",&a);
scanf("%lu",&b);
printf("%lu",a*b);

suppose we input a very large number on a and b (no more than 1000 digit)

like a = 1234567890123456789012345678901234567890

and b = 9876543210987654321098765432109876543210

it outputs 1, why is it?

It is probably the answer is too big, is there any way to show a*b?

View 1 Replies View Related

C++ :: Game Design Practice For Accessing Container Of Game Objects

Dec 21, 2014

I'm working on my first video game. So far I have a few classes in the game starting with the Game class which includes a list of GameObjects (another class). There are several classes that inherit from GameObjects used to implement things like bullets, explosions, various enemy types, etc.

The game essentially iterates through the list of GameObjects to update/render them. I would like to provide access to the Game's list of GameObjects inside another class (like the Bullet class) so I can put new objects on the list. For example, when a bullet hits, I want to add an explosion to the Game's GameObject list it can be updated/rendered.

How this should be setup? I was considering adding a pointer to the Game or GameObject list to the GameObject class (and methods to access it), but I was wondering if there is a better way to set this up?

View 4 Replies View Related

C++ :: Program For Calculating Total Price Of Game Station And Game

Sep 13, 2014

I would like to make a program for calculating the total price of a game station, and a game. I made a program like this for just the price of a game in class, but I want to make one that does the game system as well.

View 7 Replies View Related

C :: Saving Into A Txt File

Feb 12, 2014

Code:
#include<stdlib.h>
FILE *Ptr_file;
Ptr_file =fopen("output.txt", "w");
struct person {
char arcFName[50],arcMName[50],arcLName[50],cGender[2];
int nDay[2],nMnth[2],nYear[4];

[Code] .....

Alright I wrote this code, i know there's some mistakes but how do you go about saving its output into a txt file?

View 4 Replies View Related

C# :: SQL Database Not Saving?

Oct 5, 2014

My program add something in a data base, but after program is closed all data is removed.

conturiSQLDataSet.LoginsRow newUserRow = conturiSQLDataSet.Logins.NewLoginsRow();
...
conturiSQLDataSet.Logins.Rows.Add(newUserRow);

There is a method that program can save all data?

View 2 Replies View Related

C++ :: Keystrokes Not Saving To Specified Location

May 23, 2013

Here's my code, my problem is that it is not sending the keystrokes to the LOG.TXT file I want them to be going to.

1 #include <iostream>
2 using namespace std;
3 #include <windows.h>
4 #include <winuser.h>
5 #include <stdio.h>
6 int save (int key_stroke, char *file);

[Code] ....

View 1 Replies View Related

C++ :: Saving Moving Objects?

Nov 1, 2013

I'm trying to serialize and deserialize objects, some static (that works) one moving (doesn't work). In the code you can see that the following int-variables discribe the moving circle:

object->phaseFarbe=phase1;
object->phaseKoord=phase;
object->rot=a;

[Code].....

View 1 Replies View Related

C/C++ :: Saving 2D Array To Dat File

Mar 16, 2015

I know how to save/open files but im just confused on where to write the code for it in this block of code :

#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int NUM_MONTHS = 12;// Number of months
const int NUM_CATEGORIES = 6;// Number of categories

[Code] .....

View 5 Replies View Related

C# :: GDI Error When Saving To Text

Jun 23, 2014

The code posted in the spoiler is for a text file that I am saving text in. I get a 0x80004005 GDI Error on the line in the second code block. Data.BadgeData is a string[,].

Spoiler
-Its Where the code is at

public void SaveData()
{
string FileData = Data.FileLocation + @"BadgeData.Txt", Temp = string.Empty, FolderData = Data.FileLocation +@"ID" ;

[Code].....

View 14 Replies View Related

C# :: Saving And Using Random Number?

Sep 27, 2014

I have this random number

List<string> ImageList = new List<string>();
ImageList.Add("Assets/Images/Image_0.jpg");
ImageList.Add("Assets/Images/Image_1.jpg");
ImageList.Add("Assets/Images/Image_2.jpg");

[Code] .....

The problem is that It generates a random number that can be the same as the last time. So I figured out, that I need to save my random number so I can use it later, as a if statement.

If saved number == r then it generates a new number.

how to save my generated number on OnNavigatedFrom method.

View 8 Replies View Related

C++ :: Saving Specific Bits From 64-bit Number

Jun 24, 2013

I have a 64-bit uint64_t number:

Code:
Primitive<uint64_t> b = 0xCCCCCCCC00000000; I need to save the first 31 (most important) bits - 7FFFFFFE.

I found this solution in the Internet:

Code:
start = (((b)>>(first)) & ((1<<(((last+1)-(first))))-1)); but in my case for this code:
Code: Primitive<uint64_t> start = (((b)>>(32)) & ((1<<(((63+1)-(32))))-1));

I get an error: left shift count >= width of type

And even if I change 63 to 62:

Code:
Primitive<uint64_t> start = (((b)>>(32)) & ((1<<(((62+1)-(32))))-1));

I get: error: integer overflow in expression

View 5 Replies View Related

C :: Saving Information From A File To Struct

Jan 12, 2014

I want to take the informaition from this file and save it into a struct the file conteins name age year (in char) and a grade it is somthing like this

file
Nikos Tolis 19 A 8
Iwanna Nikolaou 20 B 9
Kwstas Doukas 20 Β 6
Georgios Pappas 19 A 7
Iwannis Lekatis 20 Β 7
Nikos Ntoumas 19 A 5
Maria Oikonomou 20 B 6
Kwstas Argyrou 19 A 10
Irw Ntouma 20 B 8
Leuteris Doukas 19 A 6

I want to read till i found the '32' the space in ascii here is my code so far

Code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct students
{
char *name;
int age;

[Code] ....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved